Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9189503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:15:07+00:00 2026-06-17T20:15:07+00:00

I’m pretty new to R and programming itself,and right now I have an issue

  • 0

I’m pretty new to R and programming itself,and right now I have an issue with my data.frame that is not allowing me to continue my work.

I have a set of data as follows

Table 1

    Individual             Score
    Tim                      45
    Tim                      77
    Tim                      32
    Clare                    92
    Clare                    70
    Clare                    88

Let me explain the table 1 above, I have several individuals (TIm and Clare in the example above) and I have their score in a test they presented in 3 different occasions (2009, 2010, 2011) I am trying to figure out a way to turn that above into something like this:

Table2

    Individual             Score09             Score10             Score11
    Tim                      45                   77                  32
    Clare                    92                   70                  88

I used ddply to obtain the Table 1, since I originally had the information of the subsets of the test (the variable score is just the sum of all the subset)

Please let me know if there a way to actually end up with Table 2 instead of Table 1, Since I have over 10000 observations and the Table 1 set up wont let me move forward with the intended propose.

EDIT:

The original df from where Table 1 was generated is:

The data frame is as follows

    Base          Individual     score_math    score_bio     score_chem
    SB1120091       Tim              12            23             10
    SB1120092       Tim              30            25             22
    SB1120101       Tim              17             5             10
    SB1120091       Clare            50            20             22
    SB1120092       Clare            40            10             20
    SB1120101       Clare            47            20             21

And the code was:

>Table1 <-ddply(x, .(Indivual), summarise, Score=(score_math*score_bio*score_chem))

EDIT2:

The original data set has no Year variable but a base variable that provides information about when the test was taken.

Also The Score variable is calculated with as a product of all the subsets scores.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:15:08+00:00Added an answer on June 17, 2026 at 8:15 pm

    The data:

    df <- structure(list(Individual = structure(c(2L, 2L, 2L, 1L, 1L, 1L), 
                         .Label = c("Clare", "Tim"), class = "factor"), 
                         Score = c(45, 77, 32, 92, 70, 88), 
                         count = c(1L, 2L, 3L, 1L, 2L, 3L)), 
                         .Names = c("Individual", "Score", "count"), 
                         row.names = c(NA, -6L), class = "data.frame")
    df$count <- rep(c("09", "10", "11"), 2)
    
    • Using reshape from base stat:

      > reshape(df, idvar="Individual", timevar="count", direction="wide", sep="")
      
      #   Individual Score09 Score10 Score11
      # 1        Tim      45      77      32
      # 4      Clare      92      70      88
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.