Skipping Specific Rows and Columns in R
I Skipped Second Row of the Data Using This Command: Df=(Read. Csv(“Imdb_Data. Csv”, Header=T, Sep=",")[-2,]) What Is the Explanation Behind This? Can It Be...
I skipped second row of the data using this command:
Df=(read.csv(“IMDB_data.csv”, header=T, sep=",")[-2,])
What is the explanation behind this? Can it be used for skipping more than 1 specific row? Can it used for skipping columns? Please help.
1 Answer
You can "skip" as many rows using negative values, i.e.
Df=(read.csv(“IMDB_data.csv”, header=T, sep=",")[-c(2,3,5:9),])
Similar for columns:
Df=(read.csv(“IMDB_data.csv”, header=T, sep=",")[, -c(2,4)])
To skip rows and columns
Df=(read.csv(“IMDB_data.csv”, header=T, sep=",")[-c(2,3,5:9), -c(2,4)])