This question already has answers here:
Mathematical notion/superscripts in Rd files
(2 answers)
Closed last year.
I am docummenting a dataset using roxygen2 (for my package development). I am trying to put cube meter (m^2) as a unit for one of my variable but it remains the same (m^2) when I am trying to see the documentation ?data.
How can I generate units inside roxygen2?
Thank you
You should use this line:
\ifelse{html}{\out{m<sup>2</sup>}}{\eqn{m^2}}
You need to keep in mind that Roxygen is used to produce by HTML and PDF versions of your documentation. The first statement in the ifelse will be for the HTML, the second will be for PDF.
Related
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")
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.
This question already has answers here:
Is it possible to get RStudio to show function arguments and descriptions for custom functions?
(2 answers)
Closed 5 years ago.
If I write a method or function, how can i get that "minihelp" (whose special term I dont know) which is shown while writing a function?
E.g. for "plot" it exists; Type
>plot([TAB]
then the following shows in a kind of "Tooltip"
x=
y=
... =
and if you choose for example "x", then after a second the following tooltip shows:
x
the coordinates of points in the plot. Alternatively, a single plotting
structure, function or any R object with a plot method can be provided.
Some info but not crucial to the problem: I am working with Rstudio and writing multiple S4 generics/methods for the class ExpressionSet.
Sadly I can't manage to find a cool google keyword, so I hope you can help me out!
Edith:
The following question is about the same as mine but i have still the ongoing problem that I already wrote a package, every function is documented with roxygen, I followed hadleys descriptions. Nevertheless, the tooltips do not show up.
In the linked question it is said that "help files must be generated" - which I assume are generated as ?myS4Method is showing the appropriate help pages. Any ideas?
The functionality you are looking for comes from the way RStudio parses the documentation of packages. If you create a package, you can add Roxygen comments to your functions or classes. These comments are then parsed when you create the package into documentation files that you see as the help for a function.
If you run the command ?plot you will see a list of Arguments. These are the parameters that can be passed to the function and that is what the tooltip in RStudio is telling you about.
To get RStudio to give you info about the functions you are using, you should bundle your S4 classes into a package (Hadley Wickham's tutorial) and make sure they are correctly documented. RStudio will take care of the rest.
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.
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 +.