I've been writing a lot of code for my personal use and finally reached a point where I realised I should really be including this all in a package which I can load in instead of copy and pasting it in each time.
I followed the following tutorial for the creation of a basic package.
https://hilaryparker.com/2014/04/29/writing-an-r-package-from-scratch/
As far as I can tell everything went well with the actual creation element. Here are screenshots of the result:
The cats folder:
The /cats/R folder
The /cats/man folder
The problem comes when I want to run the line:
install("cats")
When I try to do that I get the following error:
Installing cats
"C:/PROGRA~1/R/R-33~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "/Documents/cats" --library="C:/Users/Aodhán/Documents/R/win-library/3.3" --install-tests
* installing *source* package 'cats' ...
Warning in file(file, if (append) "a" else "w") :
cannot open file 'C:/Users/Aodhán/Documents/R/win-library/3.3/cats/DESCRIPTION': No such file or directory
Error in file(file, if (append) "a" else "w") :
cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'cats'
* removing 'C:/Users/Aodhán/Documents/R/win-library/3.3/cats'
Error: Command failed (1)
This error happens for my own package, but it also happens if I run the command:
devtools::install_github("klutometis/roxygen")
Any advice would be appreciated.
EDIT: Could it be that my username contains the character á in it?
EDIT 2:The DESCRIPTION file is:
Package: cats
Title: What the Package Does (one line, title case)
Version: 0.0.0.9000
Authors@R: person("First", "Last", email = "first.last@example.com", role = c("aut", "cre"))
Maintainer: Aodhán O'Leary
Author: Aodhán O'Leary [aut, cre]
Description: What the package does (one paragraph).
Depends: R (>= 3.3.1)
License: What license is it under?
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
Sys.getenv("R_HOME")
returns "C:/PROGRA~1/R/R-33~1.1"
Sys.getenv("R_LIBS_USER")
returns "C:\Users\Aodhán\Documents/R/win-library/3.3"
Sys.getenv("R_HOME")
returns "C:\Users\Aodhán\Documents"
devtools::build("cats")
creates "cats_0.0.0.9000.tar.gz"
install.packages("../cats_version.tar.gz")
returns the same error as above
Note: This is on a Win10 machine, using R 3.3.1, which I apologise for not mentioning up top. I was quite tired when writing the post yesterday.
Edit 3: Here's the result of using the following commands: R CMD build cats
followed by R CMD check cats
00check:
- using log directory 'C:/Users/Aodhán/Documents/cats.Rcheck'
- using R version 3.3.1 (2016-06-21)
- using platform: x86_64-w64-mingw32 (64-bit)
- using session charset: ISO8859-1
- checking for file 'cats/DESCRIPTION' ... OK
- this is package 'cats' version '0.0.0.9000'
- package encoding: UTF-8
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for .dll and .exe files ... OK
- checking for hidden files and directories ... NOTE Found the following hidden files and directories: .gitignore These were most likely included in error. See section 'Package structure' in the 'Writing R Extensions' manual.
- checking for portable file names ... OK
- checking whether package 'cats' can be installed ... ERROR Installation failed. See 'C:/Users/Aodhán/Documents/cats.Rcheck/00install.out' for details.
- DONE
Status: 1 ERROR, 1 NOTE
00install.out
- installing source package 'cats' ...
Warning in file(file, if (append) "a" else "w") : cannot open file 'C:/Users/Aodhan/Documents/cats.Rcheck/cats/DESCRIPTION':
No such file or directory
Error in file(file, if (append) "a" else "w") : cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'cats'
- removing 'C:/Users/Aodhán/Documents/cats.Rcheck/cats'