[R] assigment

Robert Ruser robert.ruser at gmail.com
Fri Nov 19 15:46:51 CET 2010


Joshua, Dennis ans Henrique I'm immensely indebted to you.  Thanks to
you I resolved my problem - a code works perfectly. I put the code,
maybe someone finds it's helpful.

f1 <- readLines(file("file1.txt"))
f2 <- readLines(file("file2.txt"))

for ( i in seq_along(f1)){
assign(f1[i],as.numeric(unlist(strsplit(f2[i],",")) ))
}

file 1 (names of the variables; just copy and paste to see how it works)
A
A2
A3
A4
A7
B
B4
B5
B7
C
C1
C3
C4
C6
F
D

file 2 (values of the variables; just copy and paste to see how it
works as well)
1
3, 6, 7
4, 13, 9
5, 2
8,10, 11,12,15
17
21, 29, 18, 32, 145
22, 34, 19, 27, 20
24, 23, 33, 28, 25, 26
35
36, 40
38, 37
39
41
92
42


Robert



More information about the R-help mailing list