On 2011-07-25 10:51, "Dénes TÓTH" wrote:
Hi,
you provided a character vector as an example. I guess you meant something
like:
x<- factor(c("1","2","3","4","<1"))
# You can identify those elements with an "<" by ?grep or ?grepl:
indices<- grep("<",as.character(x))
# You can transform those ele
Hi,
you provided a character vector as an example. I guess you meant something
like:
x <- factor(c("1","2","3","4","<1"))
# You can identify those elements with an "<" by ?grep or ?grepl:
indices <- grep("<",as.character(x))
# You can transform those elements by ?as.numeric
as.numeric(x[indices
b<-c("1","2","3","4","<1")
grep('<',b)
HTH,
Daniel
Ryan Utz-2 wrote:
>
> Hi all,
>
> I'm trying to identify a particular digit or value within a vector of
> factors. Specifically, this is environmental data where in some cases the
> minimum value reported is "<" a particular number (and I wan
Hi Ryan,
The key to this is the grep() command.
It's easiest if you import your data as character rather than factor,
since these aren't properly factors. You don't say how that's done,
but if you are using read.table() then as.is=TRUE will prevent
conversion to factor.
For a character vector, h
4 matches
Mail list logo