Meaning of :: syntax [duplicate] - r

This question already has answers here:
R: What do you call the :: and ::: operators and how do they differ?
(1 answer)
What are the double colons (::) in R?
(2 answers)
Closed 3 years ago.
I am new to R, when reading functions documentation how do I interpret ::?
How do I actually read the syntax?
readxl::read_excel()
Not sure if in R studio I can find any information about

In R there are different packages available,
"readxl" is one of them.
When you install a package, you are ready to use its functionalities.
If you just need a sporadic use of a few functions or data inside the
package you can access them with the notation packagename::functionname().
For example, since you have installed the readxl package, you can explore one of its functionality called read_excel() to import/read excel sheet.
Command to check what functions and data are contained in a package.
help(package = "packageName")

Related

How to find how many functions does a package in R have? e.g. how many functions does "MASS" package has? [duplicate]

This question already has answers here:
How to find all functions in an R package?
(6 answers)
Closed 3 years ago.
I want to know how many functions does "MASS" package has? Could you please tell me a command that I can use to know this information?
after you load MASS library, try this:
length(ls('package:MASS')) to get a count of all objects
use mode param ls.str() to change what you get back:
for functions: length(ls.str('package:MASS', mode='function'))

R - Encrypt / Lock Down R Code and Package [duplicate]

This question already has answers here:
Protect/encrypt R package code for distribution [closed]
(2 answers)
Closed 5 years ago.
Is it possible to create an R package such that if I give it to a user, they could run all the functions within the package, but not be able to view any of the source code?
The two possible ways I can think of would be someone opening up the raw .R files within the package, or by typing the function name in the R console to print the R code text. So is there a way to encrypt the files or disable the function print calls for the functions?
Thanks
Luckily, there is no such functionality. If you want to hide your analysis or algorithm, perhaps you could use some proprietary software or write your code in a language which compiles (e.g. C++). Note that all software is reverse-engineerable. It's just a matter of motivation.

List of functions of a package [duplicate]

This question already has answers here:
Show names of everything in a package
(4 answers)
Closed 5 years ago.
Is there an easy, friendly way to list all functions of a package without downloading those huge PDFs (package references)? I need this for getting me familiar with the package, finding proper functions etc.
I tried ?rjags but it doesn't do what I expected.
Load the package (for example the carpackage). Then use ls()
ls("package:car")
The closest thing I've been able to find for this is:
help(,"rjags")
The first parameter specifies the searched thing, second one specifies the package. By keeping only the second one, I hope to get all help pages that relate to that package. This is equivalent of
help(package = "rjags")
This might not work in general though, as in ?help the functionality of omitting the first parameter is described as
topic is not optional: if it is omitted R will give
If a package is specified, (text or, in interactive use only, HTML) information on the package, including hints/links to suitable help
topics.

How do you build R packages with code containing characters supported by R but not by the terminal [duplicate]

This question already has answers here:
How to use a non-ASCII symbol (e.g. £) in an R package function?
(2 answers)
Closed 9 years ago.
As part of a package I'm creating in R I have a function that calculates a set of values for peptide sequences. The scientific agreement is for these values to be named yº3, bº6, xº13, etc. and so I would like to followed this. In the R GUI (on a Mac at least) 'º' is an acceptable character, that can be used in character strings etc. meaning that I can successfully create a function outputting a data frame with a column containing the desired names.
The problems come when I try to build the package containing the function. The terminal doesn't understand this character and substitutes it for \xbc when running the same function from the build package...
Is there anyway of circumventing this shortcoming of the package builder/terminal
I ran into this solution for a question I asked for a different application here. Unicode is the way to go. As Andrie points out you can use unicode
U+00BA For the masculine ordinal indicator
U+00B0 For the degree symbol
Include them in the form \uxxxx , i.e. small u and without the +.

How to specify from which library a function is used? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
R: Masked Functions
I am using the packages moments and fUnitRoots. Both of them have a function called "kurtosis" (to be more precise, the package fUnitRoots calls the package timeDate which also has the function "kurtosis"). They give very different results, because their formulas is slightly different. I want to use the function skewness from the library moments, but if the two libraries are loaded, the function used is the one from fUnitRoots.
How can I specify from which library I want the given function to be used, without unloading one of the libraries?
Use the :: operator. The syntax is package::name. So it would be moments::kurtosis.

Resources