I have a data set with column names X and Y; once I load the data to a dF; how do I get a data frame containing only values of dF with X = A (lets say A is one of the values of X).
Here are two methods for picking rows where column X == "A".
DF <- data.frame(X=c("A","B","A","B"),y=1:4)
DF
#> X y
#> 1 A 1
#> 2 B 2
#> 3 A 3
#> 4 B 4
#Method1
DF2 <- DF[DF$X=="A",]
DF2
#> X y
#> 1 A 1
#> 3 A 3
#method2
library(dplyr)
DF3 <- filter(DF,X=="A")
DF3
#> X y
#> 1 A 1
#> 2 A 3