markovchain
markovchain copied to clipboard
Methods in Rcpp should stop if string parameter is not among allowed ones
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")
Related read: http://adv-r.had.co.nz/C-interface.html#c-input-validation