Re: [R] average among one factor in a nested dataframe

2011-04-25 Thread Junqian Gordon Xu
-c(1:6) > a_df<-data.frame(cbind(id,f1,"y1",a)) > id<-c(1:9) > b_df<-data.frame(cbind(id,f1,"y2",b)) > > But I don't understand the "nested" databases. > I see that both have f1 variable but I do not see f2 variable in any of > them. S

[R] average among one factor in a nested dataframe

2011-04-24 Thread Junqian Gordon Xu
I have two nested data frames: a<-rnorm(6) b<-rnorm(9) f1<-c("x1","x2","x3")) f2<-c("y1","y2") id<-c(1:6) a_df<-data.frame(cbind(id,f1,"y1",a)) id<-c(1:9) b_df<-data.frame(cbind(id,f1,"y2",b)) I want to preserve id and f1, but want to collapse f2 and take the corresponding mean values of a and b.

Re: [R] code rows depending on the value of other rows in multilevel dataframe

2010-03-13 Thread Junqian Gordon Xu
in another dataframe. Gordon On Sat, Mar 13, 2010 at 7:54 PM, Junqian Gordon Xu wrote: > I have a multilevel dataframe (df): > >   ID             Date      Segment Slice Tract     Lesion > 1 CSPP005 12/4/2007       1     1      LCST         0 > 2 CSPP005 12/4/2007       1     1      LP

Re: [R] code rows depending on the value of other rows in multilevel dataframe

2010-03-13 Thread Junqian Gordon Xu
es you want to > transform. > > On Sat, Mar 13, 2010 at 8:54 PM, Junqian Gordon Xu wrote: >> >> I have a multilevel dataframe (df): >> >>   ID             Date      Segment Slice Tract     Lesion >> 1 CSPP005 12/4/2007       1     1      LCST         0 >

[R] code rows depending on the value of other rows in multilevel dataframe

2010-03-13 Thread Junqian Gordon Xu
I have a multilevel dataframe (df): ID Date Segment Slice Tract Lesion 1 CSPP005 12/4/2007 1 1 LCST 0 2 CSPP005 12/4/2007 1 1 LPC 2 3 CSPP005 12/4/2007 1 1 RPC 3 4 CSPP005 12/4/2007 1 1 R

Re: [R] regex expression to select row or column

2009-07-25 Thread Junqian Gordon Xu
is. On Sat, Jul 25, 2009 at 4:32 AM, Junqian Gordon Xu wrote: Actually when I read the spreadsheet from cvs file, "S1-[abcd]" are the header and "T1-[abcd]" are the strings in first column of the data frame. Gordon On 07/25/2009 03:13 AM, jim holtman wrote: It it not entirely

Re: [R] regex expression to select row or column

2009-07-25 Thread Junqian Gordon Xu
frame that you would like to separate into several different one based on the value in a column, then something like this will work: df.list <- split(yourDF, yourDF$column) This will create a list of dataframes, split according to the contents of "column". On Fri, Jul 24, 2009 at 9:2

[R] regex expression to select row or column

2009-07-24 Thread Junqian Gordon Xu
I have a multidimensional data which looks like the following: "S1-a" "S2-b" "S3-c" "S4-d" "S5-a" "S6-b" "S7-c" "S8-d" "T1-A" "T1-B" "T1-C" "T1-D" "T2-A" "T2-B" "T2-C" "T2-D" I read it from csv file and would like to have 16 separate data frames like this "S1-a" "S2-a" "S1-b"

[R] multiple error bars when NA present

2009-07-23 Thread Junqian Gordon Xu
package: psych function: error.bars() R version: 2.9.1 OS: both linux and windows a<-c(1,2,3,4,5) b<-c(1,2,3,4,4) c<-c(1,2,3,NA,5) data<-data.frame(a,b,c) error.bars(data[,1:2],ylim=c(0,6)) looks fine however error.bars(data,ylim=c(0.6)) shows multiple error bars for each vector and the num