[R] reshaping a data frame

2013-06-10 Thread Abhishek Pratap
Hi Guys I am trying to cast a data frame but not aggregate the rows for the same variable. here is a contrived example. **input** temp_df - data.frame(names=c('foo','foo','foo'),variable=c('w','w','w'),value=c(34,65,12)) temp_df names variable value 1 foow34 2 foow

Re: [R] reshaping a data frame

2013-06-10 Thread Adams, Jean
Abhi, In the example you give, you don't really need to reshape the data ... just rename the column value to w. Here's a different example with more than one category ... tempdf - expand.grid(names=c(foo, bar), variable=letters[1:3]) tempdf$value - rnorm(dim(tempdf)[1]) tempdf library(reshape)

Re: [R] reshaping a data frame

2013-06-10 Thread John Kane
, 9 Jun 2013 23:15:48 -0700 To: r-help@r-project.org Subject: [R] reshaping a data frame Hi Guys I am trying to cast a data frame but not aggregate the rows for the same variable. here is a contrived example. **input** temp_df - data.frame(names=c('foo','foo','foo'),variable=c('w','w

Re: [R] reshaping a data frame

2013-06-10 Thread arun
: Monday, June 10, 2013 2:15 AM Subject: [R] reshaping a data frame Hi Guys I am trying to cast a data frame but not aggregate the rows for the same variable. here is a contrived example. **input** temp_df  - data.frame(names=c('foo','foo','foo'),variable=c('w','w','w'),value=c(34,65,12)) temp_df

Re: [R] reshaping a data frame

2013-06-10 Thread Abhishek Pratap
@gmail.com To: r-help@r-project.org r-help@r-project.org Cc: Sent: Monday, June 10, 2013 2:15 AM Subject: [R] reshaping a data frame Hi Guys I am trying to cast a data frame but not aggregate the rows for the same variable. here is a contrived example. **input** temp_df - data.frame(names=c

Re: [R] Reshaping a data frame with a series of factors and 23 repeated measures

2010-03-30 Thread wclapham
Ista, I have looked at the reshape package and have used Œmelt¹ successfully on simpler tables. I tried it here, but have not been successful. I think I just need to gain experience. I am loving R and am having a difficult time with data structure issues. I am attaching the data set that I

Re: [R] Reshaping a data frame with a series of factors and 23 repeated measures

2010-03-30 Thread Gabor Grothendieck
Try this: cattle - read.csv(http://n4.nabble.com/attachment/1745223/0/CattleGrowth.csv;) long - reshape(cattle, dir = long, idvar = Steer.ID, varying = list(grep(Date, names(cattle)), grep(Days, names(cattle)), grep(Wt,names(cattle On Tue, Mar 30, 2010 at 9:34 AM, wclapham

Re: [R] Reshaping a data frame with a series of factors and 23 repeated measures

2010-03-30 Thread Ista Zahn
Hi Bill, Here is a reshape package version. The key thing to notice is that you have multiple pieces of information in your original column names. These can be split out using the colsplit() function: # Read in the data cattle -

[R] Reshaping a data frame with a series of factors and 23 repeated measures

2010-03-29 Thread wclapham
I have a data frame that I created using read.table on a csv spreadsheet. The data look like the following: Steer.ID stocker.trt Finish.trt Date Days Wt .. Steer.Id, stocker.trt, Finish.trt are factors-- Date, Days, Wt are data that are repeated 23 times (wide format). I want

Re: [R] Reshaping a data frame with a series of factors and 23 repeated measures

2010-03-29 Thread Ista Zahn
Hi Bill, Without an example dataset it's hard to see exactly what you need to do. But you can get started by looking at the documentation for the reshape function (?reshape), and by looking at the reshape package. The reshape package has an associated web page (http://had.co.nz/reshape/) with

[R] reshaping a data frame

2009-10-26 Thread Erin Hodgess
Dear R People: Suppose I have a data.frame, x.df, which has one column and 100 rows. Sometimes I need to see it as 20 rows and 5 columns, sometimes I need to see it as 10 rows with 10 columns. Is there a quick way to make those transformations, please? Thanks in advance, Sincerely, Erin PS

Re: [R] reshaping a data frame

2009-10-26 Thread John Kane
, nrow=20)) --- On Mon, 10/26/09, Erin Hodgess erinm.hodg...@gmail.com wrote: From: Erin Hodgess erinm.hodg...@gmail.com Subject: [R] reshaping a data frame To: R help r-h...@stat.math.ethz.ch Received: Monday, October 26

Re: [R] reshaping a data frame

2009-10-26 Thread Jim Lemon
On 10/27/2009 07:09 AM, Erin Hodgess wrote: Dear R People: Suppose I have a data.frame, x.df, which has one column and 100 rows. Sometimes I need to see it as 20 rows and 5 columns, sometimes I need to see it as 10 rows with 10 columns. Is there a quick way to make those transformations,