I have a very large dataframe (around 100 rows, 200 columns). A subset of my data looks like this:
example <- data.frame("Station" = c("012", "013", "014"), "Value1" = c(145.23453, 1.022342, 0.4432),
"Value2" = c(2.1221213, 4445.2231412, 0.3333421), "Name" = c("ABC", "SDS", "EFG"))
I would like to round all numeric variables in my table with these conditions.
if x<1, then 1 sig fig
if 1<= x < 99, then 2 sig figs
if x>= 100, then 3 sig figs
I know to do something like this for a specific column:
example$Value1 <- ifelse(example$Value1 < 1, signif(example$Value1, 1), example$Value1)
but I'm not sure what to do for a large dataframe with a mix of numeric and character values.