Dear all,

I have a data similar to this:

myframe<- data.frame (ID=c("Ernie", "Ernie","Ernie","Ernie"),
Timestamp=c("24.09.2012 08:00", "24.09.2012 09:00", "24.09.2012 10:00",
"25.09.2012 10:00"), Longitude=c("8.481","8.482","8.483","8.481"),
Latitude=c("54.753","54.753","54.752","54.751")
)
myframe

# Now this is where my loop is supposed to start. In this example I want to run the following functions 3 times. (In real life more often.) How do I do that?

library(adehabitatHR)
library(rgdal)
mysample <- myframe[sample(1:nrow(myframe), 3,replace=FALSE),]
mysample
mysampletime <- as.POSIXct (strptime(as.character(mysample$Timestamp), "%d.%m.%Y %H:%M"), tz="GMT") mysamplexy <- project (cbind (mysample$Longitude, mysample$Latitude), "+proj=utm +zone=32 +ellps=WGS84")
colnames(mysamplexy) <- c ("xCord", "yCord")
ID <- mysample$ID
datltraj <- as.ltraj(mysamplexy, mysampletime, id=ID)
Ddat <- BRB.D(datltraj, Tmax=21600, Lmin=36)
BRBdat <- BRB(datltraj, D= Ddat,type=c("UD"),Tmax=21600,Lmin=36, hmin=100)
kernel.area(BRBdat, unout=c("km2"))

# unfortunately my data are not a very good example. Sorry about that. But I guess you know what I mean.

# Because I wish to run the functions three times I do want a data frame (or matrix) in the end, which includes the results (kernel areas): That means 12 columns and the three lines.

# How do I do that?

Many thanks in advance,

Tagmarie

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to