Displaying 4 results from an estimated 4 matches for "jimineep".
2008 Aug 12
5
produce variable on the fly
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="")) = vect[i]
}
THis doesnt work but I hope it demonstrates
2008 Jul 04
4
Re ad in a file - produce independent vectors
Is there a way of reading in a file in a way that each line becomes a vector:
for example:
meals.txt
breakfast bacon eggs sausage
lunch sandwich apple marsbar crisps
dinner chicken rice custard pie
I want to read in this file and end up with 3 different vectors, one called
breakfast which contains "bacon", "eggs", sausage" One called
2008 Aug 07
1
re order vector in order given by another vector
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 for a while....
2008 Sep 22
1
Combine data frames using column names as "key"
Hi guys,
Suppose I have 2 data frames ie:
values
one 0.32
two 0.25
three 0.11
and
values
two 0.66
one 0.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.1 values.2
one 0.32 0.74
two 0.25 0.66
three 0.11 0.19
I guess its