我正在用 golem 开发一个 Shiny 的应用程序。在我的计算机上,一切都运行良好,但后来我在 github 上加载了该包并安装在另一台计算机上。该应用程序有两个主要部分:第一个部分可以处理原始数据并将输出保存为 .rds
文件,第二个您可以分析详细数据(您也可以上传已处理的 .rds
文件)。问题出在第一部分以及当我必须读取多个文件时。它给了我这个错误:
Error in: Could not find a root 'DESCRIPTION' file that starts with '^Package' in 'C:\Users\Della Rocca\Documents'.
Are you in your project directory, and does your project have a 'DESCRIPTION' file?
我可以复制出现问题的服务器部分:
# this makes the directory at the base of your computer.
volumes = c(Home = fs::path_home(), shinyFiles::getVolumes()())
####select the data folder where to read data
shinyFiles::shinyDirChoose(input, 'datafolder', roots = volumes, session = session)
data_path = reactive({
if(length(input$datafolder) != 1 ) {
shinyFiles::parseDirPath(volumes,input$datafolder)
}else{
NULL
}
})
stepb = eventReactive(input$readdatabttn,{
req(data_path(), targets(), analysis())
stepa = list(targets = targets(), analysis = analysis())
withProgress(message = "Reading data...", value=0, {
#external function that takes the path and reads multiple .txt files catching names from the target_file (a .xlsx file)
read_advise_lipidomics(out = stepa, datapath = data_path(), target_file = stepa$targets$targetfile_lipidomics)
})
})
data_path()
没关系,因为它有正确的路径。问题是当我触发 eventReactive()
时使用按钮input$readdatabttn
.
你知道这个错误是什么吗?我有描述文件并正在运行 devtools::check()
我没有错误,只有警告:
> checking Rd \usage sections ... WARNING
Undocumented arguments in documentation object 'calibplot_advise_lipidomics'
'plot_calibration'
Undocumented arguments in documentation object 'create_beautiful_radarchart'
'vlabels' 'title' '...'
Undocumented arguments in documentation object 'na_advise_lipidomics'
'na_filter_lip' 'na_filter_sam' 'imputation_met' 'imputation_val'
Undocumented arguments in documentation object 'read_advise_lipidomics'
'datapath'
Undocumented arguments in documentation object 'recovery_advise_lipidomics'
'intercept_flag'
Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See chapter 'Writing R documentation files' in the 'Writing R
Extensions' manual.
最佳答案
我解决了。问题是在代码中我获取了包版本并将其保存在变量中。我使用了函数 golem::get_golem_version() ,该函数仅在我的开发项目目录中有效,在所有其他项目中(即使在同一台计算机上)不起作用。现在我自己编写版本,但我想自动化它。
编辑:
我使用了 packageVersion()
和我的包名称,现在它可以工作了。
关于r - 错误 : Could not find a root 'DESCRIPTION' file that starts with '^Package' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69133890/