gpt4 book ai didi

r - 在 R 中导入文本文件

转载 作者:行者123 更新时间:2023-12-04 10:55:32 25 4
gpt4 key购买 nike

我将结果从 SEER 数据库导出为 .txt 文件,并且我一直在尝试将其导入 R 以进一步重新编码。文本文件是在 Windows 操作系统上创建的,我在 Mac OS X 上使用 R。我在尝试导入之前更改了我的工作目录,但它没有用。我在这里看到一个线程,它讨论了导出 .txt 文件的语法:

students <- read.table(file.choose(), header=T, sep="\t")

我也试过了,但是我得到了和以前一样的错误信息:

Warning messages:
1: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
EOF within quoted string
2: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
number of items read is not a multiple of the number of columns

我该如何解决这个问题?

最佳答案

尝试使用 read.delim(...) 而不是 read.table(...)

关于r - 在 R 中导入文本文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26086389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com