Functions from my own developed library not working
1
0
Entering edit mode
b.nota ▴ 360
@bnota-7379
Last seen 3.6 years ago
Netherlands

Hello,

I created some functions and try to build a package/library, but run into some problems. I hoped to get some advise here on this support site.

This is how I tried to built my package.

I had some functions in an R file, including roxygen2 comments.

Then in R

library("devtools")

library(roxygen2)

setwd("C:to/my/directory")

create("myPackage")

Then I put my functions file in the R folder and changed the DESCRIPTION file.

setwd("./myPackage")

document()

setwd("..")

install("myPackage")

library(myPackage)

Then, when I want to see how a function works

?function1

I see the documentation in my browser.

But when I want to use my function I get an error.

function1
Error: object 'function1' not found
function1()
Error: could not find function "function1"

Does anyone know what I am doing wrong? I am using R 3.3.1 on Windows 7.

Your help or comments are appreciated, thanks in advance!

Ben

 

 

 

 

R • 602 views
ADD COMMENT
2
Entering edit mode
@martin-morgan-1513
Last seen 3 days ago
United States

This is not a general R support site; please ask on StackOverflow or elsewhere. Likely people need to see your source code; consider developing your package on github and  including a link to the repository in your question.

Did you remember to add the @export tag to your function?

ADD COMMENT
0
Entering edit mode

Yes you are right Martin, it was not a bioconductor question. But since so many R knowledge is present at this site I thought of this site first.

BTW. I wasn't aware of the @export tag, and it worked. Thanks!

ADD REPLY

Login before adding your answer.

Traffic: 952 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6