Creating a Markov chain

Hi guys
Please assists I'm creating a Markov chain using the function "new" but everytime I run that line of code my rStudio stops working. there is a stop sign as if I am loading a package and it never goes away. I have tried to restart multiple times but still doesn't work.

MCcriminal <- new("markovchain", states = Statelbls, transitionMatrix = P)

What package/library are you trying to use ?

1 Like

The only library is; library(markovchain)
and I did install the package markovchain

can you run the default new markovchain function to completion ?

new("markovchain")

So I decided to switch computers and now I'm getting an error message;

criminals <- new("markovchain", states = Statenames, transitionMatrix = P)
Error in FUN(X[[i]], ...) :
function 'Rcpp_precious_remove' not provided by package 'Rcpp'

In that case I would reinstall Rcpp before trying again

This got me to the same problem. I will uninstall rStudio and download the latest version. hope that helps and will update you. thanks for being so kind

RStudio has nothing to do with your R package library, most likely you are not updating Rcpp corretly or you need to remove it and then reinstall it.

1 Like

No that did not work as well

new("markovchain")
Error in getClass(Class, where = topenv(parent.frame())) :
“markovchain” is not a defined class

I am currently using the cloud version of rStudio and I have no issues there. So clearly there must be a problem with the rStudio installed.

I am currently using the cloud version of rStudio and I have no issues there. So clearly there must be a problem with the rStudio installed.

I understand why you might think that but as andresrcs hinted at. Rstudio is an Integrated Development environment for R, that makes it convenient to program in R, but is seperate and distinct from R itself.
In fact if you go to Rstudio's Tools menu, General , you will see a box to select the R version to use.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.