开发者

What is read.data in R? Why can't I find it in any docs?

开发者 https://www.devze.com 2023-04-11 19:59 出处:网络
I\'m trying to debug my first R script and I came across this line: data <- read.data(dir, indiv, label)

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:

  1. Does your script define the function 'read.data' somewhere? read.data <- function(...
  2. Does your script use library() or require() to load another package? In that case, the read.data function can be defined in that package.
  3. 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.

0

精彩评论

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