[Rd] nchar( NA )
Hello, Is this expected ? nchar( c( , NA ) ) [1] 0 2 Should not the second one be NA ? Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://bit.ly/98Uf7u : Rcpp 0.8.1 |- http://bit.ly/c6YnCi : graph gallery collage `- http://bit.ly/bZ7ltC : inline 0.3.5 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] nchar( NA )
Hi Romain, Did you read the help for nchar? Value: For ‘nchar’, an integer vector giving the sizes of each element, currently always ‘2’ for missing values (for ‘NA’). It may be unexpected behavior, but it's *well-documented* unexpected behavior. Sarah On Fri, Jun 18, 2010 at 4:52 PM, Romain Francois rom...@r-enthusiasts.com wrote: Hello, Is this expected ? nchar( c( , NA ) ) [1] 0 2 Should not the second one be NA ? Romain -- Sarah Goslee http://www.functionaldiversity.org __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] nchar( NA )
The help page says: For nchar, an integer vector giving the sizes of each element, currently always 2 for missing values (for NA). On Fri, Jun 18, 2010 at 5:52 PM, Romain Francois rom...@r-enthusiasts.comwrote: Hello, Is this expected ? nchar( c( , NA ) ) [1] 0 2 Should not the second one be NA ? Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://bit.ly/98Uf7u : Rcpp 0.8.1 |- http://bit.ly/c6YnCi : graph gallery collage `- http://bit.ly/bZ7ltC : inline 0.3.5 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] nchar( NA )
Le 18/06/10 22:58, Sarah Goslee a écrit : Hi Romain, Did you read the help for nchar? Value: For ‘nchar’, an integer vector giving the sizes of each element, currently always ‘2’ for missing values (for ‘NA’). It may be unexpected behavior, but it's *well-documented* unexpected behavior. Oops. My scan of the help page was too quick. I did not see it. Sorry for the noise. Sarah On Fri, Jun 18, 2010 at 4:52 PM, Romain Francois rom...@r-enthusiasts.com wrote: Hello, Is this expected ? nchar( c( , NA ) ) [1] 0 2 Should not the second one be NA ? Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://bit.ly/98Uf7u : Rcpp 0.8.1 |- http://bit.ly/c6YnCi : graph gallery collage `- http://bit.ly/bZ7ltC : inline 0.3.5 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] nchar( NA )
Value: For ‘nchar’, an integer vector giving the sizes of each element, currently always ‘2’ for missing values (for ‘NA’). It may be unexpected behavior, but it's *well-documented* unexpected behavior. Oh, that must make it ok then. For a more sensible take: library(stringr) str_length(c(, NA)) [1] 0 NA Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel