简体   繁体   English

R 调用 package 本身中的数据集

[英]R calling a dataset in the package itself

I have created a package containing a dataset called mydata .我创建了一个 package ,其中包含一个名为mydata的数据集。

I want to use my dataset in my functions but I dont know how to call it.我想在我的函数中使用我的数据集,但我不知道如何调用它。 when i use data("mydata") to call my dataset and avoid warning messages I have another message during the building process当我使用data("mydata")调用我的数据集并避免警告消息时,我在构建过程中有另一条消息

See section 'Good practice' in '?data'.请参阅“?数据”中的“良好做法”部分。

@imporFrom mypackage mydata doesn't work either. @imporFrom mypackage mydata也不起作用。 What's the best way to call a dataset in the package itself?在 package 本身中调用数据集的最佳方法是什么?

Use package_name::mydata , example in car package car::Angell .使用package_name::mydata ,例如car package car::Angell

Dataset is in a data folder with for example mydata.rda inside.数据集位于data文件夹中,例如mydata.rda

To add help, create a data.R file in R folder.要添加帮助,请在R文件夹中创建一个data.R文件。

Personnaly I put inside:我个人放在里面:

# 1. mydata ----

#' Here is a long title
#'
#' Description of the dataset : length, columns
#'
#' @format one object of class XXX
#'
#' @source where it comes from
#' @name mydata
NULL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM