Package "rpart" installed but cannot run in RStudio

I really need a R expert for help.

I just installed the package "rpart" successfully but I got the following error message when I ran "rpart".

treemodel <- rpart(Species~., data=iristrain)
Error in rpart(Species ~ ., data = iristrain) :
could not find function "rpart

What should I do in order to run the package "rpart"? It is necessary to modify the content in "Renviron" file? However, I cannot find the "Renivron" file in Windows. What should I do in order to create the "Renviron" file in Windows?

Thanks!

Best regards,
CC Wong

If you get that message then maybe you haven't installed rpart successfully as you think or you have forgot to load it. Do you get any error message when you load the package?

library(rpart)

Dear Andresrcs,

Yes, you are right. I forgot to load the "rpart" by library(rpart).

Thanks a lot!

Best regards,
CC Wong

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.