search for: bb_2000

Displaying 4 results from an estimated 4 matches for "bb_2000".

2017 Dec 05
3
Dynamic reference, right-hand side of function
...ap): for (year in 2000:2002){ varname <- paste0("aa_",year) assign(varname, as.vector(eval(as.name(varname)))) } The loop obviously solved the problem: is.vector(aa_2000) However, you have taught me that I should have solved it more elegant with a data list: bb_2000 <- as.matrix(read.csv(text="1,0,1,1,0,0,0,0,0,0,1,0,0", header=FALSE)) bb_2001 <- as.matrix(read.csv( text="0,0,0,1,0,1,1,0,0,0,0,1,0,0", header=FALSE)) bb_2002 <- as.matrix(read.csv( text="1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0", header=FALSE)) is.vector(bb_2000)...
2017 Dec 05
0
Dynamic reference, right-hand side of function
...t; varname <- paste0("aa_",year) > assign(varname, as.vector(eval(as.name(varname)))) > } > > The loop obviously solved the problem: > > is.vector(aa_2000) > > However, you have taught me that I should have solved it more elegant with > a data list: > > bb_2000 <- as.matrix(read.csv(text="1,0,1,1,0,0,0,0,0,0,1,0,0", > header=FALSE)) > bb_2001 <- as.matrix(read.csv( text="0,0,0,1,0,1,1,0,0,0,0,1,0,0", > header=FALSE)) > bb_2002 <- as.matrix(read.csv( text="1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0", > header=FALS...
2017 Dec 04
0
Dynamic reference, right-hand side of function
Loops are not evil, and no-one in this thread said they are. But I believe your failure to provide a reproducible example is creating confusion, since you may be using words that mean one thing to you and something else to the readers here. ################################ # A reproducible example includes a tiny set of sample data # Since we cannot reproducibly refer to filenames (your
2017 Dec 04
2
Dynamic reference, right-hand side of function
:-) I don't insist on anything, I'm just struggling to learn a new language and partly a new way of thinking, and I really appreciate the corrections. I hope I someday will be able to handle lists in R as easy as I handle loops in Stata... Thanks again! Love -----Ursprungligt meddelande----- Fr?n: peter dalgaard [mailto:pdalgd at gmail.com] Skickat: den 4 december 2017 23:09 Till: