Questions tagged [readr]

readr is an R package that provides a fast and friendly way to read tabular data.

An R package written by Hadley Wickham. The goal of readr is to provide a fast and friendly way to read tabular data into R.

373 questions
0
votes
0 answers

read_lines_chunked from readr package gives strange output

I want to use the readr package to read in big fasta files and count the entries. The file has multiple rows and each entry starts with a >. In general I am not interested in the other data, I just want to count the lines starting with >. I thought…
drmariod
  • 9,470
  • 8
  • 48
  • 96
0
votes
1 answer

Importing large numbers when binding csv files

Having trouble with my code while trying to import my data with a column that exceeds the maximum integer (.Machine$integer.max = 2147483647). Using readr's read_csv I believe it's importing as NA instead of rounding off. The complication comes from…
ant
  • 485
  • 1
  • 4
  • 11
0
votes
1 answer

Couldnt receive the required output

I was working with the assignment to read the fixed width file format in the R Programming,this is my dataset http://www.cpc.ncep.noaa.gov/data/indices/wksst8110.for and I used the readr package to read the file and clean the data with the below…
shivanesh
  • 89
  • 1
  • 1
  • 5
0
votes
1 answer

How can I read dates without year using readr?

I have a data file in which dates are given without year. 01/05 Fellowship enters Moria 01/09 Fellowship reaches Lorien 01/17 Passing of Gandalf 02/07 Fellowship leaves Lorien 02/17 Death of Boromir I try to read it like this lotr <-…
0
votes
0 answers

readr and negative numbers in parentheses

Is there a way to get readr to parse numbers in parenthesis as negative numbers? For example, in the code below I would like column B to be parsed as numbers and for the first item to be -2.3. library(readr) data <- "A,B,C 1, (2.3), 4 2, 4.6,…
banbh
  • 1,023
  • 10
  • 21
0
votes
1 answer

Silent type_convert

Is there a way to use the type_convert function from the readr package without it telling you what column specification it's using in the console. From the example in the ? help documentation: > df <- data.frame( + x = as.character(runif(10)), +…
Marijn Stevering
  • 1,099
  • 8
  • 21
0
votes
0 answers

Handling special characters when imoprting csv to r

I can't import csv (semicolon delimited) to R. The problem is that some columns contain text with special character (like semicolon) which result in unequal number of columns in some rows. Special characters are surrounded by quotas, like ";". The…
0
votes
0 answers

Skip variables while reading in a fixed width text file in R using readr package

I'm reading in some text files in R using the readr package because of the files fixed width but on some of the files I get the error that cannot allocate vector of size.... I'm assuming some files are too big but I actually don't really need all…
User23
  • 143
  • 11
0
votes
1 answer

R readr::read_fwf ignore characters using fwf_widths

I would like to know if there is an easy way to skip characters using the read_fwf from the readr package in R. For example, modifying one of the examples in the documentation library(readr) fwf_sample <- system.file("extdata/fwf-sample.txt",…
lucacerone
  • 8,140
  • 12
  • 48
  • 72
0
votes
1 answer

How can I get readr to handle quoted NA values?

library(readr) csv <- 'x,y "1","N/A" "N/A","2" ' df <- read_csv(csv, col_types = "ii", na=c("\"N/A\"", "N/A")) Running this yields: > df <- read_csv(csv, col_types = "ii", na=c("\"N/A\"", "N/A")) Warning: 2 parsing failures. row col expected…
Ian Gow
  • 2,036
  • 1
  • 18
  • 26
0
votes
1 answer

using readr to import big data file with different row lengths and whitespace as delimiter

I have an issue to Read a big file (close to 2000000 rows) using the readr package. Why do I want to use the readr package. My data file can containing ASCII control characters (0x01 equal to ascii 26 equal to CTRL+Z) that stops the execution of…
0
votes
1 answer

R data cleaning fail: .dat to clean data frame to clean CSV file

Importing .dat file into R console. Hoping to get a clean table so I can convert it back to CSV and manipulate it with other CSV files in Excel. Below is the entire R console session. The table looks aligned in the console but certainly doesn't…
Elan
  • 495
  • 1
  • 6
  • 17
0
votes
1 answer

read data into R

The World Health Organization dataset is available here: http://www.filedropper.com/who When the data is read using fread (from the data.table package), or read_csv (from the readr package) some variables are wrapped within letter r, and are shown…
ilyas
  • 479
  • 6
  • 20
0
votes
0 answers

R readr package - written and read in file doesn't match source

I apologize in advance for the somewhat lack of reproducibility here. I am doing an analysis on a very large (for me) dataset. It is from the CMS Open Payments database. There are four files I downloaded from that website, read into R using readr, …
Nick Criswell
  • 1,603
  • 2
  • 13
  • 27
0
votes
1 answer

Check the data type of a column in a data.frame in R

How to find the data type of a column in a data.frame? I am using the below code, does it make sense? Am I getting the correct output. for (f in feature.names) { if (class(train[[f]]) == "character") { count_c <- count_c + 1 } …
Anoop Toffy
  • 864
  • 1
  • 9
  • 22
1 2 3
24
25