简体   繁体   English

read.csv / read.table R 3.1.1类型转换错误

[英]read.csv/read.table R 3.1.1 typeconvert error

Having updated to R version 3.1.1, read.table / read.csv incorporated in R code which ran under previous versions of R no longer works. 更新到R版本3.1.1后,R代码中包含在read.csv R版本下的read.table / read.csv不再起作用。 My original code was simply: 我的原始代码很简单:

read.csv("C:/................",skip = 2,as.is= TRUE)

I am getting the following error: 我收到以下错误:

Error in .External2(C_typeconvert, x, na.strings, as.is, dec) : .External2(C_typeconvert,x,na.strings,as.is,dec)中的错误:

Incorrect number of arguments (4), expecting 5 for 'typeconvert' 参数数量不正确(4),对于'typeconvert'期望为5

I have tried to incorporate all the options which are required by type.convert ie 我试过合并type.convert所需的所有选项,即

type.convert(x, na.strings = "NA", as.is = FALSE, dec = ".")

but to no avail. 但无济于事。 In terms of data types I have a mix of character and numeric fields but, possilbly, the most striking elements of the data are: 就数据类型而言,我混合使用字符字段和数字字段,但是,最引人注目的数据元素是:

1) Numeric fields have two missing indicators 'A' and 'NA'. 1)数字字段缺少两个指示符“ A”和“ NA”。 Which is why I originally used the 'as.is' option and later used type.convert. 这就是为什么我最初使用'as.is'选项,后来使用type.convert的原因。 For example 例如

Mean SD 平均SD
NA 0.30 不适用0.30
NA 0.20 NA 0.20
NA 0.30 不适用0.30
NA 0.20 NA 0.20
2.2 NR 2.2降噪
1.9 NA 1.9不适用
2.2 NA 2.2不适用
1.9 NA 1.9不适用
NR NR NR NR

2) The second is that some of my character fields incorporate full stops is 'A.B'. 2)第二个是我的某些字符字段包含句号“ A.B”。

Has something changed in this version of R? 这个版本的R中有什么变化吗?

I had the same problem after upgrading to version 3.1.1 from 3.1.0. 从3.1.0升级到3.1.1版后,我遇到了同样的问题。 The solution was simply to install R again. 解决的方法是简单地再次安装R。

I think the problem was that I was reckless when I migrated my installed packaged from the 3.1.0 library folder to the 3.1.1 library folder. 我认为问题是,当我将安装的软件包从3.1.0库文件夹迁移到3.1.1库文件夹时,我很鲁ck。 I wrote over the standard packages such as base and utils (where the read.table function is) in the new version with the old version. 我在新版本和旧版本中覆盖了标准软件包,例如base和utils(其中read.table函数在其中)。 When I reinstalled R it kept all the other packages I had installed. 当我重新安装R时,它将保留我已安装的所有其他软件包。

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

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