Dear all, I would like to clip the data of a dataframe by forcing the value of the elements below a cut-off to 0. I believe that the function to be used is sapply but I could not have the call working properly. Would you have any tip? Best regards Luigi
>>> value <- c(5.43, 6.63, 0, 6.2, 5.61, 0, 5.59, 0, 0, 5.49, 18.35, 0, 6.07, 4.54, 4.73, 0, 5.74, 33.02, 4.45, 31.16, 0, 0, 3.12, 0, 0, 4.78, 0, 0, 0, 0, 0, 32.42, 3.35, 3.87, 0, 3.26, 5.75, 1.66, 0, 0, 0, 8.49, 3.08, 0, 0, 3.74, 0, 0, 4.06, 3.8, 0, 0 ) sample <- c("p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.001", "p.002", "p.002", "p.002", "p.002" ) df <- as.data.frame(cbind(sample, value)) # cut off co <- 8.5 ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.