The subset
function has a nice select
argument that gives a convenient way to select ranges of columns by name:
df <- subset(df, select=c(g,a:f))
More Related Contents:
- Issue when passing variable with dollar sign notation ($) to aes() in combination with facet_grid() or facet_wrap()
- Round up from .5
- What does “The following object is masked from ‘package:xxx'” mean?
- Replace NA in column with value in adjacent column
- Remove columns with zero values from a dataframe
- How to display the frequency at the top of each factor in a barplot in R [duplicate]
- efficiently generate a random sample of times and dates between two dates
- Export data from R to Excel
- Create new dummy variable columns from categorical variable
- How to draw lines outside of plot area in ggplot2?
- drop-down checkbox input in shiny
- creating “radar chart” (a.k.a. star plot; spider plot) using ggplot2 in R
- duplicate ‘row.names’ are not allowed error
- Subfigures or Subcaptions with knitr?
- Return a data frame from function
- How to use the switch statement in R functions?
- Choropleth map in ggplot with polygons that have holes
- Create column with grouped values based on another column
- R group by date, and summarize the values
- Split a column into multiple binary dummy columns [duplicate]
- What are the differences between R’s new native pipe `|>` and the magrittr pipe `%>%`?
- Sorting rows alphabetically
- starting a daily time series in R
- Apply a function to a subset of data.table columns, by column-indices instead of name
- Creating (and Accessing) a Sparse Matrix with NA default entries
- Deleting specific rows from a data frame
- Sum of two Columns of Data Frame with NA Values
- R: what’s the proper way to overwrite a function from a package?
- How to remove rows of a matrix by row name, rather than numerical index?
- Create parametric R markdown documentation?