[R] Stack overflow in R 2.10.0 with sub()

Duncan Murdoch murdoch at stats.uwo.ca
Tue Oct 27 15:59:44 CET 2009


On 10/27/2009 10:46 AM, Kenneth Roy Cabrera Torres wrote:
> Dr. Murdoch:
> 
> I am puzzled!
> As you adviced me I do this:
> 
> x <- as.character(alumnos$AL_NUME_ID)
> x <- x[-seq_len(length(x)/2)]


Please try the following.  After doing the lines above, do

save(x, file="x.RData")

and exit from R.  Then restart R, and run

load("x.RData")
y <- gsub("(^ +)|( +$)","",x)

If it still fails, that's a sign that there's a problem in that vector 
of values; if not, it's likely some sort of memory problem that will be 
harder to track down.  In the former case you could email me the file 
and if it also fails here I can probably track it down.  If it's a 
memory problem, I can try, but I'm less optimistic that I'll find it.

Duncan Murdoch


> 
> And it fails,
> 
> But, trying to locate the problem I do:
> 
> x <- as.character(alumnos$AL_NUME_ID)
> x <- x[-seq_len(length(x)/2)]
> x <- x[seq_len(length(x)/2)]
> y <- gsub("(^ +)|( +$)","",x)
> 
> works
> 
> x <- as.character(alumnos$AL_NUME_ID)
> x <- x[-seq_len(length(x)/2)]
> x <- x[-seq_len(length(x)/2)]
> y <- gsub("(^ +)|( +$)","",x)
> 
> works
> 
> Now, both works!!!
> 
> So, I am puzzle!!! I cannot locate the problem.
> Thank you for your advice.



> 
> Kenneth
> 
> 
> 
>




More information about the R-help mailing list