This question already has answers here:
Reading data in R from package
(2 answers)
Closed 8 years ago.
I am new to world of R.I have loaded a dataset using following command
install.packages("gcookbook")
library(gcookbook)
gcookbook have few datasets.what is the command in R to see all those data sets inside it?
You can see all datasets in a package by running data(package = "gcookbook") or simply data() if you want to see all currently available datasets ordered by package. You can read more about this command if you type ?data
Related
This question already has answers here:
Rcpp package doesn't include Rcpp_precious_remove
(2 answers)
Closed 1 year ago.
I am trying to read a file into r and I keep getting this error. All of my libraries are installed and loaded. It is a spreadsheet with 2 sheets and I only want data from the second sheet.
read.xlsx(dataUrl, sheet = 2)
Error in getChildlessNode(xml = workbookRelsXML, tag = "Relationship") :
function 'Rcpp_precious_remove' not provided by package 'Rcpp'
You have to install the Rcpp package first:
install.packages('Rcpp')
library('Rcpp')
read.xlsx(dataUrl, sheet = 2)
This question already has answers here:
Load R package from character string
(2 answers)
Closed 6 years ago.
I would like to install/load packages from a different location that is default. I dont have admin privileges so I cant access my .rprofile from the control panel.
My thought was I could just make a different library function, so I dont have to type a lib.loc statement every time i want to install/load a function. This is what i think the "liBerty" function should look like.
liBerty <- function(a) {
require(a,lib.loc="C:\\Users\\bert\\Documents\\rpackages" )
}
liBerty(tm)
The error I am getting states "there is no package 'a'.". Is there a way i can write this function to accomplish my task?
The function needs to also be modified for installing packages
install.Bertages<-function(b){
install.packages(b,lib="C:\\Users\\bert\\Documents\\rpackages")
}
liBerty<-function(a){
require(a,lib.loc="C:\\Users\\bert\\Documents\\rpackages",
character.only=TRUE )
}
install.Bertages("lubridate")
liBerty("lubridate")
This question already has answers here:
How to find all functions in an R package?
(6 answers)
Closed 7 years ago.
I would like to know if there is a command, using which one can view all the functions that are built into an R package.
For example, let's say I loaded a package into environment:
require(dplyr)
Now, I would like to get a list of all the functions present in the dplyr package.
Is there any way to get such a list?
You can use lsf.str.
For instance:
lsf.str("package:dplyr")
To list all objects in the package use ls
ls("package:dplyr")
Note that the package must be attached.
To see the list of currently loaded packages use
search()
Alternatively calling the help would also do, even if the package is not attached:
help(package = dplyr)
Finally, you can use RStudio which provides an autocomplete function. So, for instance, typing dplyr:: in the console or while editing a file will result in a popup list of all dplyr functions/objects.
This question already has answers here:
Possible to create Rd help files for objects not in a package?
(7 answers)
Closed 7 years ago.
I need to generate documentation for a collection of R programs. Unfortunately, building a package based on the source code is not an option (I know how to do that, and I have already experimented with RStudio, roxygen2, and packages, and it works like a charm). Can I use roxygen2 to to generate documentation from the R source code without building a package in a way similar to how doxygen works with C++? If not, are there other options for documenting R code that do not rely on packages?
If your only after the documentation, devtools::document() will build the documentation files without building the package.
This question already has answers here:
How can I view the source code for a function?
(13 answers)
Closed 8 years ago.
I used the packages "tm", "lda" and "topicmodels" in R.
Is there open source code for these packages (in other language(s)) so that I could modify the core??
Every package on CRAN (the main R archive) has a link to the source code. e.g.
http://cran.r-project.org/web/packages/lda/index.html
lists:
Reference manual: lda.pdf
Package source: lda_1.3.2.tar.gz
MacOS X binary: lda_1.3.2.tgz
Windows binary: lda_1.3.2.zip
Old sources: lda archive
download the package source, extract it (7-zip will extract tar.gz archives on Windows, I think) and there will be the source code.