Interesting undefined columns selected from read.table and read.csv

Enter the following syntax:
read.table(site_file,header=T)-> data
data< -data[which(data[,5]==”ADD”),]
A:
Error in `[.data.frame`(data, , 5) : undefined columns selected
Calls: plot_manhatton -> [ -> [.data.frame -> which -> [ -> [.data.frame
After a few attempts, change the command to:
read.csv(site_file,header=T)-> data
data< -data[which(data[,5]==”ADD”),]
It’s ready to run.
The reason for undefined Columns selected error is that What I imported was a CSV file, but I used read.table when Reading the file. After changing to read.csv, there is no problem.

Reproduced in: https://www.cnblogs.com/chenwenyan/p/5384714.html

Read More: