[R] create distinct variable names
Rui Barradas
ru|pb@rr@d@@ @end|ng |rom @@po@pt
Sat May 14 20:10:09 CEST 2022
Hello,
Replace the for loop by a lapply loop and assign the names after, with
sprintf("Corr%d", 1:10)
Is out a data.frame? Can you post dput(head(out))?
Hope this helps,
Rui Barradas
Às 18:33 de 14/05/2022, Sorkin, John escreveu:
> I am trying to create distinct variable names of the form Corr1, Corr2, etc. so that I can run cbind(nurkle,Corrk)
> When I run the code below, I receive the following error message
> Error in paste(Corr,k) <- out[[k]]$acf: could not find the function paste<-
> How can I create a variable name with a sequential number than can be used as the receiving end of my assignment statement?
>
>
> nurkle <- out[[1]]$acf
> for (k in 2:10){
> paste(Corr,k) <- out[[k]]$acf
> nurkle<- cbind(nurkle,Corrk)
> }
>
> Thank you,
> John
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
More information about the R-help
mailing list