[R] weird "vector size cannot be NA/NaN" problem

William Dunlap wdunlap at tibco.com
Mon Sep 21 19:31:45 CEST 2009


> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Peter Ehlers
> Sent: Monday, September 21, 2009 9:29 AM
> To: Werner Wernersen
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] weird "vector size cannot be NA/NaN" problem
> 
> Werner,
> 
> Thanks for sending the data.
> 
> The problem does seem to lie with describe() in pkg:Hmisc.
> Frank may want to know that it can be triggered by
> 
>   f <- function(n)describe(c(1:n,1/0))
>   f(18) #ok
>   f(19) #triggers the error
> 
> Perhaps it's related to the "at least 20 unique values" condition
> mentioned in ?describe.

The call to range() in describe.vector needs the finite=TRUE
argument, so it returns the range of only the finite elements
of the input.

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com  

> 
> Peter Ehlers
> 
> Werner Wernersen wrote:
> > Hi,
> > 
> > I have to follow up my own question since this problem is 
> getting quite disturbing and I fear that it also causes other 
> functions to malfunction without notice. 
> > 
> > It occurs quite quite often when I manipulate the mentioned 
> data set. It definitely is caused by the column entries which 
> are Inf (caused by a value/0 operation) but I cannot 
> reproduce the error. When I do a describe(c(5,3,76,4/0)), for 
> example, the last value is Inf but the error is not thrown.
> > 
> > But I can save the vector and load it and the error still 
> occurs. Would someone be willing to look at that vector and 
> maybe finds out the root of the problem? (I'll send the 
> vector by email)
> > 
> > As I said in the earlier email, the data is imported with 
> read.dta of the foreign library and the only manipulation I 
> do is dividing the values of two columns by each other.
> > 
> > Thanks a million,
> >   Werner
> > 
> > 
> >> I have a weird problem with my data but I cannot really
> >> locate it and cannot make a small example data set do
> >> reproduce the problem.
> >> I basically divide one numerical column of a data frame
> >> with another. When I run describe() on that column, I get
> >> "Error in vector("integer", length) : vector size cannot be
> >> NA/NaN"
> >>
> >> The two original columns comprise many zero values and I
> >> think the particular row which causes the problem ends up
> >> with an "Inf". 
> >>
> >> I fear that other functions might also not be reliable for
> >> this data and that I have to repair it somehow. It actually
> >> happens with many of the variables from the various tables
> >> which originally are in Stata .dta format and which I import
> >> with the foreign library.
> >>
> >> I am working on windows XP and R 2.9.1
> >>
> >> I assume that this description is too vague but if anybody
> >> has an idea, I would appreciate it.
> >>
> >> Thanks so much,
> >>   Werner
> >>
> > 
> > 
> > 
> > 
> > 
> > ______________________________________________
> > 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.
> > 
> >
> 
> ______________________________________________
> 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.
> 




More information about the R-help mailing list