Try ?ceiling > ceiling(0.4) [1] 1
B. On 2014-03-20, at 3:42 PM, Kristi Glover wrote: > 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]] > > ______________________________________________ > 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.