搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  ISIT.xls
资料下载链接地址: https://bbs.pinggu.org/a-2150451.html
附件大小:
R version 3.3.2 使用read.table读取ascii数据时报错,不知道我哪里处理不当,求指点
附件是我练习用的xls文件

我操作的步骤是:
删除xls文件第二行空的单元格
删除xls文件第一行和第三行那些英文之间的空格
将xls另存为文本文件(制表符分隔)
在R中设置工作目录后,用read.table读取txt文件
报错如下
> setwd("D:/R/RExer")
> Isit<-read.table(file="ISIT3.txt",header=TRUE,dec=".")
Error in make.names(col.names, unique = TRUE) :
invalid multibyte string at '<ff><fe><54>'
In addition: Warning messages:
1: In read.table(file = "ISIT3.txt", header = TRUE, dec = ".") :
line 1 appears to contain embedded nulls
2: In read.table(file = "ISIT3.txt", header = TRUE, dec = ".") :
line 2 appears to contain embedded nulls
3: In read.table(file = "ISIT3.txt", header = TRUE, dec = ".") :
line 3 appears to contain embedded nulls
4: In read.table(file = "ISIT3.txt", header = TRUE, dec = ".") :
line 4 appears to contain embedded nulls
5: In read.table(file = "ISIT3.txt", header = TRUE, dec = ".") :
line 5 appears to contain embedded nulls


这是<A Beginner's Guide to R>第二章的第6道习题,官网上给的操作指导如下:
#Section 2.4. Exercise 6#There are empty cells and variable names with spaces#Remove the spaces in variable names and empty cells#should be replaced by an NA#This code is computer specific.#On a Mac use:setwd("/Users/Highstat/applicat/HighlandStatistics/Courses/FilesBeginnersGuide2R/BeginnersGuideToR/Data")#On a Windows OS computer use:setwd("Z:/Users/Highstat/applicat/HighlandStatistics/Courses/FilesBeginnersGuide2R/BeginnersGuideToR/Data")#You need to replace the entire path by the directory in which you #saved the data. BioLum <- read.table(file = "ISIT.txt", header = TRUE, dec = ".")BioLum2 <- scan(file = "ISIT.txt", skip = 1, dec = ".")#read.table is more user friendly#can is useful for large data sets.names(BioLum)str(BioLum)
我不知道我是不是漏了哪一步?求教求教~


    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2026-1-18 10:39