R软件编写时遇到的问题

程序如下
rt<-read.table("C:\\Users\\yizaihuan\\Desktop\\exam0203.txt");rt
lm.sol<-lm(Weight~Height,data=rt)
summary(lm.sol)
运行结果
Warning message:
In read.table("C:\\Users\\yizaihuan\\Desktop\\exam0203.txt") :
incomplete final line found by readTableHeader on 'C:\Users\yizaihuan\Desktop\exam0203.txt'
V1 V2 V3 V4 V5
1 Name Sex Age Height Weight
2 Alice F 13 56.5 84.0
3 Becka F 13 65.3 98.0
4 Gail F 14 64.3 90.0
> lm.sol<-lm(Weight~Height,data=rt)
Error in eval(expr, envir, enclos) : object 'Weight' not found
> summary(lm.sol)
Error in summary(lm.sol) : object 'lm.sol' not found
>
这是怎么回事,如何改

read.table默认表格没有标题行,标题行被当成了第一行。
试试在read.table里加上:header=T追问

可是加了啊

温馨提示:答案为网友推荐,仅供参考
相似回答