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]
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
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
Thanks for everyones help. It is great to have a number of options that result
in the same graph.
Aloha,
Tim
Tim Clark
Department of Zoology
University of Hawaii
--- On Mon, 9/28/09, Henrique Dallazuanna wrote:
> From: Henrique Dallazuanna
> Subject: Re: [R] Data formatti
Hawaii
--- On Sun, 9/27/09, Henrique Dallazuanna wrote:
From: Henrique Dallazuanna
Subject: Re: [R] Data formatting for matplot
To: "Tim Clark"
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, 2009 a
e.
>
> Thanks,
>
> Tim
>
>
> Tim Clark
> Department of Zoology
> University of Hawaii
>
>
> --- On Sun, 9/27/09, Henrique Dallazuanna wrote:
>
>> From: Henrique Dallazuanna
>> Subject: Re: [R] Data formatting for matplot
>> To: "Tim
? 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 wrote:
> From: Henrique Dallazuanna
> Subject: Re: [R] Data formatting for matplot
> To: "
Try this:
library(lattice)
xyplot(y ~ x, mydat, groups = id)
On Sun, Sep 27, 2009 at 10:42 PM, Tim Clark 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
> three colum
You can try this:
matplot(do.call(cbind, split.dat))
On Sun, Sep 27, 2009 at 11:42 PM, Tim Clark 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
> three columns; indiv
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 I
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
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, dat
12 matches
Mail list logo