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

R-read.csv only read in certain rows without having to modify code everytime

I would like to only use the rows in my csv file that correspond to a specific date. I have seen many good ways to do this, however, they all require you to actually know that certain date and specify it in your code. Since I will be running this…
Mel
  • 57
  • 1
  • 8
0
votes
0 answers

How can I retrieve a csv from a server with http authentication in R?

I would normally do: read.csv(pipe("wget -O- stdout http://someServer/aFile.csv")) But in this case the wget command that works is this one: wget -O- stdout http://someServer/aFile.csv --user=foo --ask-password This prompts for a password before…
Palace Chan
  • 8,845
  • 11
  • 41
  • 93
0
votes
0 answers

R import numbers but don't round

I have a .csv file where columns 2 and beyond are dollar amounts such as $1004.23, ($1482.40), $2423.94, etc. Similar to the example below: id desc price 0 apple $1.00 1 banana ($2.25) 2 grapes $1.97 When I bring in this file…
werkTJwerk
  • 57
  • 6
0
votes
1 answer

When other observation become to NA when i get some obs under conditions from data frame

First of all, i download a csv file from url fileurl<-"https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Fss06hid.csv" week3<-download.file(fileurl,destfile="./week3.csv",method="curl") Then use read.csv to turn into data frame …
Shuo Liu
  • 53
  • 2
  • 7
0
votes
2 answers

read.csv to import more than 2105 columns?

Leaving question for archival purposes only. (Read.csv did read in all columns, I just did not see them in the preview when opening the data.frame) Related to this question: Maximum number of columns that can be read using read.csv I would like to…
Kastany
  • 427
  • 1
  • 5
  • 16
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
2 answers

How can I merge 3 time series in R?

I'm really new here and I'm really new in programming language like R. I would like to download 3 time series, choose 2 columns (dates and closing price) from each of them and then merge them into one. Merging them is my problem -- some dates are…
Baska
  • 1
  • 1
0
votes
1 answer

R import csv lose date (day) value

I am importing a csv, and it stores dates as month-year (Apr-02 for April 2002). In the csv file, there is a day in the value. So Apr-02 would actually have a value in the file as something like 4/10/2002. When I import the file into R, it keeps…
bnmsba14
  • 3
  • 3
0
votes
3 answers

Reading oddly formatter CSV file

I'm looking at downloading some data from the statistics.gov.scot website. For example, I would like to source some data on the rates of hospital admissions. The query to source the data table I'm interested in is of…
Konrad
  • 17,740
  • 16
  • 106
  • 167
0
votes
0 answers

in R, add end of line (EOL) character while reading in csv

I am looping through hundreds of csv files and reading them into r data frames (read.csv()). Some of the csv files are missing an end of line (EOL) character. This produces the error, "incomplete final line found by readTableHeader." After getting…
Zmrkr
  • 1
  • 2
0
votes
1 answer

Access column after reading .csv file with fread

when I read a .csv file with read.csv like this df1 <- read.csv("a.csv") and I access a single column like this df1[,1] I get the expected column vector. But in contrast, if i read the .csv with fread (from the library data.table) df2 <-…
smudo78
  • 478
  • 1
  • 3
  • 13
0
votes
3 answers

How to import two sets of data in the same excel sheet in R?

Currently in one excel sheet I have one block of data that begins from row 1 and the last row always varies, but it is usually around 18 or 19. Once the first set of data ends then there are two blank rows and the second data set begins, which is…
Dre
  • 713
  • 1
  • 8
  • 27
0
votes
1 answer

How to make a specific row that begins with a "#" the header in R

I am trying to read a csv into R. I would like to remove the lines before the row that starts with a "#" and also make that row my header. As the row that starts with the "#" is always changing I do not want to use skip =. Currently when I do…
Dre
  • 713
  • 1
  • 8
  • 27
0
votes
3 answers

how to select every 5th row in a .csv file using python

just a normal .csv file with the first row has titles for each column. I wonder how to create a new .csv file that has the same header (first row), but contains every 5th rows of the original file? thank you!
j.doe123
  • 11
  • 1
  • 2
0
votes
2 answers

Speed up R script looping through files/folders to check thresholds, calculate averages, and plot

I'm trying to speed up some code in R. I think my looping methods can be replaced (maybe with some form of lapply or using sqldf) but I can't seem to figure out how. The basic premise is that I have a parent directory with ~50 subdirectories, and…
epi_bio
  • 95
  • 1
  • 9