0

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")

enter image description here

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

flobrr
  • 197
  • 1
  • 2
  • 13
  • 1
    It is also nice to make *minimal* examples. For example, if the progress bar isn't part of the problem, you don't need to include it in the question. – Gregor Thomas Jun 18 '18 at 15:51
  • We also have [this FAQ on reading only specific columns from a data frame](https://stackoverflow.com/q/5788117/903061). One approach you are close to is to use `colClasses` and fill in `NULL` for the columns you don't want. – Gregor Thomas Jun 18 '18 at 18:57

0 Answers0