我试图导入一个巨大的数据集(稍后做分析),但我只想要4行(它们按实用程序分类,而我只对在其中几个)。大型数据集问题(250MB)中的R加载
问题是:该格式是奇怪的和巨大的,我不断收到有关没有足够的列名称的错误。
格式如下:每行是一个公用事业区域,每一列从2015年夏季到现在每一小时,以及其用电量,所以有很多列(2015年至今的小时数x 2)。
我已经试过如下:
> data<-read.table("C:\\Users\\EBA.txt",header=true,nrows=150)
Error in read.table("C:\\Users\\EBA.txt", :
object 'true' not found
> data<-read.table("C:\\Users\\EBA.txt",header=TRUE,nrows=150)
Error in read.table("C:\\Users\\EBA.txt", :
more columns than column names
> data<-read.table("C:\\Users\\EBA.txt",header=TRUE,sep=",")
#cancelled here because it froze my computer
> data<-read.table("C:\\Users\\EBA.txt",header=TRUE,sep=",]")
Error in scan(file, what = "", sep = sep, quote = quote, nlines = 1, quiet = TRUE, :
invalid 'sep' value: must be one byte
> data<-read.table("C:\\Users\\EBA.txt",header=TRUE,sep=",")
Error in read.table("C:\\Users\\EBA.txt", :
more columns than column names
我期待在这里的生活(“美国电力系统运行数据”的数据集,https://www.eia.gov/opendata/bulkfiles.php“
最终,我会想使用日期和用电量,所以阅读它的使用形式和ISO时间转换也将是伟大的 - 谢谢!
'read.table'读取表格文件,而不是JSON。看看https://stackoverflow.com/questions/2617600/importing-data-from-a-json-file-into-r#2617823 – HubertL
你有意识地使用data.table标记吗?它在问题主体中似乎没有任何意义......无论如何,我会继续并将其删除。 – Frank
@HubertL我不知道JSONs存在!任何喜欢的软件包来操纵它们?这种格式非常糟糕。感谢您的帮助。 – mcando