[R] problems with for: warnings and segfault
Ronaldo Reis-Jr.
chrysopa at gmail.com
Fri Nov 11 16:12:48 CET 2005
Hi,
I have two problem with a for looping using R Version 2.1.1 (2005-06-20) on a
Debian Linux Testing.
The first problem: warnings messages
Look:
> xcoord <- 5
> ycoord <- 5
> indice <- 1
> for(i in c(1:5)) {indice <- indice+1;xcoord[indice] <- xcoord+i;
ycoord[indice] <- ycoord }
Warning messages:
1: number of items to replace is not a multiple of replacement length
2: number of items to replace is not a multiple of replacement length
3: number of items to replace is not a multiple of replacement length
4: number of items to replace is not a multiple of replacement length
5: number of items to replace is not a multiple of replacement length
6: number of items to replace is not a multiple of replacement length
7: number of items to replace is not a multiple of replacement length
8: number of items to replace is not a multiple of replacement length
> xcoord
[1] 5 6 7 8 9 10
> ycoord
[1] 5 5 5 5 5 5
>
The results are OK, but I dont understand the warning message
The second problem: The segfault
> xcoord <- 5
> ycoord <- 5
> indice <- 1
> for(i in c(1:100)) {indice <- indice+1;xcoord[indice] <- xcoord+i;
ycoord[indice] <- ycoord }
Segmentation fault
This is a R bug or an error in my for function?
Thanks
Ronaldo
--
Ninguém é tão mais inteligente que o outro para que o cérebro conte mais que a
perseverança
--Alan Green
--
|> // | \\ [***********************************]
| ( õ õ ) [Ronaldo Reis Júnior ]
|> V [UFV/DBA-Entomologia ]
| / \ [36570-000 Viçosa - MG ]
|> /(.''`.)\ [Fone: 31-3899-4007 ]
| /(: :' :)\ [chrysopa at insecta.ufv.br ]
|>/ (`. `'` ) \[ICQ#: 5692561 | LinuxUser#: 205366 ]
| ( `- ) [***********************************]
|>> _/ \_Powered by GNU/Debian Woody/Sarge
More information about the R-help
mailing list