Off topic:Variable definition in R
2
0
Entering edit mode
5.2 years ago

Hi everyone.

I have the following line of code where R rejects the expression on the left to be treated as an assignee variable.

for (i in 1:length(my_list)){
paste(eval(parse(text='names(my_list[i])')),"table",sep="") <- read.table(paste("./foo/",paste(eval(parse(text='names(my_list[i])')),".csv",sep=""),sep=""))
}

Any comments you would like to make here.

Thanks. SJ.

Edit:

Just to add, the exception reported is:

Error in paste(eval(parse(text = "names(my_list[i])")), "table", sep = "") <- read.table(paste("./foo/",  : 
  target of assignment expands to non-language object
R • 788 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2567 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6