Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8589475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:03:58+00:00 2026-06-11T23:03:58+00:00

I am writing a script that uses roxygen2 to automatically roxygenize my package. I’d

  • 0

I am writing a script that uses roxygen2 to automatically roxygenize my package. I’d like it to be executable so that it can be part of a larger script to prepare and install the package, but I cannot make it work with Rscript for some reason.

Here is the code:

#!/usr/bin/env Rscript
library(roxygen2)
roxygenize('.', copy=FALSE)

This works correctly if I start an interactive R session or if I submit the code using R CMD BATCH. However, I get this output and error if I run the script directly as an executable via Rscript (and I get the error regardless of whether the script is in the current directory or bin).

bin/roxygenize.R 
Loading required package: digest
Warning message:
package 'roxygen2' was built under R version 2.13.2 
Error in parse.files(r_files) : could not find function "setPackageName"
Calls: roxygenize -> parse.files
Execution halted

It looks like setPackageName is in base R, so I can’t figure out why it’s not there. Additionally, I use Rscript in lots of other situations and this seems to be the only place that it fails.

Any help is much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:03:59+00:00Added an answer on June 11, 2026 at 11:03 pm

    Explicitly load the packages methods and utils before loading roxygen2 and calling roxygenize().

    #!/usr/bin/env Rscript
    library(methods)
    library(utils)
    library(roxygen2)
    roxygenize('.', copy=FALSE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Groovy script which uses third party java code that I can't
I am writing a script that uses a temporary directory, and I would like
I am writing a bash script that uses calling syntax script [options] [dir] To
I'm writing a python script that uses subprocess.Popen to execute two programs (from compiled
I am writing a Python script that uses data of dubious quality. The data
I'm interested in writing a very generic script that I can include into my
I'm writing a script that uses a series of complex Imagemagick commands in python.
I'm writing a python script that scrapes a website, where the website uses OpenID
I'm writing a fairly simple register php script that uses PHP's built in mail()
I am writing a Nautilus script that uses curl to GET/POST with a REST

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.