[R] preserving date formats in functions

2012-06-05 Thread jween
Hi there! I have two date columns in a dataframe I need to selectively collapse based on missing values and which date comes first (imported from an text file). This is what I did: RHSSP$CT<- as.POSIXct(RHSSP$CT, format='%m/%d/%y %H:%M') RHSSP$MRI

[R] subset columns from list with variable substitution

2012-05-25 Thread jween
Hi there, I would like to use a list variable to select columns in a subset from a parent table: I have a data frame "table" with column headers a,b,c,d,e,x,y,z and list variables list1=c("a","b","c","d") list2=c("a","b","x",y","z") namelist=c("peter","paul","mary","jane") group1=c("peter","paul

Re: [R] subset columns from list with variable substitution

2012-05-25 Thread jween
Thanks Don but table[,list1] did not work either: Error in `[.data.frame`(table, , list1) : undefined columns selected. I'm guessing my list (list1) is not structured right? Displaying it has no commas, so the whole list may be taken as a single variable rather than a sequence of variables? I