Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Gives R coding style guidance on naming conventions, spacing, layout, and function design best practices.
75% 96%+21 ptsof test cases passed
Passed 23 of 24 test cases with the skill, and 18 of 24 without it.
I am writing an R data pipeline script. Here is a snippet where I calculate summary stats: ```R x = mean(df$score) total_count = length(df$score) ``` Should I keep the equals sign `=` for assigning values to variables in R, or change it?
States that `=` should be reserved for passing function arguments.
3 of 3 safety checks passed
Consistent naming, spacing, structure, and function design for R code
# Good function structure
rescale01 <- function(x) {
rng <- range(x, na.rm = TRUE, finite = TRUE)
(x - rng[1]) / (rng[2] - rng[1])
}
# Use type-stable outputs
map_dbl() # returns numeric vector
map_chr() # returns character vector
map_lgl() # returns logical vector
# Good naming: snake_case for variables/functions
calculate_mean_score <- function(data, score_col) {
# Function body
}
# Prefix non-standard arguments with .
my_function <- function(.data, ...) {
# Reduces argument conflicts
}
Next to this one in the catalogue, plus more from the same author.