What do you want to save?
Add Code snippet
New code examples
-
-
Other 2022-01-22 15:10:50
how to legend a multi graph with plot in r
plot_colors <- c("blue","black", "green", "orange", "pink") text <- c("Fabricated Metal", "Iron and Steel", "Paper", "Beverages", "Tobacco") ... Add solution -
-
Other 2021-10-11 13:58:12
apply function to all vector elements r
# lapply returns a list of the same length as X, each element of which # is the result of applying FUN to the corresponding element of X. lapply(X, FUN, ...) sapply(X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE) vapply(X, FUN, FUN.VALUE, ..., USE.NAM... Add solution -
R 2021-09-02 23:19:03
how to round all numeric column types in r
round_df <- function(x, digits) { # round all numeric variables # x: data frame # digits: number of digits to round numeric_columns <- sapply(x, mode) == 'numeric' x[numeric_columns] <- round(x[numeric_columns], digits) ... Add solution -
C++ 2021-08-28 00:58:01
round all columns in R dataframe to 3 digits
round_df <- function(x, digits) { # round all numeric variables # x: data frame # digits: number of digits to round numeric_columns <- sapply(x, mode) == 'numeric' x[numeric_columns] <- round(x[numeric_columns], digits) ... Add solution