Skip to content

Commit

Permalink
solves and closes #28
Browse files Browse the repository at this point in the history
  • Loading branch information
romunov committed Oct 16, 2017
1 parent 8e55bb4 commit aa9f33b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ populatePolygonPopup <- function(x) {
<dt>First record: %s</dt>
<dt>Last record: %s</dt>
<dt>Sex: %s</dt>
<dt>Known parents: No data</dt>
<dt>Known parents: %s</dt>
<dt>Num. of samples: %s</dt>",
unique(x$animal),
min(x$date),
max(x$date),
unique(x$sex),
unique(x$label),
nrow(x))
)
out
Expand Down
15 changes: 13 additions & 2 deletions R/map_add_mcp.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,26 @@ observe({

if (mcpIn) {
# get data for all selected animals, adult and otherwise
offInput <- input$offspring
# prepare parents data
parent <- wolfPicks()
xy <- addParentageData(x = parent, parents = inputFileParentage())

if (length(input$animals) > 0) {
parent <- xy[(xy$animal %in% input$animals), ]
} else {
parent <- xy[0, ]
}

if (nrow(parent) < 1) {
return(NULL)
}

parent$class <- "parent"

offspring <- fOffs()[fOffs()$animal %in% offInput, ]
# prepare offspring data
offspring <- fOffs()[fOffs()$animal %in% input$offspring, ]
offspring <- addParentageData(x = offspring, parents = inputFileParentage())

if (nrow(offspring) > 0) {
offspring$class <- "offspring"
xy <- do.call(rbind, list(parent, offspring))
Expand Down

0 comments on commit aa9f33b

Please sign in to comment.