[R] Working with < and > is data sets

Sam Albers tonightsthenight at gmail.com
Mon Jan 26 19:41:20 CET 2015


Hello,

I am having some trouble figuring out how to deal with data that has some
observations that are detection limits and others that are integers denoted
by greater and less than symbols. Ideally I would like a column that has
the data as numbers then another column with values "Measured" or "Limit"
or something like that. Data and further clarification below.

##Data
zp<-structure(list(variable = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L),
                                        .Label = c("ZP.1", "ZP.3", "ZP.5",
"ZP.7", "ZP.9"), class = "factor"),
                   value = structure(c(3L, 4L, 2L, 1L, 7L, 8L, 6L, 5L, 12L,
11L, 10L, 9L, 15L, 16L, 14L, 13L, 19L, 18L, 17L, 9L),
                                     .Label = c("<0.030", "<1.2", "1160",
"27.3", "<0.025", "<0.85", "1870", "45.7", "<0.0020",
                                                "<0.050", "31.9", "695",
"<0.0060", "<0.20", "311", "8.84", "<0.090", "12", "646"), class =
"factor")),
              .Names = c("variable", "value"), row.names = c(NA, -20L),
class = "data.frame")

## As expected converting everything to numeric results is a slew of NA
values
zp$valuefactor<-as.numeric(as.character(zp$value))

## At this point I am unsure how to proceed.

zp

###

So I am just wondering how folks deal with this type of data. Any advice
would be much appreciated as I am looking for something that will reliably
works on a large data set.

Thanks in advance!

Sam

	[[alternative HTML version deleted]]



More information about the R-help mailing list