Re: [R] Subset based on multiple values

2012-07-11 Thread Amanduh320
I want the output to be 1,1,1,1,7,7,7,7 The multiple values of AllMax are 1 and 7. I think I've figured it out though, I added a loop at the end: test <- as.matrix(c(1,1,1,1,3,3,7,7,7,7)) Count <- tapply(test[,1], test[,1], length) # count for each value spp <- unique(test[,1]) Count1 <- as.dat

[R] Subset based on multiple values

2012-07-11 Thread Amanduh320
I'm stuck on a seemingly simple problem. I'm trying to subset the data by several numbers and it cuts out half of the rows. Here is the sample code: test <- as.matrix(c(1,1,1,1,3,3,7,7,7,7)) Count <- tapply(test[,1], test[,1], length) # count for each value spp <- unique(test[,1]) Count1 <- as.d

Re: [R] convert a table

2012-07-06 Thread Amanduh320
Fantastic, thank you so much! -- View this message in context: http://r.789695.n4.nabble.com/convert-a-table-tp4635615p4635627.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mail

[R] convert a table

2012-07-06 Thread Amanduh320
I have my data in a table table <- table(test2$Filename, test2$PREDICT) I need to convert this table so it keeps the same structure, but is a different format. The current output is count data by Filename and I want to get the max for each Filename. Columns are: Filename, 1, 2, 3, 4, 5, 6, 7 Whe