htmlwidgets can not find function without :::namespace

I am trying to make my first htmlWidget. I followed the below steps and created my widget:

library(htmlwidgets)
library(devtools)

setwd("C:/R/Package")

devtools::create("myPackage")

setwd("C:/R/Package/myPackage")

htmlwidgets::scaffoldWidget("myPackage")

When I install the package and try to execute the myPackage("Hello World") function I get the error "Can not find function "myPackage" " It will only execute when I use myPackage:::myPackage("Hello World"). Why do I need to add the :::namespace tag?

devtools::install()
library(myPackage)
myPackage("Hello World")

Functions in packages can be either exported or non exported.
Exported functions use :: non exported:::
Your function is non exported , if you made it an exported function it would then work like most functions you are probably most familiar with.

Thanks a lot. After trying multiple things my problem was solved by running devtools::document() after the creation of the package.

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.