Re: [R] using a variable in a subset of a dataframe

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Tue, 01 Apr 2008 15:33:01 -0300

You can try this:

x <- data.frame()
for(i in LETTERS[1:5]) x[1:10, i] <- rnorm(10) x

On 01/04/2008, Georg Ehret <georgehret_at_gmail.com> wrote:
> Dear R community, I am using a dataset and would like to define new
> variables using a R variable:
>
> e.g.
>
> for (i in 1:10){
> dataset$i<-something
> }
>
> But this is not the right way, I get only one variable in "dataset"...
> How can I change this?
>
> Thank you!
> Georg.
> ************************
> Georg Ehret
> Johns Hopkins
> Baltimore, MD
>
> [[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.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

______________________________________________
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 Tue 01 Apr 2008 - 18:35:31 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 Tue 01 Apr 2008 - 21:30:26 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