[R] somebody help me about this error message...

Allan Engelhardt allane at cybaea.com
Sat Feb 27 09:16:02 CET 2010


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......
>



More information about the R-help mailing list