Questions tagged [read.csv]

The command in R to read a data file with a “comma separated values” (csv) format.

The read.csv is a command in R to read a data file with a “comma separated values” (csv) format.

462 questions
4
votes
2 answers

R: How can I read a CSV file with data.table::fread, that has a comma as decimal and point as thousand separator="."

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 are separated by ";". The files also contain…
PhiSeu
  • 241
  • 2
  • 9
4
votes
1 answer

R read.csv how to ignore carriage return?

I need to read a text file (tab-separated) that has some carriage returns inside some fields. If I use read.table, it gives me an error: line 6257 did not have 20 elements If I use read.csv, it doesn't give an error, but creates a new line in that…
Rodrigo
  • 3,829
  • 6
  • 41
  • 72
4
votes
1 answer

datatable.integer64 argument is not working for me should it?

I am trying to load integer64 as character in fread ?fread indicates that the integer64 argument is not implemented but the options(datatable.integer64) is. Though fread keeps loading as int64. How can I tell fread to load as character. EDIT [If…
statquant
  • 12,389
  • 13
  • 75
  • 148
4
votes
2 answers

R's read.csv() omitting rows

In R, I'm trying to read in a basic CSV file of about 42,900 rows (confirmed by Unix's wc -l). The relevant code is vecs <- read.csv("feature_vectors.txt", header=FALSE, nrows=50000) where nrows is a slight overestimate because why not. However, >>…
Cardano
  • 639
  • 5
  • 13
3
votes
2 answers

How to read a CSV with Pandas and only read it into 1 column without a Sep or Delimiter

I have a txt file which formed of many email password combinations, the problem is it is full of symbols at the start middle or end. These can all be replaced using regex but my problem is reading the txt file and keeping all the data in 1 column. A…
RajB_007
  • 55
  • 7
3
votes
4 answers

Applying the same operations on multiple .csv file in pandas

I have six .csv files. They overall size is approximately 4gigs. I need to clean each and do some data analysis task on each. These operations are the same for all the frames. This is my code for reading them. #df =…
parastoo91
  • 151
  • 1
  • 10
3
votes
1 answer

colClasses date and time read.csv

I have some data of the form: date,time,val1,val2 20090503,0:05:12,107.25,1 20090503,0:05:17,108.25,20 20090503,0:07:45,110.25,5 20090503,0:07:56,106.25,5 that comes from a csv file. I am relatively new to R, so I tried data…
Bob
  • 47
  • 1
  • 4
3
votes
1 answer

Are there any valid reasons not to use fread() and fwrite() over read.csv() and write.csv()?

fread() and fwrite() are part of the data.table package in R and they perform significantly faster than the base read.csv() and write.csv() functions. As I work with enormous csv files (several GB in size), I now find myself always using fread() and…
Mus
  • 5,994
  • 19
  • 75
  • 112
3
votes
2 answers

How to create a .csv file from a Dictionary> in C#

I have a Dictionary(List, List(string)) (apologies, for some reason, this editor is not allowing me to type <>) which looks like the following: Key: A --> Value:{1,2,3} Key: B --> Value:{a,b,c} Key: C --> Value:{Hi,Hello,Hola} I would like…
Nodame
  • 683
  • 1
  • 8
  • 16
3
votes
1 answer

Using read.csv with a symlinked file

What I Am Trying To Do My source file is very large and I want to avoid copying it into other folders. I decided to create a symlink to the large file and want to use read.csv to read in the file. Folder…
sharly
  • 203
  • 1
  • 6
3
votes
1 answer

What does skipNul = TRUE in read.table() and read.csv() do (beyond skipping/ignoring embedded nulls)?

I realize setting skipNul = TRUE in read.csv() and read.table() skips over/ignores "embedded nulls" (see ?read.csv and Get "embedded nul(s) found in input" when reading a csv using read.csv()). What does skipping/ignoring embedded nulls mean for the…
Daniel Fletcher
  • 1,045
  • 2
  • 12
  • 22
3
votes
2 answers

Parse currency values from CSV, convert numerical suffixes for Million and Billion

I'm curious if there's any sort of out of the box functions in R that can handle this. I have a CSV file that I am reading into a data frame using read.csv. One of the columns in the CSV contains currency values in the format of…
user3246693
  • 485
  • 6
  • 19
3
votes
2 answers

read.csv column of zeros and ones as logical

How can a column of ones and zeros be read in directly as logical, thereby avoiding subsequent conversions? In a large csv file, several columns have values of zero or one, which I'd like to use as logical variables in R. If I specify those…
user5500407
3
votes
3 answers

reading csv file from R

I am new to R and want to read a csv file. But I got error when I try to read it. My csv file are as…
Alex
  • 173
  • 1
  • 17
3
votes
1 answer

R: reading in a .csv turns all "" (blank spaces) to NA

I have a data set in which I converted all "~" values to blank spaces "", and when I use the View() function to view the data set, I can clearly see the blank spaces. However, after I save my modified data frame as a .csv file via write.csv and read…
user3755880
  • 335
  • 4
  • 13