You forgot the assign the second time:

assign(paste("a",2,sep=""), 4)

does what you want.

Hope this helps a little

Allan.

On 27/02/10 05:13, Joseph Lee wrote:
I created variables automatically like this way

for(i in 1:5){
        nam<- paste("a",i,sep="")
        assign(nam,1:i)
}

and then, i want to insert a new data into "a2" variable. so, i did next
sentence

paste("a",2,sep="")<- 4

so, i got this error message

Error in get(paste("a", 2, sep = ""))[1]<- 4 :
   target of assignment expands to non-language object

anyone knows abou this error message and tell me how to solve thie problem,
please......


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to