I am searching for AICC/HACP sample packages on internet, but i didn't find any.
Can any one please provide sample packages repository for AICC/HACP.
Related
I have some problems with creating package, can you please spot my mistake?
I followed instruction below :
1.Create functions I want in my package
2.Open new project -> R package
3.Create as many R documentation as many functions I implemented, and then put them into man folder
4.Press Ctr+Shift+B to install package.
The warning I'm facing is
Warning: C:/Program Files/R/R-3.6.3/library/mypackage/man/myfun2.Rd:62: All text must be in a section
I search internet about solution to that problem but I found only involved instructions containing other approach. Is there possibility how to fix this ? Or other approach with using other packages is crucial (as roxygen).
Thanks in advance
You should not write the manual pages yourself. You should use roxygen code to write the manual elements in your function R files, then use devtools::document() to generate the manual pages. See here for examples: https://keithmcnulty.github.io/r_package_training/index.html#1
I am trying to install a package from my own repository in order to test if the functions work. The link to the repository is here: https://github.com/hharder74/SampleMeansII. When I try to install it using the following code:
devtools::install_github("hharder74/SampleMeansII")
I get the following error:
Error: Failed to install 'unknown package' from GitHub: HTTP error 404. Not Found Did you spell the repo owner (`hharder74`) and repo name (`SampleMeansII`) correctly? - If spelling is correct, check that you have the required permissions to access the repo.
I am really confused on where this error is coming from. This is my first time trying to upload a package to GitHub, and I just wanted to check if the package can be installed before I turned it in to my teacher. Here is a bit of code to test the functions if anyone needs it:
vec <- runif(100)
sample_mean(vec, 50)
many_sample_means(vec, reps = 10, n = 50)
sample_means_ns(vec, reps = 10, ns = c(5, 50, 500))
You have not yet created a package. You've just created some files with R code in them. An R package has a very particular structure that includes things like a DESCRIPTION file and a NAMESPACE file. In theory you could create these yourself, but often it's easier to use things like devtools::create and roxygen to create them for you. Or if you are using RStudio, you can create a new R Package project with default versions of these files.
To add a DESCRIPTION File, try running
usethis::use_description()
That will fill in defaults you can change.
Then you will need to create a NAMESPACE file. If you just want to make all the functions you define inside your R files to be available outside the pacakge, you can just put
exportPattern("^[[:alpha:]]+")
in that file and that should work.
You might also consider following guides like thoses http://r-pkgs.had.co.nz/package.html or https://swcarpentry.github.io/r-novice-inflammation/08-making-packages-R/ for a better overview on creating a package.
Once your repo looks like a proper R package, then you can use devtools::install_github to install it.
Note that github can be useful for tracking changes to any types of files. You may perform an analysis in an R script that you would like to track changes for and save that on github but it may not make sense to turn that analysis script into a packages. You generally make packages when you want to reuse functions or data across different projects then those projects can install and load your package. So not all R code lives inside an R package, but devtools::install_github can only be used to install actual packages.
I have created a package in R. It is all fully documented and written according to R package guidelines. I have used devtools to generate documentation.
document("/home/rstudio/EndoMineR/")
However when I try to use ?EndoMineR I get the error:
No documentation for ‘EndoMineR’ in specified packages and libraries:
you could try ‘??EndoMineR’
How can I create the help files for my package? What am I likely to be missing?
As additional information, when I click the package name in R studio I get the help files but not if I try ?EndoMineR. Also the .Rd files in the man directory (which I think is what devtools::document() generates) seem to be updating just fine. I assume the ?EndoMiner accesses the man files so I'm not sure why this folder is not accessible (it is top level)
For offline linux machines without Internet, installing R packages with lots of dependencies is a nightmare. I found couple of posts in SE discussing on how to create a local folder, copy desired package zip files and install using 'install.packages'.
However, finding, downloading, and uploading lots of packages to an offline server is a time-consuming effort. So, I am wondering how can I download the entire zip file of all CRAN packages so I can put them in a http web server directory in my local offline machine and act like a real repository. The size probably will be very big around 200 GB, but for corporate environment, I think it should make sense.
I found a guide here discussing how to become an official CRAN mirror, but I am not going to be an official public mirror.
Please advise.
Thanks in advance
You can use the function available.packages to find the available packages.
pkgnames <- available.packages()[,1]
If you like web scraping you can practice as follows.
library(rvest)
pkgs <- read_html("https://cran.r-project.org/web/packages/available_packages_by_name.html")
tab <- html_nodes(pkgs, "table") %>% html_table(fill = TRUE)
pkgnames <- tab[[1]][1]$X1
pkgnames <- pkgnames[nchar(pkgnames)>0]
DON'T RUN THESE UNLESS YOU WANT TO INSTALL (OR DOWNLOAD) A LOT OF PACKAGES!!
#sapply(pkgnames, install.packages)
#sapply(pkgnames, install.packages)
You can run this line to show that it works.
sapply(pkgnames[1:2], install.packages)
You can replace the install.packages with download.packages along with the destdir argument to save it to your corporate directory.
I have see a setup in someones .Rprofile
options(repos = c(CRAN = "http://streaming.stat.iastate.edu/CRAN",
CRANextra = "http://www.stats.ox.ac.uk/pub/RWin"))
How many CRANextra mirror in the world?
is there only one CRANextra mirror in the world?
The stated reason for offering a bounty is "Looking for an answer drawing from credible and/or official sources."
I would have thought that #JoshuaUlrich is a credible source, but since you're still looking for an answer, I would like to point you to http://stat.ethz.ch/CRAN/doc/FAQ/R-FAQ.html#Add_002don-packages-from-CRAN
At the end of that section of the R-FAQ, there is this paragraph:
Some CRAN packages that do not build out of the box on Windows, require additional software, or are shipping third party libraries for Windows cannot be made available on CRAN in form of a Windows binary packages. Nevertheless, some of these packages are available at the "CRAN extras" repository at http://www.stats.ox.ac.uk/pub/RWin/ kindly provided by Brian D. Ripley. Note that this repository is a default repository for recent versions of R for Windows.
While it doesn't explicitly state that this is the only "CRAN extras" repository, as it receives special mention on the official help page for the Comprehensive R Archive Network, in the section that describes the add-on packages from CRAN, I think this can be treated as an official source justifying Joshua's comment.
I think Joshua is right, but if you have a project you are working on from multiple machines, you might consider setting up your own as this asker did.
local({r <- getOption("repos");
r["CRANextra"] <- "pathtoCRANextraBasedir/"
options(repos=r)})