I'm trying to debug my first R script and I came across this line:
data <- read.data(dir, indiv, label)
开发者_如何转开发
I've been googling "R read.data" for the past 30 minutes and absolutely nothing is coming up. Am I doing something wrong? Is there a good way to look up things I see in R scripts that I don't know what they are?
And what is this particular line doing anyway?
It's probably a function defined by the author of the script. Search for it in the code you have.
A couple of things to check:
- Does your script define the function 'read.data' somewhere?
read.data <- function(...
- Does your script use
library()
orrequire()
to load another package? In that case, theread.data
function can be defined in that package. - Does your script use
source
to read another script? Check that script then...
package sos
to the rescue:
read.data
is a deprecated function in the rjags
package
> library(sos)
> findFn("read.data")
Finds this result:
http://finzi.psych.upenn.edu/R/library/rjags/html/read.data.html
From this page:
Read data for a JAGS model from a file.
Usage
read.jagsdata(file)
read.bugsdata(file)
Note
Earlier versions of the rjags package had a read.data function which read data
in either format, but the function name was ambiguous (There are many data file
format in R) so this is now deprecated.
There isn't a base function named read.data
. If you want to find help for an R function (for example read.table
), simply type ?read.table
at the interactive prompt.
This line calls a read.data function which is either defined in that script or in something else it loads (such as libraries with the library()
or require()
, other scripts with source()
). You'll need to search those sources to find this function.
精彩评论