Skip to content
Back to formatted view

Raw Message

Message-ID: <47CEC724.5030205@biostat.wisc.edu>
Date: 2008-03-05T16:15:32Z
From: Erik Iverson
Subject: loop
In-Reply-To: <137324.81922.qm@web25815.mail.ukl.yahoo.com>

Why not simply?

m <- seq(-1, 1, by = 0.1)
dat <- data.frame(m, m^2)

- Erik Iverson

Neuer Arkadasch wrote:
> Hello all,
>    
>   I am trying to use 
>    
>   m <- seq(-1,1,0.1)
>   x1 <- vector()
>   x2 <- vector()
>   for(i in m){
>   x1[i] <- i
>   x2[i] <- i^2
>   }
>   dat <- data.frame(x1,x2)
>   But, I have  false result
>   >dat
>     x1 x2
>   1 1  1
>    
>   could some tell me how it is possible to do this?
>    
>   Thank you!
>    
>    
> 
>        
> ---------------------------------
> 
> 	[[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.