Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
readr多列';立刻打字_R_Types_Readr - Fatal编程技术网

readr多列';立刻打字

readr多列';立刻打字,r,types,readr,R,Types,Readr,我尝试处理readr函数。我的意思是,这是一个来自readrgithub网页的示例: read_csv("iris.csv", col_types = list( Sepal.Length = col_double(), Sepal.Width = col_double(), Petal.Length = col_double(), Petal.Width = col_double(), Species = col_factor(c("setosa", "versicolor

我尝试处理
readr
函数。我的意思是,这是一个来自
readr
github网页的示例:

read_csv("iris.csv", col_types = list(
  Sepal.Length = col_double(),
  Sepal.Width = col_double(),
  Petal.Length = col_double(),
  Petal.Width = col_double(),
  Species = col_factor(c("setosa", "versicolor", "virginica"))
))
是否有机会在
read_csv
中使用一个函数,该函数可以同时确定多个列的
col_double
,例如
grepl(“Length | Witdh”,col_names)=col col double()


谢谢,

这可能没有帮助,但您不必指定每种列类型。您排除的任何内容都将以默认格式读取。所以如果长度和宽度列是数字,它们会自动加倍。是的,我知道。我只是以这段代码为例。我的csv.file文件中有20多列,大约有8列需要更改类别。因此,我不想对每个列分别执行
col…()
命令。@Nicolabo找到解决方案了吗?