Dear Eliza,
Thank you for testing the code. Sorry, it was a mistake.
I created one more file Eliza3.txt (attached)
Try this.
library(stringr)
lapply(list.files(),function(i) str_count(gsub( $,,readLines(i)), ))
#[[1]]
# [1] 7 7 7 7 6 7 7 7 7 7 6 6 7 7 7 7 6 7 7 7 7 7 6 6
#[[2]]
# [1] 7 7 7 7
Dear Eliza,
Try this:
Lines1-readLines(textConnection(1911.01.01 7.87
1911.01.02 9.26
1911.01.03 8.06
1911.01.04 8.13
1911.01.05 12.90
1911.02.06 5.45
1911.02.07 3.26
1911.03.08 5.70
1911.03.09 9.24
1911.04.10 7.60
1911.05.11
HI Eliza,
Suppose you have 147 data files in the same working directory. Here, I am
using Eliza1.txt and a modified Eliza2.txt (attached).
list.files()
#[1] Eliza1.txt Eliza2.txt
lapply(list.files(),function(i) str_count(gsub( $,,readLines(i)), ))
#count the spaces. Used gsub as there
? I don't have to use matplot(), but would like to understand its
use.
Thanks,
Tim
Tim Clark
Department of Zoology
University of Hawaii
--- On Sun, 9/27/09, Henrique Dallazuanna www...@gmail.com wrote:
From: Henrique Dallazuanna www...@gmail.com
Subject: Re: [R] Data formatting
Clark
Department of Zoology
University of Hawaii
--- On Sun, 9/27/09, Henrique Dallazuanna www...@gmail.com wrote:
From: Henrique Dallazuanna www...@gmail.com
Subject: Re: [R] Data formatting for matplot
To: Tim Clark mudiver1...@yahoo.com
Cc: r-help@r-project.org
Date: Sunday, September 27
Dallazuanna www...@gmail.com wrote:
From: Henrique Dallazuanna www...@gmail.com
Subject: Re: [R] Data formatting for matplot
To: Tim Clark mudiver1...@yahoo.com
Cc: r-help@r-project.org
Date: Sunday, September 27, 2009, 4:47 PM
You can try this:
matplot(do.call(cbind, split.dat))
On Sun, Sep 27
: [R] Data formatting for matplot
To: Tim Clark mudiver1...@yahoo.com
Cc: r-help@r-project.org
Date: Monday, September 28, 2009, 1:43 AM
Tim,
With Gabor examples, I understand this,
You can get a similar graph with plot:
with(mydat, plot(x, y, col = id))
On Mon, Sep 28, 2009 at 3:01
Dear List,
I am wanting to produce a multiple line plot, and know I can do it with matplot
but can't get my data in the format I need. I have a dataframe with three
columns; individuals ID, x, and y. I have tried split() but it gives me a list
of matrices, which is closer but not quite what
You can try this:
matplot(do.call(cbind, split.dat))
On Sun, Sep 27, 2009 at 11:42 PM, Tim Clark mudiver1...@yahoo.com wrote:
Dear List,
I am wanting to produce a multiple line plot, and know I can do it with
matplot but can't get my data in the format I need. I have a dataframe with
Try this:
library(lattice)
xyplot(y ~ x, mydat, groups = id)
On Sun, Sep 27, 2009 at 10:42 PM, Tim Clark mudiver1...@yahoo.com wrote:
Dear List,
I am wanting to produce a multiple line plot, and know I can do it with
matplot but can't get my data in the format I need. I have a dataframe
All,
I have three columns of data: id, date, hab. I am trying to set up a matrix
that has the id as the rows, date as columns, and the hab value as the data
values. Each id/date combination can only have one hab value. I would like
for it to look something like this
date 1, date 2,
Is this what you are after (uses the reshape package)
# test data
x - expand.grid(id=1:5, date=seq(as.Date('2009-01-01'), by='1 day',
length=5))
x$hab - seq(nrow(x)) # add hab
head(x)
id date hab
1 1 2009-01-01 1
2 2 2009-01-01 2
3 3 2009-01-01 3
4 4 2009-01-01 4
5 5
12 matches
Mail list logo