The $
allows you extract elements by name from a named list. For example
x <- list(a=1, b=2, c=3)
x$b
# [1] 2
You can find the names of a list using names()
names(x)
# [1] "a" "b" "c"
This is a basic extraction operator. You can view the corresponding help page by typing ?Extract
in R.
Related Contents:
- Object not found error with ddply inside a function
- Error: could not find function … in R
- How can I view the source code for a function?
- How to use R’s ellipsis feature when writing your own function?
- How do you use “
- data.table objects assigned with := from within function not printed
- Update data frame via function doesn’t work
- Returning multiple objects in an R function [duplicate]
- dplyr: “Error in n(): function should not be called directly”
- converting multiple columns from character to numeric format in r
- “Correct” way to specifiy optional arguments in R functions
- Examples of the perils of globals in R and Stata
- What ways are there to edit a function in R?
- How to create an R function programmatically?
- Reading multiple files and calculating mean based on user input
- R: x ‘probs’ outside [0,1]
- Apply a function to every row of a matrix or a data frame
- Function to calculate R2 (R-squared) in R
- What are the double colons (::) in R?
- R function with no return value
- Finding out which functions are called within a given function [duplicate]
- R function not returning values
- Is it a good practice to call functions in a package via ::
- How do I override a non-visible function in the package namespace?
- How to compare functions?
- R : Pass argument to glm inside an R function
- How to use data.table within functions and loops?
- Call by reference in R (using function to modify an object)
- Getting a function name as a string
- Filter rows which contain a certain string
- Fastest way to replace NAs in a large data.table
- dplyr: nonstandard column names (white space, punctuation, starts with numbers)
- Assign multiple objects to .GlobalEnv from within a function
- How to sum a numeric list elements
- how to add layers in ggplot using a for-loop
- Formatting dates with scale_x_date in ggplot2
- Split a column into multiple binary dummy columns [duplicate]
- Pass a vector of variable names to arrange() in dplyr
- How to display all x labels in R barplot?
- creating “radar chart” (a.k.a. star plot; spider plot) using ggplot2 in R
- ggplot2: How to specify multiple fill colors for points that are connected by lines of different colors
- Stacked barchart, independent fill order for each stack
- avoid string printed to console getting truncated (in RStudio)
- Subsetting data.table by 2nd column only of a 2 column key, using binary search not vector scan
- Re-ordering bars in R’s barplot()
- Improve centering county names ggplot & maps
- Concatenate / paste a column by a group and add to original data
- Rcpp function check if missing value
- Wrong order of y axis in ggplot barplot
- Recommended package for very large dataset processing and machine learning in R [closed]