Displaying 20 results from an estimated 2000 matches similar to: "read numeric values with thousands seperator from csv file"
2009 Aug 12
3
Zoo and numeric data
Hi,
I have a csv file with different datatypes:
2009-01-01, character1, 10, 20.1
2009-01-02, character2, 11, 21.1
(I have attached the file to this post)
I read this file with read.zoo as I want a zoo/xts timeseries:
> t = read.zoo("./data.txt", sep=",", dec = ".", header=FALSE)
If I look at the zoo data all integer/numeric columns are read as
character:
>
2002 Mar 13
1
Commas in formatC
formatC() is great for formatting numbers! But it would be even better if it
could optionally insert commas (or semicolons), e.g.
R> formatC(1234567.89, digits=2, format="f", commas=T)
[1] "1,234,567.89"
Here's a snippet of code that does that, which could more or less just be
inserted into at the end of formatC if any R-core guru were so inclined. "r"
2009 Sep 26
1
questions on csv reading
Hi,
Is there any official way to determine the colClasses of a data.frame?
Why has POSIXct such a strange class structure?
Why is colClasses "ordered" not allowed (and doesn't work)?
Background
==========
I am writing a chunked csv reader that provides the functionality of read.table for large files (in the next version of package ff). In chunked reading, one wants to learn the
2009 Jun 14
2
read.csv
If read.csv's colClasses= argument is NOT used then read.csv accepts
double quoted numerics:
1: > read.csv(stdin())
0: A,B
1: "1",1
2: "2",2
3:
A B
1 1 1
2 2 2
However, if colClasses is used then it seems that it does not:
> read.csv(stdin(), colClasses = "numeric")
0: A,B
1: "1",1
2: "2",2
3:
Error in scan(file, what, nmax, sep,
2012 Apr 23
1
Can I specify POSIX[cl]t column classes inside read.csv?
I'm loading a nicely formatted csv file.
? ? #!/usr/bin/env Rscript
? ? kpi <- read.csv(
? ? ? # This is a dump of the username, date_joined and last_login columns
? ? ? # from the auth_user Django table.
? ? ? 'data/2012-04-23.csv',
? ? ? colClasses = c('character')
? ? )
? ? print(kpi[sample(nrow(kpi), 3),2:3])
Here's what the three rows I printed look like.
? ? ? ?
2011 Mar 09
4
Help with read.csv
Hello,
I have a file that looks like this:
Date,Hour,DA_DMD,DMD,DA_RTP,RTP,,
1/1/2006,1,3393.9,3412,76.65,105.04,,
1/1/2006,2,3173.3,3202,69.20,67.67,,
1/1/2006,3,3040.0,3051,69.20,77.67,,
1/1/2006,4,2998.2,2979,67.32,69.10,,
1/1/2006,5,3005.8,2958,65.20,68.34,,
where the ',' is the separator and I tried to read it into R, but...
> y <- read.csv("Data/Data_tmp.csv",
2013 Nov 18
1
Reading in csv data with ff package
I've spent some time trying to wrap my head around reading in large csv
files with the ff-package. I think I know how to do it, but am bumping
into some problems. I've tried to recreate the issues as best as I can
with a smaller example and maybe someone can help explain the problems.
The following code just creates a csv file with an integer column,
character column and logical column.
2000 Jun 28
1
Rd2dvi
I'm trying to use R CMD Rd2dvi and I end up at a Latex (I think)
command prompt. What's missing or what am I suppose to do?
Paul Gilbert
_______
paul at breman:/apps/dse-versions/2000.6/dse#R CMD Rd2dvi syskern This is
TeX, Version 3.14159 (Web2C 7.3) (Rd2.tex LaTeX2e <1998/12/01> Babel
<v3.6k> and hyphenation patterns for american, french, german, ngerman,
nohyphenation,
2012 Jul 25
3
ff package: reading selected columns from csv
*Dear R users, Ive just started using the ff package.
There is a csv file (~4Gb) with 7 columns and 6e+7 rows. I want to read only
column from the file, skipping the first 100 rows.
Below Ive provided different outcomes, which will clarify my problem
*
> sessionInfo()
R version 2.14.2 (2012-02-29)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
...
attached base packages:
[1] tools
2009 Jul 14
2
How to import BIG csv files with separate "map"?
Hi all,
I am having problems importing a VERY large dataset in R. I have looked into
the package ff, and that seems to suit me, but also, from all the examples I
have seen, it either requires a manual creation of the database, or it needs
a read.table kind of step. Being a survey kind of data the file is big (like
20,000 times 50,000 for a total of about 1.2Gb in plain text) the memory I
have
2010 Jan 19
2
Memory usage in read.csv()
I'm sure this has gotten some attention before, but I have two CSV
files generated from vmstat and free that are roughly 6-8 Mb (about
80,000 lines) each. When I try to use read.csv(), R allocates all
available memory (about 4.9 Gb) when loading the files, which is over
300 times the size of the raw data. Here are the scripts used to
generate the CSV files as well as the R code:
Scripts (run
2012 Jan 19
1
Help with .csv file reading !
Hello,
Here's my problem :
I have a csv file which I have to read with read.table() function (or
read.csv). The file has about 60000 lines whose data are written this way:
character;character;character;character
14/10/2010 13:10;0;49;0;49;
14/10/2010 13:20;0;49;0;49;
14/10/2010 13:30;0;49;0;49;
I tried to use the function this way: read.csv("file.csv",sep =
2011 Nov 08
3
Reading a specific column of a csv file in a loop
Dear all:
I have two larges files with 2000 columns. For each file I am
performing a loop to extract the "i"th element of each file and create
a data frame with both "i"th elements in order to perform further
analysis. I am not extracting all the "i"th elements but only certain
which I am indicating on a vector called "d".
See an example of my code below
2005 Feb 03
3
Reading Dates in a csv File
Hi all. I'm reading in a flat, comma-delimited flat file using read.csv.
It works marvelously for the most part. I am using the colClasses argument
to, basically, create numeric, factor and character classes for the columns
I'm reading in. However, a couple of the fields in the file are date
fields. I'm fully aware that POSIXct can be used as a class, however the
field must obey,
2010 Feb 28
6
A slight trap in read.table/read.csv.
I had occasion recently to read in a one-line *.csv file that
looked like:
"CandidateName","NSN","Ethnicity","dob","gender"
"Smith, Mary Jane",111222333,"E","2/25/1989","F"
That "F" (for female) in the last field got transformed to
FALSE. Apparently read.csv (and hence read.table) are inferring
2013 Jul 10
2
read.csv : Duda
Buenos días:
Dado un txt con columnas separadas por comas, lo leo con read.csv(nombre de fichero, header=FALSE), y todo bien; pero, ¿cómo haría si desease "importar" sólo algunas columas?.
Me refiero a hacer un read.csv de las columnas 1 a 5, y la 7, por ejemplo.
Gracias.
Un saludo
Eva
[[alternative HTML version deleted]]
2010 Apr 23
2
read.csv data frame thousands separator
Dear group,
Here is my df, trades1 :
trades1 <-
structure(list(Instrument.Long.Name = c("CORN", "CORN", "CORN",
"CORN", "CORN", "SOYBEANS", "SOYBEANS", "SOYBEANS", "SOYBEANS",
"SOYBEANS", "SOYBEANS", "STANDARD LEAD USD", "STANDARD LEAD USD",
"SPCL
2009 Nov 02
3
problems with read.csv
Dear all,
I''d like to ask help on R code to get the same results as the following
Splus code:
>indata<-importData("/home/data_new.csv")
>indata[1:5,4]
[1] 0930 1601 1006 1032 1020
I tried the following R code:
> indata<-read.csv("/home/data_new.csv")
> indata[1:5,4]
[1] 930 1601 1006 1032 1020
I''d like the first
2011 Oct 06
1
Issue with read.csv treatment of numerics enclosed in quotes (and a confession)
Dear Help-Rs,
I've been dealing with this problem for some time, using a work-around to deal with it. It's time for me to come clean with my ineptitude and seek a what has got to be a more streamlined solution from the Help-Rverse.
I regularly import delimited text data that contains numerics enclosed in quotes (e.g., "00765288071"). Thing is, for some of these data, I need
2010 Oct 09
1
Loss of precision in read.csv.
Given a csv file from this location
Airports<-"http://www.ourairports.com/data/airports.csv"
download.file(Airports,basename(Airports))
airports <-read.csv("airports.csv",encoding="UTF-8")
> airports[1,]
id ident type name latitude_deg longitude_deg
elevation_ft continent iso_country iso_region municipality scheduled_service
1 6523