[R] New reshape2 question
Neotropical bat risk assessments
neotropical.bats at gmail.com
Wed Aug 13 13:26:29 CEST 2014
Hi all,
Thanks go out to those who provided helpful suggestions last year with a
similar issue.
I am working with a new data set and trying what I assumed was a simple
aggregation in reshape2 but is not working. I have a large number of
similar data sets to run so getting the code correct is important.
I have tried this code line in bold (both plyr and reshape2 are loaded):
> ChenaPond <- read.table("C:/Bat papers in prep/Chile/Data &
analyses/ChenaPond.txt",header=T,sep="\t",quote="")
dat1<-ChenaPond
>*res2<-ddply(dat1,.(Location,Species),summarize, Time=sum(Time))*
*Error in Summary.factor(c(3L, 4L, 5L, 15L, 39L, 45L, 18L, 24L, 25L,
26L, :
sum not meaningful for factors*
Attached is the data. Not sure why it is all factors and when I tried
changing to double precision the times were corrupted. I recall that R
does not do well with time values. Do I need a line using chron as well
beforehand?
I even tried for several hours looking at the ReshapeGUI package to see
what I may have been doing incorrectly to no avail.
1. What I need to do to analyze all the data in another program is to
reformat it so that I have a Species by Time matrix summarized in 5
minute time blocks. The result needs to be Species as rows, and
time intervals are arranged chronologically in columns.
2. Then I need the matrix converted such that each unique Species will
have proportional abundances of time (0 to 100) so totals for each
species should be the same (or 100%).
What do folks suggest?
Plyr, Reshape2 or try tables?
Thanks,
Bruce
--
Bruce W. Miller, PhD.
Neotropical bat risk assessments
If we lose the bats, we may lose much of the tropical vegetation and the lungs of the planet
Using acoustic sampling to map species distributions for >15 years.
Providing Interactive identification keys to the vocal signatures of New World Bats
For various project details see:
https://sites.google.com/site/batsoundservices/
-------------- next part --------------
Species Location Date Time
Myochi Chena pond 5/26/09 18:38
Lascin Chena pond 5/26/09 18:51
Lascin Chena pond 5/26/09 19:38
Lascin Chena pond 5/26/09 19:39
Tadbra Chena pond 5/26/09 19:47
Lasvar Chena pond 5/26/09 20:12
Lasvar Chena pond 5/26/09 20:16
Lasvar Chena pond 5/26/09 20:56
Lascin Chena pond 5/26/09 21:19
Tadbra Chena pond 5/26/09 21:20
Lascin Chena pond 5/26/09 22:47
Lascin Chena pond 5/26/09 22:56
Lasvar Chena pond 10/15/09 20:51
Lasvar Chena pond 10/15/09 20:55
Lasvar Chena pond 10/15/09 20:56
Lasvar Chena pond 10/15/09 20:57
Lasvar Chena pond 10/15/09 20:59
Myochi Chena pond 10/15/09 21:00
Myochi Chena pond 10/15/09 21:26
Lascin Chena pond 10/15/09 21:29
Lasvar Chena pond 10/15/09 21:33
Lasvar Chena pond 10/15/09 21:34
Lasvar Chena pond 10/15/09 21:35
Myochi Chena pond 10/15/09 21:55
Lasvar Chena pond 10/15/09 21:56
Lascin Chena pond 10/15/09 21:59
Lascin Chena pond 10/15/09 22:00
Lascin Chena pond 10/15/09 22:01
Myochi Chena pond 10/15/09 22:03
Myochi Chena pond 10/15/09 22:08
Myochi Chena pond 10/15/09 22:08
Myochi Chena pond 10/15/09 22:09
Lascin Chena pond 10/15/09 22:17
Lasvar Chena pond 10/15/09 22:23
Lasvar Chena pond 10/15/09 22:24
Myochi Chena pond 10/15/09 22:26
Lasvar Chena pond 10/15/09 22:30
Lasvar Chena pond 10/15/09 22:31
Lascin Chena pond 10/15/09 22:42
Lasvar Chena pond 10/15/09 22:42
Lasvar Chena pond 10/15/09 22:44
Lascin Chena pond 10/15/09 22:46
Lascin Chena pond 10/15/09 22:49
Tadbra Chena pond 10/15/09 22:49
Lascin Chena pond 10/15/09 22:50
Lascin Chena pond 10/15/09 22:51
Lascin Chena pond 10/15/09 22:53
Lascin Chena pond 10/15/09 22:54
Lascin Chena pond 10/15/09 22:57
Lasvar Chena pond 10/15/09 23:01
Lasvar Chena pond 10/15/09 23:06
Lascin Chena pond 10/15/09 23:08
Lasvar Chena pond 10/15/09 23:09
Tadbra Chena pond 10/15/09 23:14
Myochi Chena pond 10/15/09 23:30
Myochi Chena pond 10/15/09 23:31
Lasvar Chena pond 10/15/09 23:33
Myochi Chena pond 10/15/09 23:35
Myochi Chena pond 10/15/09 23:35
Myochi Chena pond 10/15/09 23:38
Lasvar Chena pond 10/15/09 23:39
Lasvar Chena pond 10/15/09 23:44
Tadbra Chena pond 10/15/09 23:45
Lasvar Chena pond 10/15/09 23:47
Lasvar Chena pond 10/15/09 23:52
Lasvar Chena pond 10/15/09 23:59
Tadbra Chena pond 10/16/09 0:00
More information about the R-help
mailing list