See minor comment below
-Don
At 8:07 PM +0000 8/26/09, Oliver Bandel wrote:
<- first part of email omitted ->
<
For many entries, it would be faster, if you just allocate
the array that should be written, by just writing 0 into it,
or empty strings or something like this...
mydat[1:100] <- 0
Simpler is
mydat <- numeric(100)
> mydat
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0
[38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0
[75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
mydat <- 1
mydat[2] <- 33
mydat[3] <- -4
mydat
[1] 1 33 -4
instead of "mydat[1:100] <- 0"
use the length of the itemlist as second parameter.
Ciao,
Oliver
______________________________________________
R-help@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.
--
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062
______________________________________________
R-help@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.