Re: [R] Help needed for efficient way to loop through rows and columns

2012-05-16 Thread Priya Bhatt
g of all the values in the row. You seem to be coding as if i was > a > single integer (as in a for loop). > > ------ > David L Carlson > Associate Professor of Anthropology > Texas A&M University > College Station, TX 778

[R] Help needed for efficient way to loop through rows and columns

2012-05-16 Thread Priya Bhatt
Dear R-helpers: I am trying to write a script that iterates through a dataframe that looks like this: Example dataset called "sample": names <- c("S1", "S2", "S3", "S4") X <- c("BB", "AB", "AB", "AA") Y <- c("BB", "BB", "AB", "AA") Z <- c("BB", "BB", "AB", NA) AorB <- c("A", "A", "A", "B") sam

[R] Error in names(x) <- value: 'names' attribute must be the same length as the vector

2012-05-14 Thread Priya Bhatt
Dear R-helpers, I am stuck on an error in R: When I run my code (below), I get this error back: Error in names(x) <- value : 'names' attribute must be the same length as the vector Then when I use traceback(), R gives me back this in return: `colnames<-`(`*tmp*`, value = c(""Item", "Color"