# How do I round only one row of a dataframe? # After transposing a dataframe of counts & rates, all values took on the most # of signif digits in the dataset (rates), but I want counts to remain only one digit. # Also, how can I keep 3 significant digits in R when the 3rd is a zero? count <- c(1, 2, 3) rate <- c(16.7, 33.3, 50.0) a <- data.frame(count,rate) a # count rate # 1 1 16.7 # 2 2 33.3 # 3 3 50.0 a <- t(a) a # [,1] [,2] [,3] # count 1.0 2.0 3 # rate 16.7 33.3 50
-- View this message in context: http://r.789695.n4.nabble.com/How-to-round-only-one-df-row-how-to-keep-3rd-sigdif-if-zero-tp4708819.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.