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.

527 questions
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
  • 609
  • 9
  • 25
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,733
  • 2
  • 16
  • 32
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
  • 918
  • 1
  • 9
  • 22
0
votes
0 answers

readr: the read_delim function throws error "embedded nul in string: '\0'"

I am using the readr library and read_delim function in R. I have a big file it has null spaces, so I run the function like…
narteaga
  • 147
  • 2
  • 12
-1
votes
1 answer

Create a *read-only* CSV

I hope this is a straightforward question -- I create a lot of output files using write_csv, and for auditing purposes, I need to be sure that those csv files can't be modified by someone else. Is there a way to write a CSV file that's read-only?…
-1
votes
1 answer

import multiple csv from web into one data frame

i want to read out several csv files from the web and save the data into a data frame. If the files were on my computer this would be very easy as I have seen but I don't always want to download the files. The example: …
pontilicious
  • 239
  • 2
  • 12
-1
votes
1 answer

How to read csv file with unknown formatting and unknown encoding in R Program? (example file provided)

I have tried my best to read a CSV file in r but failed. I have provided a sample of the file in the following Gdrive link. Data I found that it is a tab-delimited file by opening in a text editor. The file is read in Excel without issues. But when…
Amal Joy
  • 41
  • 6
-1
votes
1 answer

Tidy dataframes with special characters

My dataset in csv format (available here) is as follows: I tried to import the data into R with the following document: library(tidyverse) data <- read_csv("\\Sample.csv") When I tried to extract column with data$, I get the…
Patrick
  • 1,057
  • 9
  • 23
-1
votes
1 answer

Read.table vs. read_csv: model are divergent

I have used both read.table (with arguments sep="\t", header = T, na.string = "NA") and the read_csv (with arguments col_names = T, na = "NA") from the reader package to read in a csv file. When I estimate a model, the summary shows vastly different…
Tea Tree
  • 882
  • 11
  • 26
-1
votes
1 answer

Converting strings to NA during csv reading

I have received a csv table of compound concentrations. Scattered throughout there are character values with various meanings, such as > 888, <0.2, /, and many more. Is there a way, preferably using base R or readr, to convert these to NA while…
Joe
  • 8,073
  • 1
  • 52
  • 58
-1
votes
1 answer

Read multiple csv files when Date Column is character format

I am using the readr and bind_rows() function to read multiple csvs. Example code: library(readr) library(dplyr) df = lapply(c( "df 4-11-17.csv", "df 4-12-17.csv", "df 4-13-17.csv"), read_csv) %>% bind_rows() When I do this I get an…
nak5120
  • 4,089
  • 4
  • 35
  • 94
-1
votes
1 answer

Tidying "side-by-side" datasets

I am working with a wide data set that looks like this: library( tibble ) wide_data <- data_frame(month_1 = c("Jan", "Feb", "Mar", "Jun"), score_1 = c(4, 5, 6, 4), month_2 = c("Jan", "Mar", NA, NA), …
-1
votes
1 answer

S4 class from readr read_csv output

I wanted to create an S4 class which represents the data from a read_csv function call (readr package) library(readr) library(magrittr) #data <- read_csv("random.csv") data <- structure(list(id = c(10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, …
andrnev
  • 410
  • 2
  • 12
-1
votes
1 answer

When reading CSV in R, how do you keep the time and date format the same?

My CSV looks as follows But when I read it in R, it changes the format for Date and Time(most important issue). Here is my simple code that I used to read the csv library(readr) dat1<- read_csv("2010.csv") How can I make it so that the format…
Dean
  • 33
  • 5
-2
votes
1 answer

Problem loading a tab-separated file using RStudio

Im trying to upload a dataset from .txt (tab separated file), but RStudio just do not recognize the contents. Im wondering if it's about special encoding or something like that. What I'm trying to upload: What RSTUDIO…
Diego Pacheco
  • 193
  • 2
  • 2
  • 10
1 2 3
35
36