【发布时间】:2014-03-25 16:53:11
【问题描述】:
我已经发布了我们正在使用的代码,运行速度非常快。我应该弄清楚这个问题。
数据集中有多少事件发生在 2011 年?
所有时间戳都没有那个日期,但 lastModified 列有。我正在尝试使用此代码在 2011 年返回 1,如果不是,则返回 0,但它们都返回 0。请帮忙!
theData$year2011 <- ifelse(theData$lastModified == "2011*", 1,0)
那是行不通的代码。这是设置数据的代码
require(rjson)
require(plyr)
dataPath <- "http://getglue-data.s3.amazonaws.com/getglue_sample.tar.gz"
theCon<-gzcon(url(dataPath))
n.rows <- 1000
theLines <-readLines(theCon, n=n.rows)
str(theLines)
theLines[1]
theRead<-lapply(theLines[-1],fromJSON)
theData<-ldply(theRead,as.data.frame)
View(theData)
【问题讨论】: