Displaying 19 results from an estimated 19 matches similar to: "create unique ID for each group"
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
2013 Apr 12
2
split date and time
Hi R experts,
For example I have a dataset looks like this:
Number TimeStamp Value
1 1/1/2013 0:00 1
2 1/1/2013 0:01 2
3 1/1/2013 0:03 3
How can I split the "TimeStamp" Column into two and return a new table like
this:
Number Date Time Value
1 1/1/2013 0:00 1
2 1/1/2013 0:01 2
3 1/1/2013 0:03 3
Thank!
[[alternative HTML version
2013 Apr 18
6
count each answer category in each column
Hey,
Is it possible that R can calculate each options under each column and
return a summary table?
Suppose I have a table like this:
Gender Age Rate
Female 0-10 Good
Male 0-10 Good
Female 11-20 Bad
Male 11-20 Bad
Male >20 N/A
I want to have a summary table including the information that how many
answers in each category, sth like this:
X
2011 Feb 09
5
Problem with long number (from character to numeric class)
Hello,
I have a text file with one column containing long number but stored as
string.
I download the file with read.table (and colClass) and the first row of this
column is :
"095842087016731010"
As I need to make some calculations with these numbers, I tried to convert
them using as.numeric.
But then I get
as.numeric("095842087016731010")
95842087016731008
I understand
2013 Jun 03
2
delete active dataset
Hi All, whenever I open R using the shortcut on desktop, there are 2 active
datasets in the workspace, I tried to start the program from Start menu,
same thing!! How can I delete these two active datasets and make sure
whenever I restart the program, they wont appear?
Thanks!
[[alternative HTML version deleted]]
2008 Mar 25
5
reading Excel file
Hi R,
I have an excel file in which the third column is "date" and others are
"character" and "numeric".
Number of columns are 12
If I use this to read the file in R: x = read.xls("D:\\file.xls")
The problem is that my date column is read in julian dates.
So I am using: x = read.xls("D:\\file.xls",
2013 Apr 10
3
how to calculate average of each column
Hey All,
I have a large dataset and I want to calculate the average of each column
then return a new dataset.
Here is my question: I dont know if there is a function that can allow me
to calculate the average every 60 records of data in the whole dataset, and
return a new data frame. Not sure if I have to divide the dataset first for
every 60, then do the mean or can i directly do that.
thanks
2013 May 21
3
add identifier column by row
I want to add identifier column (Date) to a time series data frame. I want
to name the "Date" column be from 1 to 30 every 1440 rows.
Say I have a data like this (I simply my actual data here):
$dat
ID Var
1 1
2 4
3 6
4 7
5 7
6 8
How can I add identifier column (Date) from 1 to 3 every 2 rows and have
output like this:
ID
2005 Apr 23
2
How to override coerion error in 'scan'
I am using 'read.csv' in V2.0.1 to read in a CSV file with the
colClasses option and am getting an error from 'scan' when it encounters
a non-numeric value for a 'numeric' column, i.e.
> ds <- read.csv(in_file, nrows=irow, row.names=NULL,
colClasses=zclass,
comment.char="")
Error in scan(file = file, what = what, sep = sep, quote =
2005 Mar 21
5
Read a dataset with different lengths
Dear useR again,
How can I read a dataset if lines in dataset did not have same
elements (have different lengths), For example:
1 2, 4, 16, 1, 1, 3, 1, 1, 15, 5, 1, 1, 14, 1, 1
2 2, 13, 5, 1, 1, 3, 1, 1, 15, 5, 1, 1, 14, 1, 1
3 4, 5, 11, 1, 1, 6, 1, 1, 5, 14, 1, 1, 15, 1, 1
4 2, 5, 9, 1, 1, 14, 1, 1, 8, 16, 1, 1, 13, 1, 1
5 3, 7, 14, 1,
2013 Apr 16
2
plot 2 y axis
Hi,
I want to plot two variables on the same graph but with two y axis just
like what you can do in Excel. I searched online that seems like you can
not achieve that in ggplot. So is there anyway I can do it in a nice way in
basic plot?
Suppose my data looks like this:
Weight Height Date
0.1 0.3 1
0.2 0.4 2
0.3 0.8 3
0.6 1
2013 May 03
3
color by group in ggplot
Hey,
I have a dataset like this:
ID Var1 Var2 Group
A1 1 1 BB
A2 1 2 AA
B1 2 1 CC
B2 1 3 DD
C1 1 2 EE
I would like to plot the points of Var1 and Var2, use "ID" as X-axis, but
color the points by "Group". I can
2012 Jul 29
4
Simple x,y Plot
Dear Community,
i have read in a table with two column from a *txt-File. What i get is a
data-frame wit two column.
After that i allocate this 2 column to x and y. Plotting this, i obtain a
picture that looks like a bar plot (something like a grid).
Is that because x and y is in factor-formatted? A conversion with
"asnumeric" doesnt work. I get a vector with "NA".
Here is my
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
2003 Apr 09
3
Reading in multiple files
I apologize if this is a FAQ -- I kind of recall seeing something along
these lines before, but I couldn't find the message when I searched the
archives.
Problem:
1. I have hundreds of small files in a subdirectory ("c:\\temp") and I would
like to combine the files into a single data frame.
2. Individually, it is easy to read each file
2007 Oct 22
3
How to format data for time-series analysis
Hello all,
I'm using R to visualize and explore the data produced by a software
system. The software generates logs for many types of events. The
software runs for days on end, and can possibly generate multiple events
per second.
What is the appropriate time format for year, month, day, hour, minute,
second, millisecond? that R can properly interpret (using zoo? or ITS?)
I'll have
2004 Apr 10
4
Automation of c()
Hi,
I have around 300 files with the x, y and z coordinates of a DEM that I
would like to join in a single data frame object. I know how to automate the
import of the 300 data frames.
in Bash
ls > names
in R
names<-scan(names...)
With rep() and data.frame() construct a series of read.table() commands,
which you write to a file and execute them with source().
I do not know however how
2007 Nov 10
7
How to more efficently read in a big matrix
Dear list,
I need to read in a big table with 487 columns and 238,305 rows (row names
and column names are supplied). Is there a code to read in the table in
a fast way? I tried the read.table() but it seems that it takes forever :(
Thanks a lot!
Best,
Allen
2013 Sep 30
4
read.table() with quoted integers
Hi!
It seems that read.table() in R 3.0.1 (Linux 64-bit) does not consider
quoted integers as an acceptable value for columns for which
colClasses="integer". But when colClasses is omitted, these columns are
read as integer anyway.
For example, let's consider a file named file.dat, containing:
"1"
"2"
> read.table("file.dat",