Hi R User,
I was trying to convert a decimal value into integral (whole number). I used
round function but some of the cells have the value less than 0.5 and it
converted into 0. But I wanted these cell to have 1 instead of 0. Another way, I
could multiply by 10. But l did not want it because it affected my results
later.
I was wondering about how I can convert 0.2 to 1. For example
data<-structure(list(site1 = structure(1:4, .Label = c("s1",
"s2",
"s3", "s4"), class = "factor"), A = c(0, 2.3, 2.6,
1.3), B = c(0.5,
0.17, 2.9, 3)), .Names = c("site1", "A", "B"),
class = "data.frame", row.names = c(NA,
-4L))
output<-structure(list(site1 = structure(1:4, .Label = c("s1",
"s2",
"s3", "s4"), class = "factor"), A = c(0L, 3L, 3L,
2L), B = c(1L,
1L, 3L, 3L)), .Names = c("site1", "A", "B"), class
= "data.frame", row.names = c(NA,
-4L))
Thanks for your suggestions in advance.
cheers,
KG
[[alternative HTML version deleted]]