Data structure unmarkedFramePCO

56 views
Skip to first unread message

Pat Taggart

unread,
Oct 18, 2019, 6:49:56 AM10/18/19
to unmarked
Hi All,

Thanks in advance for any and all help.

I have 22 sites. My primary sampling periods are made up of 29 year x season combinations, 2011-2018 with 4 seasons each year except 2018 which only has 1 season. Within each primary sampling period I have 3 replicate animal counts.

I have created a UMF using unmarkedFramePCO() but am concerned that the structure of my 3 data frames (y, siteCovs and yearlySiteCovs) must be wrong as when I ask for a summary of my UMF i get the below, suggesting an incorrect number of secondary sampling periods and an incorrect number of max and mean observations per site.

unmarkedFrame Object

22 sites
Maximum number of observations per site: 1 
Mean number of observations per site: 1 
Number of primary survey periods: 29 
Number of secondary survey periods: 0.03448276 
Error in FUN(newX[, i], ...) : 
  (list) object cannot be coerced to type 'double'

I have been at this for a couple of days now and thought i was getting somewhere...... any advice on where I have gone wrong and how my data frames should be restructured would be very much appreciated. 

Please find attached my 3 data frames and below my code.

Pat

#load data
y <- read.csv("count_dat_wide_format.csv", header = TRUE)
head(y)

siteCovs <- read.csv("siteCovs.csv", header = TRUE)
head(siteCovs)

yearlySiteCovs <- read.csv("yearlySiteCovs2.csv", header = TRUE)
head(yearlySiteCovs)

#define y, siteCovs and yearlySiteCovs for creating UMF 
y <- matrix(y[1:22,])

siteCovs <- siteCovs[1:22,]

year <- yearlySiteCovs[1:22, 1:29]
season <- yearlySiteCovs[1:22, 30:58]
distance <- yearlySiteCovs[1:22, 59:87]
yearlySiteCovs <- list(year = year, season = season, distance = distance) 
  
#create UMF
umf <- unmarkedFramePCO(y = y, siteCovs = siteCovs, yearlySiteCovs = yearlySiteCovs, numPrimary = 29)

#take a look at UMF
summary(umf)


This message is intended for the addressee named and may contain confidential information. If you are not the intended recipient, please delete it and notify the sender. Views expressed in this message are those of the individual sender, and are not necessarily the views of their organisation.
siteCovs.csv
yearlySiteCovs2.csv
count_dat_wide_format.csv
siteCovs.csv

Richard Chandler

unread,
Oct 18, 2019, 6:58:21 AM10/18/19
to Unmarked package

Hi Pat,

It seems to work if you remove this line:

y <- matrix(y[1:22,])

Richard


--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/unmarked/e87255de-5921-4dae-a0a2-1f977fadd00f%40googlegroups.com.

Pat Taggart

unread,
Oct 20, 2019, 5:37:26 PM10/20/19
to unmarked
Thanks Richard, this is very much appreciated. Such a simple fix!!
Reply all
Reply to author
Forward
0 new messages