Hi all, I am revisiting using reshape2 to aggregate critter (bats) occurrences by time blocks and have the final output for each row sum a percentage such that the row sums total 1 (100%).
Reshape2 library is loaded on start. The old code I had stored in NotePad++ seems to no longer work as I have the following error: > input.cast <- cast(input.melt, Species ~ Date, fun.aggregate = sum) *Error: could not find function "cast"* The code saved in NotePad++ is: require(reshape2) input.melt <- melt(input) input.cast <- cast(input.melt, Species ~ Date, fun.aggregate = sum) input.percent <- input.cast[, -1] / rowSums(input.cast[, -1]) * 100 rownames(input.percent) <- input.cast[,1] The data is read in OK: >Escameca_temporal <- read.table("C:/=Bat data working/=Nica_new/Escameca_temporal.CSV",header=T,sep=",",quote="") #then renamed : >input <-Escameca_temporal The variable view shows Species (6 letter text code) as Factor;Location code as integer; Date as Factor; Time as Factor. Data looks like this (sub sample only) Species Location Date Time Cynmex 4937 5/3/2012 23:42 Cynmex 4937 5/3/2012 23:43 Cynmex 4937 5/3/2012 23:43 Eptfur 4937 5/2/2012 0:10 Eptfur 4937 5/2/2012 0:12 Eptfur 4937 5/2/2012 0:15 Eptfur 4937 5/2/2012 0:16 Eptfur 4937 5/2/2012 0:21 Eptfur 4937 5/2/2012 0:27 Eptfur 4937 5/2/2012 0:27 Eptfur 4937 5/2/2012 0:36 Eptfur 4937 5/2/2012 0:37 Eptfur 4937 5/2/2012 0:38 Eptfur 4937 5/2/2012 0:42 Eptfur 4937 5/2/2012 0:57 Eptfur 4937 5/2/2012 0:58 Eptfur 4937 5/2/2012 0:59 Eptfur 4937 5/2/2012 1:01 Eptfur 4937 5/2/2012 1:03 Eptfur 4937 5/2/2012 1:08 Eptfur 4937 5/4/2012 2:02 Eptfur 4937 5/4/2012 2:03 Eptfur 4937 5/4/2012 2:03 Eptfur 4937 5/4/2012 2:04 Eptfur 4937 5/4/2012 2:04 Eptfur 4937 5/4/2012 2:08 Eptfur 4924 1/8/2012 2:09 Eptfur 4937 5/4/2012 2:09 Eptfur 4924 1/8/2012 2:10 Eptfur 4924 1/8/2012 2:10 Eptfur 4924 1/8/2012 2:10 Eptfur 4924 1/8/2012 2:10 Eptfur 4924 1/8/2012 2:11 Eptfur 4924 1/8/2012 2:11 Eptfur 4924 1/8/2012 2:11 Eptfur 4924 1/8/2012 2:11 Eptfur 4924 1/8/2012 2:11 Eptfur 4924 1/8/2012 2:12 Eptfur 4924 1/8/2012 2:12 Eptfur 4924 1/8/2012 2:12 Eptfur 4924 1/8/2012 2:12 Eptfur 4924 1/8/2012 2:12 Eptfur 4924 1/8/2012 2:13 Eptfur 4924 1/8/2012 2:13 Eptfur 4937 5/4/2012 2:13 Eptfur 4924 1/8/2012 2:14 Eptfur 4924 1/8/2012 2:14 Eptfur 4924 1/8/2012 2:14 Eptfur 4924 1/8/2012 2:14 Eptfur 4937 5/4/2012 2:14 Eptfur 4924 1/8/2012 2:15 Eptfur 4924 1/8/2012 2:15 Eptfur 4924 1/8/2012 2:15 Eptfur 4924 1/8/2012 2:16 Eptfur 4924 1/8/2012 2:16 Eptfur 4924 1/8/2012 2:16 Eptfur 4924 1/8/2012 2:16 Eptfur 4924 1/8/2012 2:17 Any suggestions-help appreciated. Bruce [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.