Where is the .R script file located on the PC?

后端 未结 4 1002
猫巷女王i
猫巷女王i 2021-01-01 01:00

I want to find the location of the script .R files which are used for computation in R.

I know that by typing the object function, I will get the code which is runn

4条回答
  •  清歌不尽
    2021-01-01 01:22

    When R installs a package, it evaluates all the ".R" source files and re-saves them into a binary format for faster loading. Therefore you typically cannot easily find the source file.

    As has been suggested elsewhere, you can simply type the function name and see the source code, or download the source package and find the source there.

    library(plyr)
    ddply # prints the source for ddply
    
    # See the content of the R directory for plyr,
    # but it's only binary files:
    dir(file.path(find.package("plyr"), "R"))
    # [1] "plyr"     "plyr.rdb" "plyr.rdx"
    
    # Get the source for the package:
    download.packages("plyr", "~", type="source")
    
    # ...then unpack and inspect the R directory...
    

提交回复
热议问题