Re: [R] convert string to variable

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Fri, 22 Apr 2011 22:38:18 +0200

Please read the R FAQs (Frequently Asked Questions) before posting here as the posting guide asks you to do.

Uwe Ligges

On 22.04.2011 22:27, André de Boer wrote:
> Hello,
>
> Is it possible to convert a string to a variable?
>
> I have a set of names:
>
>> stocks
> [1] "ACCELL" "AHOLD" "AJAX" "ARCADIS" "BALLAST"
> "BAM.GROEP"
> [7] "BESI" "BETER.BED" "BINCKBANK.NV" "BOSKALIS"
> "CATE" "CROWN.V.GELDER"
>
> And a data frame with stockquotes.
>
> With a for-loop I want to create variables (ACCEL, AHOLD ....) with quotes
> from the data frame 'data':
>
> for (i in stocks){
> k=1; m=2
> m=10
> ??i<- data[,k:m]
> k=k+2; m=10+2
> }
>
> How can I do this?
>
> Thanks for the answer.
> André
>
> [[alternative HTML version deleted]]
>
>
>
>
> ______________________________________________
> R-help_at_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.



R-help_at_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. Received on Fri 22 Apr 2011 - 20:40:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 22 Apr 2011 - 22:10:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive