Use [[
instead of $
. x$y
is short hand for x[["y"]]
.
my_helper <- function (my_param) {
levels(diamond[[my_param]])
}
my_helper("cut")
More Related Contents:
- Convert a list to a data frame
- Read all worksheets in an Excel workbook into an R list with data.frames
- Construct a manual legend for a complicated plot
- All Levels of a Factor in a Model Matrix in R
- Use variable names in functions of dplyr
- Adding minor tick marks to the x axis in ggplot2 (with no labels)
- Get indexes of a vector of numbers in another vector
- Reverse order of discrete y axis in ggplot2
- R compare multiple values with vector and return vector [duplicate]
- How to generate all possible combinations of vectors without caring for order?
- Change value of variable with dplyr
- Roxygen2 – how to properly document S3 methods
- Dynamically creating tabs with plots in shiny without re-creating existing tabs
- R: ggplot2, can I set the plot title to wrap around and shrink the text to fit the plot?
- Creating a symmetric matrix in R
- Concatenate several columns to comma separated strings by group
- How to italicize part (one or two words) of an axis title
- Rounding time to nearest quarter hour
- Count number of zeros per row, and remove rows with more than n zeros
- “import as” in R
- Checking if Date is Between two Dates in R
- Add secondary X axis labels to ggplot with one X axis
- How to return 5 topmost values from vector in R?
- Combining `expression()` with `\n`
- Plot coordinates on map
- R error which says “Models were not all fitted to the same size of dataset”
- Formatting a date in R without leading zeros
- Adding ellipses to a principal component analysis (PCA) plot
- How do I loop through column names and make a ggplot scatteplot for each one
- Chronological timeline with points in time and format date