Skip to content

Commit

Permalink
biplot handles pom with a single non-NA point
Browse files Browse the repository at this point in the history
  • Loading branch information
josephguillaume committed Mar 15, 2018
1 parent 92d9859 commit 8a6e8ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/biplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
biplot=function(pom,ranges,flip=FALSE,text_overlay=TRUE,
ordered_scens,...){
## Remove NAs, i.e. no crossover found
pom<-pom[!apply(pom,1,function(x) any(is.na(x))),]
pom<-pom[!apply(pom,1,function(x) any(is.na(x))),,drop=FALSE]
if(nrow(pom)==0) stop("No breakeven points found for the variables selected")

ranges=as.data.frame(ranges)
Expand All @@ -16,7 +16,7 @@ biplot=function(pom,ranges,flip=FALSE,text_overlay=TRUE,
}
wvars <- match(c(v1,v2),ranges$Variable)

perc.to.limit <- apply(pom[,c(v1,v2)],1,function(x) max(getNormalised(x,ranges$Best[wvars],ranges$Min[wvars],ranges$Max[wvars])))*100
perc.to.limit <- apply(pom[,c(v1,v2),drop=FALSE],1,function(x) max(getNormalised(x,ranges$Best[wvars],ranges$Min[wvars],ranges$Max[wvars])))*100

p=ggplot(aes(x=x1,y=x2),data=data.frame(x1=pom[,v1],x2=pom[,v2],level.of.concern=100-perc.to.limit))+
geom_point(aes(color=level.of.concern))+
Expand Down

0 comments on commit 8a6e8ae

Please sign in to comment.