R麻烦子集数据集

时间:2018-08-30 03:34:29

标签: r subset

我有一些代码

file = "http://dd.weather.gc.ca/hydrometric/csv/SK/hourly/SK_hourly_hydrometric.csv"
skdat2 <- read.csv(file, head=T, sep=",", dec=".")
colnames(skdat2) <- c("ID", "Date", "Water.Level", "Grade.1", "Symbol.1", 
                      "QA/QC-1", "Discharge/Debit", "Grade.2", "Symbol.2", 
                      "QA/QC-2")

skdat22 <- subset(skdat2, skdat2$ID=='05AH050')

plot(skdat22$ID ~ skdat22$Date, skdat22, xaxt = "n")

我想做的是仅绘制ID为05AH050的数据 当我显示数据集skdat22时,它仅显示ID 05AH050数据

无论我计划它是什么,我也会得到所有其他ID?我误解了子集命令吗?

0 个答案:

没有答案