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?


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?


Dear Andresrcs,

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

Thanks a lot!

Best regards,
CC Wong