开发者

Getting the contents of a library interactively in R

Is there an equivalent of dir function (python) in R?

When I load a library in R like -

library(vrtest)

I want to know all the functions that are in that library.

In Python, dir(vrtest) would be a list of all attributes of vrtest.

I guess in general, 开发者_如何学运维I am looking for the best way to get help on R while running it in ESS on linux. I see all these man pages for the packages I have installed, but I am not sure how I can access them.

Thanks


help(package = packagename) will list all non-internal functions in a package.


Yes, use ls().

You can use search() to see what's in the search path:

> search() 
[1] ".GlobalEnv"        "package:stats"     "package:graphics"
[4] "package:grDevices" "package:utils"     "package:datasets"
[7] "package:methods"   "Autoloads"         "package:base"

You can search a particular package with the full name:

 > ls("package:graphics")
 [1] "abline"          "arrows"          "assocplot"       "axis"
 ....

I also suggest that you look at this related question on stackoverflow which includes some more creative approaching to browsing the environment. If you're using ESS, then you can use Ess-rdired.

To get the help pages on a particular topic, you can either use help(function.name) or ?function.name. You will also find the help.search() function useful if you don't know the exact function name or package. And lastly, have a look at the sos package.


help(topic) #for documentation on a topic
?topic

summary(mydata) #an overview of data objects try

ls() # lists all objects in the local namespace

str(object) # structure of an object
ls.str() # structure of each object returned by ls()

apropos("mytopic") # string search of the documentation

All from the R reference card

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜