Commit c038a867 authored by kunstler's avatar kunstler
Browse files

add error message for select one census

parent fa9ac3ac
......@@ -221,6 +221,7 @@ return(data)
select.one.census.per.plot <- function(df){
require(dplyr)
cat(dim(df))
df <- df %>% mutate(plot.c = paste(plot, census))
df.select <- df %>%
sample_n(., nrow(df)) %>% group_by( plot) %>%
......@@ -228,6 +229,8 @@ select.one.census.per.plot <- function(df){
dplyr::select(plot.cs)
plots.select <- as.vector(df.select$plot.cs)
df2 <- filter(df, plot.c %in% plots.select)
print(dim(df2))
if(!(nrow(df2) < nrow(df))) stop('selection census error')
return(df2)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment