[R] Correct behavior of Hmisc::capitalize()?

Uwe Ligges ligges at statistik.tu-dortmund.de
Fri Jul 15 13:01:24 CEST 2011



On 14.07.2011 23:32, Henrik Bengtsson wrote:
> Hi,
>
> from example(capitalize) of the Hmisc package (v 0.8.3) you get:
>
>> capitalize(c("Hello", "bob", "daN"))
> [1] "Hello" "Bob"   "daN"
>
> Is that "daN" correct?
>
> If so, then this behavior that only *all lowercase strings*, which the
> code indicates,  will be capitalized is not documented.
>
>> Hmisc::capitalize
> function (string)
> {
>      capped<- grep("^[^A-Z]*$", string, perl = TRUE)
>      substr(string[capped], 1, 1)<- toupper(substr(string[capped],
>          1, 1))
>      return(string)
> }
> <environment: namespace:Hmisc>
>
> There are also some misspelled words in help("capitalize").
>
>
>> sessionInfo()
> R version 2.13.1 Patched (2011-07-09 r56344)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] splines   stats     graphics  grDevices utils     datasets  methods
> [8] base
>
> other attached packages:
> [1] Hmisc_3.8-3     survival_2.36-9
>
> loaded via a namespace (and not attached):
> [1] cluster_1.14.0  grid_2.13.1     lattice_0.19-30 tools_2.13.1
>
>
> /Henrik
> (Hmisc maintainer cc:ed)

I don't see you CCed. The Hmisc maintainer is the only one who can 
answer your message appropriately.

Best,
Uwe




>
> ______________________________________________
> 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