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
0
votes
1 answer

Is there any way to show "open file wizard" in R instead of loading file by read.csv?

I want to provide an option for user to open whatever file he/she wants just by selecting the csv file. Is there any option in R to do so? Surprisingly I could not find such feature.
exAres
  • 4,806
  • 16
  • 53
  • 95
0
votes
0 answers

R read.csv how NOT to convert numbers into numerical values but keep them as strings

I have a CSV file with all values in double quotes. One column is the id column and it contains values such as this: 01100170109835 The problem I am having is that no matter what options I specify (as.is=T, stringsAsFactors=F, or…
breezymri
  • 3,975
  • 8
  • 31
  • 65
0
votes
1 answer

Special delimiter when use read.csv()

I have a lot of .csv file that use "|" as delimiter: 1492624841097281|"19026960706021"|"3112642370"|"50000"|"0"|"VND"|""|""|"50000 I tried to read them like following read.csv("a.csv",head=T, sep="|") and read.csv("a.csv",head=T, sep="\|") I…
Ha Nguyen
  • 3
  • 2
0
votes
2 answers

Subtract two same-sized matrices with string header rows in R

I have two matrices imported from csv files. They have the same number of rows and columns. I need a third matrix which would be the element-wise subtraction of the two matrices. t1 <- read.csv("/matrix_1.csv", check.names = FALSE, sep = ",") t2 <-…
Lucien S.
  • 5,123
  • 10
  • 52
  • 88
0
votes
1 answer

How to read a badly formatted CSV file with multiple embedded data sets and non-printing characters

I need to open a CSV file with the following options in the figure below. I add the link to my files. You can try with the file "20140313_Helix2_FP140_SC45.csv" https://www.dropbox.com/sh/i5y8r8g7wymalw8/AABXsLkbpowxGObFpGHgv4m-a?dl=0 I have tried…
0
votes
1 answer

Import CSV File Into R, in Upper Case

Novice R user here... I'm using the code below to import all csv files in a folder: path <- "C:/Users/Daniel/Desktop/Motors/" files <- list.files(path=path, pattern="*.csv") for(file in files) { perpos <- which(strsplit(file, "")[[1]]==".") …
dking16
  • 1
  • 2
0
votes
0 answers

non english characters in R

I have a file which has non-english characters. The problem is that I am using R-studio and have tried everything I know to display non-English characters, but all I see is junk. > Sys.setlocale("LC_CTYPE", locale="Chinese") [1] "Chinese…
AhmerK
  • 3
  • 1
  • 4
0
votes
1 answer

Omitting certain lines of a .csv file with less no. of columns and reading the rest

I have high frequency data in a .csv file that consists of order quotes and trade quotes. Following is an example of the first 13 lines of a 600,000 line dataset: (sorry for the format, copy/paste wouldn't fit all the columns on one line hence I…
UtdMan
  • 151
  • 2
  • 12
0
votes
0 answers

Why does read.csv() sometimes get errors when specifying colClasses as "character"?

I am using read.csv() to make a data.table. When importing the columns, I need them to be imported as either 'character' or 'numeric'. I'm using the following code (simplified for brevity): dataCols <- c(a="character", b="character", c="numeric",…
linkaneo
  • 1
  • 1
0
votes
2 answers

R: Reading number with comma and negative number with negative sign at the end

I am having problems reading a CSV file that has a number in a strange format. I would like to read the value as a number into R. I am reading the CSV file using read.csv normally into a DF. The problem is that one of the columns read the value as…
0
votes
1 answer

Reading a csv file that is 53,000 MB large

The data is called: data.csv I tried read.csv('data.csv') and an error message popped up saying the file was too large. I'm not really sure how to use fread in this situation because when I tried: require(data.table) DT <- fread("data.csv") That…
Nick
  • 833
  • 2
  • 8
  • 11
0
votes
1 answer

Rewriting a function, to find mean of column in set of tables, returns some results consistent with old program and some slightly different

I'm currently writing a program (full disclosure, it's "homework"). The program is designed to run through a series of files based on a range given, collate them into one large table sans NAs and find the mean of the pollutant provided (which is a…
NinKenDo
  • 57
  • 6
0
votes
4 answers

Read in (Scan, read csv) huge data in R using array

Can anyone help me on how to read in a huge data frame (33 rows,38 columns and always a header every 39th column starting with # from daily weather 1951-2015) in R. I have following data in a .txt file naming it test2.txt: # 1950-01-01 00:59:00 …
user3472591
  • 41
  • 1
  • 1
  • 4
0
votes
0 answers

get cell element from R read.csv object?

In R, I'm trying to get a cell value from a read.csv object. But this is what I get: a<- tail(sp.csv, n=1L) a$V1 [1] 5042951 54 Levels: 11054 1156785) 1157947) 1159014) 1166898) 1174855) ... src,trg,sp_len,hops Where, sp.csv is the read.csv object…
sAguinaga
  • 638
  • 13
  • 31
0
votes
0 answers

trouble reading data from .csv and .xlsx files in R

I'm trying to import some data in R but the imported data differs from the original one in the smaller digits in a way I'm not really able to understand why. First I tried to import with read.csv the file "test 1.csv", which contains a single…
gusbrs
  • 123
  • 1
  • 7