r - R read many files and define column class / format
问题描述
I want to read specific columns from this files: https://syzygydeutschland-my.sharepoint.com/:f:/g/personal/florian_roeming_syzygy_de/EtbmqO423_9Kq6o8uv2alk8B2d0DMnsG9-HT9AFzYryXfA?e=KW9Nz0 (it would be appropriate for you to take just one file)
with:
library(data.table)
library("grid")
library("gmp")
library(anytime)
library(readr)
library(progress)
mehrere Datein einspielen/ import many files
temp <- list.files(pattern="*\\.tsv$") # \\ und $ sichern, dass nur die tsv files gewählt werden
temp
daten importieren / import data from 16 columns
test_data_3 <- lapply(temp,function(x){
#pb$tick() # progress bar
read.csv(file = x,
sep ="\t",
fill = TRUE,
quote='',
header = FALSE,
stringsAsFactors = FALSE,
#colClasses = c("numeric","character","character","character","character","character","numeric","character","numeric","character","character","numeric","numeric","numeric","numeric","numeric")
)[ ,c(287, 288, 289, 290, 291, 292, 293, 304, 370, 661, 662, 812, 813,994, 995, 1002)]
}
)
I get an error since I use
colClasses = c("numeric","character","character","character","character","character","numeric","character","numeric","character","character","numeric","numeric","numeric","numeric","numeric")
Please notice: 'de-DE,de;q=0.8,en-US' is the content of first column. But this is not a column of interest. how can I define the column-format (column-class)? I also tried
dec = ","
but it didnt work
解决方案
推荐阅读
- c# - Pong 游戏在 C# 中使用枚举作为方向播放器
- reactjs - 不能在反应应用程序中使用 scss 样式,也不能将 sass 更新到 1.43.1 版,有人知道为什么吗?
- sql - 如何检查正则表达式是否与sql中的另一个正则表达式匹配
- python - Python Classes:继承与在子类内部创建父类实例的区别(类组合)
- reactjs - 当组件重新渲染时,是否重新初始化在 React 组件之外声明的变量
- c++ - 设置容器不能正确排序字符串数组元素
- sql - SQL查询从同一结果行中的表中获取两个值
- sql - Netezza 存储过程在创建不存在的外部表时返回错误。我希望它返回一个空表
- sharepoint - 为什么当我尝试使用 SSIS 将他的所有个人信息从 SharePoint 加载到 SQL 时,我只获取用户的 ID?
- python - 如何在 HTML 中使用多个返回值