To select rows according to one ‘cell_type’ (e.g. ‘hesc’), use ==
:
expr[expr$cell_type == "hesc", ]
To select rows according to two or more different ‘cell_type’, (e.g. either ‘hesc’ or ‘bj fibroblast’), use %in%
:
expr[expr$cell_type %in% c("hesc", "bj fibroblast"), ]
Related Posts:
- Replace a value in a data frame based on a conditional (`if`) statement
- How to read in .HTM into R as a data frame?
- Count number of occurences for each unique value
- How to change line width in ggplot?
- Error in library(ggplot2) : There is no package called ‘ggplot2’
- Transpose a data frame
- How to drop columns by name in a data frame
- How to reshape data from long to wide format
- Multiple If Statements in R
- ggplot2, change title size
- Combine two or more columns in a dataframe into a new column with a new name
- Insert picture/table in R Markdown
- Test if a vector contains a given element
- R “Error: unexpected ‘}’ in “}”
- Insert a blank column in dataframe
- “length of ‘dimnames’ [2] not equal to array extent” on one of two very similar sets
- Mean per group in a data.frame
- How to install RHadoop packages (Rmr, Rhdfs, Rhbase)?
- Error in dev.off() : cannot shut down device 1 (the null device)
- How to create an empty matrix in R?
- standard deviation on dataframe does not work
- Warning message: In `…` : invalid factor level, NA generated
- What is the difference between = and ==?
- Subscripts in plots in R
- promise already under evaluation: recursive default argument reference or earlier problems?
- What does the error “arguments imply differing number of rows: x, y” mean?
- Aggregate multiple columns at once
- Error in model.frame.default: variable lengths differ
- Non-numeric argument to mathematical function
- Position-dodge warning with ggplot boxplot?
- Plot two graphs in same plot in R
- data.table vs dplyr: can one do something well the other can’t or does poorly?
- R – Concatenate two dataframes?
- KNN in R: ‘train and class have different lengths’?
- Error in rep(1, n.ahead) : invalid ‘times’ argument in R
- Producing subscripts in R markdown
- ggplot geom_text font size control
- lme4::lmer reports “fixed-effect model matrix is rank deficient”, do I need a fix and how to?
- R multiple conditions in if statement
- Remove quotes from a character vector in R
- Convert data.frame columns from factors to characters
- Re-ordering factor levels in data frame
- Is it possible to have a multi-line comments in R?
- R – error “variable lengths differ”
- Simple manual RMarkdown tables that look good in HTML, PDF and DOCX
- how to increase the limit for max.print in R
- how to increase the limit for max.print in R
- backward elimination in R
- Error in eval(expr, envir, enclos) : object not found
- Replace NA with 0 in a data frame column [duplicate]
- How to plot 3D scatter diagram using ggplot?
- How do I convert a factor into date format?
- Plot multiple boxplot in one graph
- R will plot but won’t draw abline
- scale_fill_discrete and scale_fill_manual – legend options confusion
- R – argument is of length zero in if statement
- How to solve ‘protection stack overflow’ issue in R Studio
- Merging data – Error in fix.by(by.x, x)
- Error in generating boxplot two variable data frame: adding class “factor” to an invalid object
- Error : Unable to start png() device
- Remove NA values from a vector
- “no function to return from, jumping to top level”
- r random forest error – type of predictors in new data do not match
- env=baseenv() in R
- How to set axis range R
- Simple for loop in R producing “replacement has length zero” in R
- Removing punctuations from text using R
- How to find out which package version is loaded in R?
- How to melt and cast dataframes using dplyr?
- What does Continuous x aesthetic — did you forget aes(group=…) mean?
- How to unload a package without restarting R
- What does the error “object not interpretable as a factor” mean?
- How to declare a vector of zeros in R
- R Sweave: NO TeX installation detected
- Plotting legend outside plot in R
- Boolean operators && and ||
- Reset par to the default values at startup
- R avoiding “restarting interrupted promise evaluation” warning
- How to increase the font size of ggtitle in ggplot2
- do-while loop in R
- ERROR: [on_request_read] connection reset by peer in R shiny
- Error in as.vector(x, mode) : cannot coerce type ‘closure’ to vector of type ‘any’
- Suppress output of a function
- Error in G * t(hat) : non-conformable arrays
- Error: isTRUE(gpclibPermitStatus()) is not TRUE
- How to counter the ‘non-numeric matrix extent’ error in R?
- What does is.na() applied to non-(list or vector) of type ‘NULL’ mean?
- error r: invalid subscript type “closure” in a simple regression
- Merge two rows in data.frame
- Colour points in a plot differently depending on a vector of values
- increase legend font size ggplot2
- Mask output of `The following objects are masked from….:` after calling attach() function
- How To Create Vector of Vector In R
- Round down a numeric
- Construct a manual legend for a complicated plot
- Code to clear all plots in RStudio
- Installing R on Android
- Convert data.frame column to a vector?
- Error in summary.connection(connection) : invalid connection
- When trying to replace values, “missing values are not allowed in subscripted assignments of data frames”