Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions R/MakeBinomStack.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ MakeBinomStack=function(data, observs, tag="points", intercept=TRUE, mesh, presn
if(length(presname)>1) stop("more than one name given for presences column")
if(length(trialname)>1) stop("more than one name given for number of trials column")
if(!presname%in%names(observs@data)) stop(paste(presname," not in names of presences data frame", sep=""))
if(!is.logical(observs@data[,presname]) & !trialname%in%names(observs@data))
if(!is.logical(observs@data[[presname]]) & !trialname%in%names(observs@data))
stop(paste(trialname," not in names of presences data frame", sep=""))

if(is.null(coordnames)) coordnames <- colnames(data@coords)
Expand All @@ -43,7 +43,7 @@ MakeBinomStack=function(data, observs, tag="points", intercept=TRUE, mesh, presn
}

# If presences are Boolean, reformat
if(is.logical(observs@data[,presname])) {
if(is.logical(observs@data[[presname]])) {
observs@data[,presname] <- as.integer(observs@data[,presname])
observs@data[,trialname] <- rep(1, nrow(observs@data))
}
Expand Down