[R] Combine data frames using column names as "key"

2008-09-22 Thread jimineep
Hi guys, Suppose I have 2 data frames ie: values one0.32 two0.25 three 0.11 and values two0.66 one0.74 three 0.19 nb the first column is the row names in both cases How can I combine them on the row names column? Ie to make something like values.

[R] produce variable on the fly

2008-08-12 Thread jimineep
Hi guys, I want to create variable on the fly: for example for (i in 1:10) { cat(paste("VAR",i,sep="")) } Will print VAR1, VAR2 etc up to VAR10. However I want to make these into variables, and then give them a value, for example: vect = c(10:20) for (i in 1:10) { cat(paste("VAR",i,sep

[R] re order vector in order given by another vector

2008-08-07 Thread jimineep
So imagine I have a vector: zz = c("a","c","d","b") and another vector: xx = c("d","c","a","b") I need to get xx in the same order as zz. I am sure this is very simple but I can't figure it out from the help pages for order or sort. Perhaps I'm not trying hard enough but its been bugging me fo

[R] Re ad in a file - produce independent vectors

2008-07-04 Thread jimineep
Is there a way of reading in a file in a way that each line becomes a vector: for example: meals.txt breakfastbaconeggssausage lunchsandwichapplemarsbarcrisps dinnerchickenricecustardpie I want to read in this file and end up with 3 different vectors,