readr Questions

3

Solved

I have a .csv datafile with many columns. Unfortunately, string values do not have quotation marks (i.e., apples i.o. "apples). When I use read_csv from the readr package, the string values are imp...
Ber asked 1/11, 2016 at 19:20

4

Solved

I got several CSV files which contain numbers in the local german style i.e. with a comma as the decimal separator and the point as the thousand separator e.g. 10.380,45. The values in the CSV file...
Factual asked 17/8, 2016 at 14:59

3

I am creating a rmarkdown pdf report. I used read_csv function from readr package to import some csv files in a folder. I used SuppressMessages/Warnings functions to hide all warnings/messages, but...
Benniebenning asked 15/4, 2019 at 10:40

1

I study R with R Cookbook 2nd edition. in 4.6 Reading Fixed-Width Records, I typed code as written in book. but my code doesn't work like book Fisher R.A. 1890 1962 Pearson Karl 1857 1936 Cox Gertr...
Truesdale asked 24/8, 2021 at 8:25

1

Solved

I attempt to use read_csv from {readr} to read a CSV file into R. To demonstrate my real issue, I reset the argument guess_max to 5 at first (default is 1000) library(readr) formals(read_csv)$guess...
Histo asked 8/3, 2023 at 15:28

1

I have a .csv file like this (except that the real .csv file has many more columns): library(tidyverse) tibble(id1 = c("a", "b"), id2 = c("c", "d"), ...
Hothouse asked 7/9, 2022 at 22:50

3

Solved

Often Stack Overflow R questions can share sample data that is just data.frame output as such, instead of dput: id cate result 1 1 yes 1 2 1 yes NA 3 1 no NA 4 2 no NA 5 2 yes 1 6 2 yes NA ...
Aargau asked 29/7, 2022 at 16:11

2

There is a lot of documentation on how to read multiple CSVs and bind them into one data frame. I have 5000+ CSV files I need to read in and bind into one data structure. In particular I've follow...
Ornate asked 17/5, 2017 at 19:45

1

Solved

I'm using R to pull out numbers from strings of ids. In the past, I've used readr's parse_number() function, but recently, I'm getting a bizarre error where it's saying that my character column is ...
Batwing asked 5/2, 2022 at 22:49

1

Solved

I just noticed that read_csv() somehow uses random numbers which is unexpected (at least to me). The corresponding base R function read.csv() does not do that. So, what does read_csv() use the rand...
Cordle asked 9/6, 2021 at 17:52

4

Solved

I'm using bash to pipe data through an Rscript like so: cat random.csv | Rscript test.R arg >| delete.csv My aim is to use the R package readr to both read stdin and write stdout. I found the...
Straub asked 1/3, 2016 at 12:20

2

Solved

I often work with comma separated values, and was curious to the differences between read_csv() and read.csv(). Are there any practical differences that could shine light on the situational usage ...
Kylynn asked 24/2, 2020 at 11:22

6

I need to read a table that is a .tsv file in R. test <- read.table(file='drug_info.tsv') # Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : # line 1 did not have...
Trilobate asked 24/10, 2015 at 19:12

2

Trying to read a csv file using read_csv2() from readr package. The problem is read_csv2() doesn't recognise the characters properly while R's default read.csv2 successfully does. For example: the ...
Republic asked 3/12, 2016 at 9:15

2

Solved

I want to read larger csv files but run into memory problems. Thus, I would like to try reading them in chunks with read_csv_chunked() from the readr package. My problem is that I do not really und...
Chemosmosis asked 28/4, 2017 at 9:52

1

I have a data.frame or tibble that, in one script, is written to a CSV file. In another script, that same CSV file is read into a data.frame or tibble. Using read_csv(), with the col_types= paramet...
Erdah asked 19/3, 2019 at 20:38

4

Solved

I'm trying to create separate .csv files for each group in a data frame grouped with dplyr's group_by function. So far I have something like by_cyl <- group_by(mtcars, cyl) do(by_cyl, write_csv...
Greasewood asked 20/12, 2016 at 0:32

1

Solved

I like the workflow regarding column specs as described in this RStudio blog post. Basically, one can grab the column specification after a read_csv import, and then save that down for use later. F...
Gink asked 25/8, 2016 at 0:58

2

Solved

I am currently reading in a file using the package readr. The idea is to use read_delim to read in row for row to find the maximum columns in my unstructured data file. The code outputs that there ...
Gosselin asked 26/5, 2016 at 13:47

2

Solved

I have found a very annoying problem that I want to share with the community. This is a question that I have found an acceptable solution for (detailed below), but I now have several follow-up ques...
Clarisclarisa asked 24/7, 2018 at 1:32

2

Solved

I use readr to read in data which consists a date column in time format. I can read it in correctly using the col_types option of readr. library(dplyr) library(readr) sample <- "time,id 2015...
Osterman asked 1/9, 2015 at 16:36

3

Solved

readr::read_csv is misreading some column types in a file I am loading so I want to use cols to set them manually. In ?read_csv, it says the col_types argument should be _"One of ‘NULL’, a ‘cols(...
Kolomna asked 1/6, 2018 at 22:55

2

Solved

I am trying to make a heatmap of a sites vs. species abundances matrix. With thanks to Maurits Evers for some of this code, I am still not able to run it without the error message: Setting row n...
Nez asked 4/5, 2018 at 3:16

1

Solved

The readr package in the tidyverse has the option to automatically unpack a zip file and convert it to a tibble. But I have a zip file that holds multiple csv files. In the line of code below, SSPd...
Tenfold asked 12/4, 2018 at 23:29

1

Solved

I've been playing around with readr's read_delim_chunked functions. Based on the documentation, it's not clear how one can, or if it's possible, to pass arguments into the callback function. For in...
Cordes asked 12/3, 2018 at 14:51

© 2022 - 2025 — McMap. All rights reserved.