The minimum of a character vector is returned according to the unicode or ascii code values, but I guess that's not what Chris is looking for.
Chris, please always try to provide a minimal working example of code to see what is wrong. Something goes wrong with the input in your example. As Peter rightfully pointed out, your vector is considered a character vector. So you need to : 1) replace "" with NA e.g. x <- ifelse(x=='',NA,x) Better to do something like that when reading in the code. 2) use the argument na.rm : min (x, na.rm=T) kind regards Joris On Thu, Oct 1, 2009 at 8:36 AM, Peter Ehlers <ehl...@ucalgary.ca> wrote: > Chris, > > What is your definition of the minimum of a *character* vector? > > -Peter Ehlers > > Chris Li wrote: >> >> Hi all, >> >> I want to calculate the minimum of a column which contains blanks. >> >> R returns "" as the minimum, which is not I want. >> >> Is there a way to overcome it? >> >> Thanks in advance. >> Chris > > ______________________________________________ > 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. > ______________________________________________ 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.