markovchain icon indicating copy to clipboard operation
markovchain copied to clipboard

Methods in Rcpp should stop if string parameter is not among allowed ones

Open ncordon opened this issue 5 years ago • 1 comments

For example, for markovchainFit we have the parameter method, which should only take values mle, bootstrap, laplace or map, but that is not checked and the following code will give an unexpected output:

c1<-c("a","b","c","c","e") 
c2<-c("a","b","d","e") 
c3<-c("a","c","b","c","d") 
c4<-c("a","b","b","d","b","c","d","e") 
c5<-c("a","c","c","d","d") 
c6<-c("a","c","d","d","b","b","e") 

mylist<-list(c1,c2,c3,c4,c5,c6)
mylistMc<-markovchainFit(data=mylist, method = "other")

ncordon avatar Feb 03 '19 18:02 ncordon

Related read: http://adv-r.had.co.nz/C-interface.html#c-input-validation

ncordon avatar Feb 05 '19 00:02 ncordon