I have recently made a silly screwup by applying is.finite() to a character vector:> is.finite(c("a", "b"))[1] FALSE FALSE This does work with factors of course (as they are integer underneath) I wonder if a fix could be put in so that it either reports an error when applied to a character vector - or, perhaps better, act as is.na() thank you Vladimir Dergachev PS test on R 2.5.0, 2.3.1
No, because it is carefully documented to do this, and people rely on it working as documented. (Did you do the homework the posting guide asked for?) What harm came out of learning that the values were not finite? On Wed, 23 May 2007, Vladimir Dergachev wrote:> > I have recently made a silly screwup by applying is.finite() to a > character vector: > >> is.finite(c("a", "b")) > [1] FALSE FALSE > > This does work with factors of course (as they are integer underneath) > > I wonder if a fix could be put in so that it either reports an error when > applied to a character vector - or, perhaps better, act as is.na()What way is that? It acts in the same way, as I understand the help pages.> > thank you > > Vladimir Dergachev > PS test on R 2.5.0, 2.3.1-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On Wednesday 23 May 2007 1:29 pm, Prof Brian Ripley wrote:> No, because it is carefully documented to do this, and people rely on it > working as documented. (Did you do the homework the posting guide asked > for?) What harm came out of learning that the values were not finite?I read the manpage if that is what you are talking about. The particular thing I was attempting to do is to convert all entries that are not values to NULL before storing the result in the database. From my point of view string value was perfectly finite and my code worked with a data.frame I had because it happened to have factors in it. Yes, I easily concede that since I know about it now I am not likely to make the same mistake again. Just was trying (politely) to be of help to other users. best Vladimir Dergachev> > On Wed, 23 May 2007, Vladimir Dergachev wrote: > > I have recently made a silly screwup by applying is.finite() to a > > > > character vector: > >> is.finite(c("a", "b")) > > > > [1] FALSE FALSE > > > > This does work with factors of course (as they are integer underneath) > > > > I wonder if a fix could be put in so that it either reports an error when > > applied to a character vector - or, perhaps better, act as is.na() > > What way is that? It acts in the same way, as I understand the help > pages. > > > thank you > > > > Vladimir Dergachev > > PS test on R 2.5.0, 2.3.1