R-仅打印csv文件中的某些数据行

R-仅打印csv文件中的某些数据行,r,csv,plot,R,Csv,Plot,因此,我绘制了多个站点一天内的平均浓度图,但现在我只尝试从上午10点到11点获取数据。以下是我的原始图形代码: hourly_file<-"/Users/bob111higgins/Downloads/hourly_88502_2013.csv" hourly_table<-read.csv(hourly_file) hourly_nj <- which(hourly_table$State.Code=="34")#only nj sites hourly_nj_table

因此,我绘制了多个站点一天内的平均浓度图,但现在我只尝试从上午10点到11点获取数据。以下是我的原始图形代码:

hourly_file<-"/Users/bob111higgins/Downloads/hourly_88502_2013.csv"
hourly_table<-read.csv(hourly_file)


hourly_nj <- which(hourly_table$State.Code=="34")#only nj sites
hourly_nj_table<-hourly_table[hourly_nj,]#create a table

write.csv(hourly_nj_table,file="/Users/bob111higgins/Downloads/hourly_88502_2013_NJ.csv")#create new file so it's faster to load
#unique sites
sites<-(unique(hourly_nj_table[,c("State.Code","County.Code","Site.Num")]))#shows all sites since some counties have more than one

#mean diurnal plots for each site
for (k in 1:nrow(sites)) {
  temp_title <- paste("site",k, "county", sites[k,2],"site",sites[k,3])
  l<-which(hourly_nj_table$County.Code==sites[k,2]&hourly_nj_table$Site.Num==sites[k,3])#grab data for each site individually
  temp_filename<-paste("/Users/bob111higgins/Documents/School/College/Rutgers/Atmospheric Research",temp_title,".pdf")
  PM_site<-hourly_nj_table[l,]
  PM_site$realTime<-as.numeric(PM_site$Time.Local)
  PM_mean_site <-aggregate(PM_site, by=list(PM_site$Time.Local),FUN="mean",na.rm=TRUE)  #Make it average by time of day so can make time series plots. 
  plot(PM_mean_site$realTime,PM_mean_site$Sample.Measurement, type="l",lwd=10,main=paste(temp_title),xlab="LocalTime",ylab="Ozone (ppm)")#, ylim = range(0,15))
}
我试着选择上午10点

timemorn <- which(PM_site$realTime == "10")
但我想这给了我上午10点收集数据的行

上班时间上午 [1] 10335781105129


谢谢你的帮助

请尝试timemorn或timemorn,因为我们无法知道PM_站点中的数据类型,所以您要求我们进行猜测。学习发布完整的示例,而不仅仅是发布失败的代码。