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.

737 questions
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
  • 8
3
votes
3 answers

using paste with read.csv inside a function

I want to create a function that uses read.csv() with paste(). The following code works in general df <- read.csv(paste("/file name", 2010, ".CSV", sep = ""), header = TRUE) but when I place it inside a function like so myfunction <-…
Victor Maxwell
  • 306
  • 1
  • 12
3
votes
5 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
  • 12
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

R function read.csv failing with "scan() expected 'a real', got..." message

This issue has been raised before and I’ve tried their suggestions, but I think my case is of special interest. I’ve used read.table, read.csv, and read.csv2. To no avail. I choose read.csv2 because the fields/variables are separated with ‘;’,…
rm1911
  • 41
  • 1
  • 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
  • 7,290
  • 24
  • 86
  • 130
3
votes
3 answers

read.csv("http://ichart.finance.yahoo.com/table.csv?s=SPY") Not Working

I have been using the following command for a long time without problem: spy <- read.csv("http://ichart.finance.yahoo.com/table.csv?s=SPY") But in the past few days it started to throw the following error: Warning messages: 1: In file(file, "rt")…
ilearncoding
  • 41
  • 1
  • 4
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
  • 1,053
  • 3
  • 12
  • 18
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,165
  • 4
  • 13
  • 23
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
  • 303
  • 1
  • 6
  • 17
3
votes
1 answer

read.csv in R reading dates differently

I have two very similar csv files. Stock prices for 2 different stocks downloaded from the same source in the same format. However, read.csv in R is reading them differently. > tab1=read.csv(path1) > tab2=read.csv(path2) > head(tab1) Date …
Abhirup Datta
  • 103
  • 2
  • 12
3
votes
1 answer

Reading multi-line text blocks into a single vector in R

I have a file with large, multiline blocks of text. I would like to read the file into a list of character vectors -- one for each block. My reading of the documentation on functions like scan(), read.table() etc seem to suggest that the end of a…
2
votes
0 answers

Import, parse and display csv in react

What is the best way to import, parse csv(100 thousand rows) and display it like excel table in react.js ? Basic Requirements: Read CSV(40k- 100k rows) Parse and Display Map and rename columns I want to do this using React. Please help to find the…
2
votes
1 answer

Multiple skips when reading a csv file

I have a very large file of which I only need the first element of rows 1, 100001, 200001, which I extract like this: x1 <- read.csv(filename, nrows = 1, header = F)[1, 1] x2 <- read.csv(filename, skip = 100000, nrows = 1, header = F)[1, 1] x3 <-…
Řídící
  • 248
  • 1
  • 9