简体   繁体   English

R复制到csv文件并从中读取

[英]R Copying to and Reading from csv Files

When I go to save Excel data that I've pasted into a .csv file, I get a formatting issue and often the saved file has all the numbers in each row as one long string. 当我保存粘贴到.csv文件中的Excel数据时,遇到格式问题,通常,保存的文件中每一行的所有数字都是一个长字符串。

在此处输入图片说明

My read statement is 我的阅读声明是

resids<-read.csv("C:\\Projects\residuals_Parts3.csv",header=TRUE)

Any ideas on how to fix this? 有想法该怎么解决这个吗?

The warning you are getting is fairly standard in Excel - any formatting you've added to the file (eg widening columns) will get lost if you don't save the file as an excel file.. and the warning is supposed to remind you of this. 您得到的警告在Excel中是相当标准的-如果您不将文件另存为excel文件,则添加到文件中的所有格式(例如加宽的列)都将丢失。.并且该警告应提醒您这个的。 Personally, the extra click or two annoys me too. 就个人而言,额外的一两次点击也让我很烦。

If you would like to avoid converting excel files to CSV before bringing them into R, try the openxls package. 如果您想避免在将Excel文件导入R之前将其转换为CSV,请尝试使用openxls软件包。 It's saved me from a lot of that monkey business. 它使我摆脱了很多猴子生意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM