Message-ID: <4DB1E73A.9070400@statistik.tu-dortmund.de>
Date: 2011-04-22T20:38:18Z
From: Uwe Ligges
Subject: convert string to variable
In-Reply-To: <BANLkTimcmVD7K+NPz12KpH_isiGSCvr-dQ@mail.gmail.com>
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.