[R] Fill vector more efficient than element by element?

From: beatleb <rhelpforum_at_gmail.com>
Date: Tue, 15 Mar 2011 08:12:16 -0700 (PDT)

Dear R useRs,

I am a newbie. Currently, my script is quick long, therefor I am trying to improve the efficiency of my script.
I use often a version of the following code, the script below is just a simple example, but I especially try to improve the last three lines:


for (i in 1:10){

Is it possible to obtain the same result, but more efficient?

Thank you!

View this message in context: http://r.789695.n4.nabble.com/Fill-vector-more-efficient-than-element-by-element-tp3356871p3356871.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
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 15 Mar 2011 - 15:58:53 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 15 Mar 2011 - 16:10:22 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