To filter a dataframe from a specific value in a column in R, you can use the subset()
function or the dplyr
package's filter()
function.
Here are two examples.
Using subset()
:
main.r222 chars6 lines
Using dplyr
's filter()
function:
main.r241 chars8 lines
Both of these examples will return a dataframe that only includes rows where the age column has a value of 30.
gistlibby LogSnag