Hi: It's not hard to roll your own here. For first character capitalization,
mycap <- function(str) { x <- substring(toupper(str), 1, 1) y <- substring(tolower(str), 2, nchar(str)) paste(x, y, sep = '') } It's not especially fast but it works if the objective is to capitalize only the first letter of a word. # Applying this to the best actor in one of my favorite films, Little Big Man # (first one I thought of with three names :) u <- c('cHieF', 'DaN', 'GeORgE') mycap(u) [1] "Chief" "Dan" "George" and on your counties, with(correlfile, mycap(county)) [1] "Autauga" "Baldwin" "Barbour" CapLeading on my actor name vector: library(cwhmisc) CapLeading(u) [1] "CHieF" "DaN" "GeORgE" If you look carefully, the function capitalizes the first letter but leaves the others as is. I suspect that's not what you expected. HTH, Dennis On Tue, Sep 21, 2010 at 7:11 PM, Adrienne Wootten <amwoo...@ncsu.edu> wrote: > R-listers, > > I'm working on a project where I need to get the lowercase of the county > variable in a dataset alike to the example below (only difference is that > the full dataset has all the states and counties in the southeast United > States). I keep getting this strange error with the lowerize function > (which didn't occur the first few times I use the code below), and oddly > enough the error doesn't happen with the function CapLeading (which is in > the same package). > > > correlfile[1:3,] > state statecounty county > 1 AL AL_AUTAUGA AUTAUGA > 2 AL AL_BALDWIN BALDWIN > 3 AL AL_BARBOUR BARBOUR > > library(cwhmisc) > > > > correlfile$county[correlfile$state=="AL"]=lowerize(correlfile$county[correlfile$state=="AL"]) > > Error in get(as.character(FUN), mode = "function", envir = envir) : > object 'f' of mode 'function' was not found > > > > > correlfile$county[correlfile$state=="AL"]=CapLeading(correlfile$county[correlfile$state=="AL"]) > > System specs involved > R version 2.9.2 > cwhmisc package version 2.1 > OS - Redhat Enterprise Linux version 5.5 > > Another strange thing that seems to happen is that when I open R in a > different working directory of the server, the lowerize function works > without giving this error, for a short while. Before long, it begins > giving > the aforementioned error message again. > > I haven't found anything in the archives on this so I turn to the > R-listers. > > Any ideas on why this keeps happening would be very helpful! > Thanks! > > > Adrienne Wootten > Graduate Research Assistant > State Climate Office of North Carolina > North Carolina State University > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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.