installing a package from local file, errors invalid octal digit and non-zero exit status

hello R community,

I am a relative novice. I work in RStudio, updated to the most recent version 4.0.3; my laptop machine runs Windows 10.

The problem: I need to use some code written for a university statistics course. They provide the code, and I copied their file saved it. It is an R file called "colMatches.r". It is not available from a repository, so I want to load it from the local file that I have. I found and ran the function install.packages as instructed for a local file, checking carefully that I have the right file path. There are two warnings: one for an invalid octal digit, the other for a non-zero exit staus. See below the results from my console.

install.packages("C:/Users/Chris/Documents/colMatches.r", repos=NULL, type="source")
Installing package into ‘C:/Users/Chris/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Error in getOctD(x, offset, len) : invalid octal digit
Warning in install.packages :
installation of package ‘C:/Users/Chris/Documents/colMatches.r’ had non-zero exit status

I have little experience, so any advice about what these errors mean and how I can correct them would be very helpful. Thanks,

piggly.wiggly

Hello @piggly,

So I am pretty sure that this in fact not a package you're dealing with but an R script. You should be able to open up the file with the following command to run:

source("colMatches.r")

Otherwise you can open the file in Rstudio directly and see what is within it.

Thanks GreyMerchant, you were exactly correct.

I applied the source() function in the R console showed and colMatches appeared in the environment pane of RStudio. I suppose it will now be active when I am doing the calculations necessary for my statistics course.

Now, when I want to use the colMatches function, do I need to perform that source command each time to get it into the environment, or can I turn it into something that is loaded stably as a package would be?

Thanks for the help that will keep me moving forward. And I really need to.

Great :slight_smile: Feel free to mark it as the solution to your initial problem.

As long as you are currently in that instance you can simply use that function. You only need to read it once into your global environment and then it is active. If you clear the session or close etc you will have to read it in again. You can see if it is in your session by looking for its name in the environment tab (typically top right)

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.