Monica Palaseanu-Lovejoy
2004-Mar-05 11:17 UTC
[R] selecting certain rows from a data.frame
Hi, First of all - thank you for the answers regarding shared library. If i am attempting to translate the library from Linux to Windows - i think i will need some heavy baby-sitting ;-))) It is way out of my league - for now. Meanwhile i have this new question: suppose i have a data.frame with x and y columns and 10 rows, 1 to 10. I also have a variable m (or an array if you like) with 5 numbers that represent some of the row order numbers in my data.frame. Let's make m(1, 4, 5, 8, 10). How can i select from my data.frame the rows number 1, 4, 5, 8, and 10? Thank you in advance for any help, Monica
On 3/5/04 6:17 AM, "Monica Palaseanu-Lovejoy" <monica.palaseanu-lovejoy at stud.man.ac.uk> wrote:> Meanwhile i have this new question: suppose i have a data.frame > with x and y columns and 10 rows, 1 to 10. I also have a variable m > (or an array if you like) with 5 numbers that represent some of the > row order numbers in my data.frame. Let's make m(1, 4, 5, 8, 10). > How can i select from my data.frame the rows number 1, 4, 5, 8, > and 10?If df is the name of your dataframe: df[c(1,4,5,8,10),] Will select only those rows. I would highly recommend looking at the R manual, An Introduction to R. It can be obtained from the CRAN homepage (http://cran.us.r-project.org/). There is a link on the left side called Manual. Sean