I have a csv file which I read using the following function:
csvData <- read.csv(file=\"pf.csv\", colClasses=c(NA, NA,\"NULL\",NA,\"NULL\",NA,\"NULL\",\"
It is possible using sqldf package, using read.csv.sql
Lets say the contents of sample.csv looks like this:
id,name,age
1,"a",23
2,"b",24
3,"c",23
Now to read only rows where age=23:
require(sqldf)
df <- read.csv.sql("sample.csv", "select * from file where age=23")
df
id name age
1 1 "a" 23
2 3 "c" 23
It is possible to select necessary columns:
df <- read.csv.sql("sample.csv", "select id, name from file where age=23")
df
id name
1 1 "a"
2 3 "c"