[R] loop
Giovanni Petris
GPetris at uark.edu
Wed Mar 5 16:44:18 CET 2008
> Date: Wed, 05 Mar 2008 15:59:59 +0100 (CET)
> From: Neuer Arkadasch <neuer_arkadasch at yahoo.de>
> Sender: r-help-bounces at r-project.org
> Precedence: list
>
> 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
>
It does not seem to be false: I am getting the same result. You should
probably explain what you expected and what you are trying to achieve.
Giovanni
> 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.
>
>
--
Giovanni Petris <GPetris at uark.edu>
Associate Professor
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
http://definetti.uark.edu/~gpetris/
More information about the R-help
mailing list