This question already has answers here:
How can I view the source code for a function?
(13 answers)
Closed 6 years ago.
I am running the following code
x=wilcox.test(rnorm(10), rnorm(10))
Now my question is: How to see the R code of this test? When I am running "wilcox.test" in console, it is printing
function (x, ...)
UseMethod("wilcox.test")
<bytecode: 0x3d73148>
<environment: namespace:stats>
This question may be very trivial but I am stuck here.
Use
methods("wilcox.test")
to find out which methods are implemented. Then use getAnywhere to see the method you are interested in:
getAnywhere("wilcox.test.default")
Related
This question already has an answer here:
How to find the package name in R for a specific function?
(1 answer)
Closed 2 years ago.
Due to the characters, I'm having a hard time googling for which package the %||% function comes from.
I have tried googling the string literal, as well as 'percent bar bar percent' and similar.
It is present in rlang package. See
?rlang::`%||%`
It behaves like dplyr::coalesce but for NULL values instead of NAs.
This question already has an answer here:
R: Efficiently remove singleton dimensions from array
(1 answer)
Closed 5 years ago.
I'm looking for a function in R that reproduce exactly what the squeeze function of Matlab does. Does anybody know it?
(I'd have thought that it would have been incumbent on an asker to explain what squeeze actually does -- drops singleton dimensions.)
See the help on the drop function in R; this also drops singleton dimensions.
This question already has answers here:
Show names of everything in a package
(4 answers)
Closed 9 years ago.
My question is similar to this question and in fact, is answered there. But because it took me a lot effort to find the answer there. I preferred to create a new more organized one and answer it myself.Now the question is:
If I want to see all methods, dataframes, etc of a package that I only know its name, what should I do to access them very easily?
Just enter this code:
help(package='PACKAGENAME', help_type='html')
for example to see all you have in the R basic package, stats:
help(package='stats',help_type='html')
This question already has answers here:
Figure out what version of R a function was introduced in
(2 answers)
Closed 9 years ago.
Is there a way to determine rather easily when an R function was added (what version number). Take for instance when were:
paste0 and browseVignettes added?
I'm not really looking for when these were added but a way to see when they were added.
Converting my comment to an answer as requested:
You can use the news() function
news(grepl("paste0", Text))
Go here: http://cran.r-project.org/src/base/NEWS.html
paste0 was in 2.15.0 and browseVignettes was 2.13.0 but it doesn't seem to mention browseVignettes.
This question already has answers here:
What does "The following object is masked from 'package:xxx'" mean?
(2 answers)
Closed 5 years ago.
This is a newbie question in R. If you have two libraries in R with same function name (and one masking the other) then how do you use the masked function.
A concrete example:
Both UsingR and QRMlib have the function QQPlot(), and UsingR's QQplot is masking that of QRMlib. How can I use the QQplot function of QRMlib.
Thank you
Addition: Just found out that QRMlib::QQplot() works, thus modifying the question that I found in the web. What if they don't have a namespace in which case the above approach will not work.
Link to the original question posed in google:
https://stat.ethz.ch/pipermail/r-help/2005-March/067710.html
UsingR::QQPlot() and/or QRMlib::QQPlot()
Try to load preferred library last, since it will mask the "unwanted" function...
All the best!