我正在编写一个 r 包,它为libSBMLC库提供了一个包装器。
我使用该rcppgsl 包作为参考,它查找头文件和 GNU 科学库的库文件的位置,GSL并使用该信息编写configure脚本Makevars和Makevars.in. 我目前不是为 Windows 构建。在我的机器(macOS)上,libsbml(SBML C 库)安装在通常的位置,即
头文件位于 - /usr/local/include/sbml
和库文件在 - /usr/local/lib。事实上,如果在我的包Makevars文件中使用以下内容,我可以构建我的包.
CXX=clang++
PKG_CPPFLAGS= -I/usr/local/include
PKG_LIBS= $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) /usr/local/lib/libsbml-static.a
Run Code Online (Sandbox Code Playgroud)
但是,我想学习如何使用configure脚本来查找库并使用该信息来构建包。configure.acfrom的相关部分rcppgsl是
## Check for non-standard programs: gsl-config(1)
AC_PATH_PROG([GSL_CONFIG], [gsl-config])
## If gsl-config was found, let's use it
if test "${GSL_CONFIG}" != ""; then
# Use gsl-config for …Run Code Online (Sandbox Code Playgroud) 与此处提出的问题类似,我尝试在长文档中插入锚点,以便用户可以轻松导航到文档的目录。
我的代码如下:
---
title: "Sample Document"
output:
html_document:
toc: true
theme: united
---
<a id="top"></a>
# First Section
Run Code Online (Sandbox Code Playgroud)
然后我[Go to Top](#top)在想要链接到文档顶部的任何位置添加。
我遇到的问题是,单击 时Go to Top,页面向上滚动,位于First Section顶部,而不是目录(这就是我想要的)。因此用户必须再次向上滚动才能进入目录。
有没有办法滚动回到文档的最顶部,以便在页面上再次看到目录。
我尝试放在<a id="top"></a>之前---,但这不起作用。
任何帮助将非常感激!!谢谢。
我正在尝试Rcpp使用外部库构建一个包含代码的R包.我之前曾问过如何在这里使用外部C库.我遇到的问题是,只要包含以下代码行即可
y = N_VNew_Serial(3);
Run Code Online (Sandbox Code Playgroud)
我收到了错误
sundials_test.o:sundials_test.cpp:(.text+0x2ba): undefined reference to `N_VNew_Serial'
collect2: ld returned 1 exit status
Error in Rcpp::sourceCpp("src/sundials_test.cpp") :
Error occurred building shared library
Run Code Online (Sandbox Code Playgroud)
我没有得到该行的错误
N_Vector y = NULL;
Run Code Online (Sandbox Code Playgroud)
所以,我认为与图书馆的连接工作正常.我还确认函数声明N_VNewSerial()是在nvector/nvector_serial.h你需要查看整个包代码的情况下,它可以在这里找到
特定Rcpp文件的代码粘贴如下
#include <Rcpp.h>
// #include <iostream.h>
#include <cvode/cvode.h> /* prototypes for CVODE fcts., consts. */
#include <nvector/nvector_serial.h> /* serial N_Vector types, fcts., macros */
#include <cvode/cvode_dense.h> /* prototype for CVDense */
#include <sundials/sundials_dense.h> /* definitions DlsMat DENSE_ELEM */ …Run Code Online (Sandbox Code Playgroud) 我最近发布了一个关于我blogdown的网站部署的问题.我并没有完全按照blogdown书中的说明进行操作,但我解决了问题 - 感谢Yihui的回答.
我正在尝试按照文档中的说明完全加载我的网站.所以,我现在在我的git repo中有整个项目,我正在使用netlify文档中提到的选项,即在部署设置中Build command:设置为hugo,Publish directory:设置为public和HUGO_VERSION设置的0.30选项.
我正在成功部署(in netlify)并且网站显示正常
https://typesetter-signs-43683.netlify.com/
但是,我的早期网址(来自github页面)
显示404,file not found误差.
netlify没有给出任何部署错误,github页面设置说明了这一点site is published.我得到了主题的图标,但没有别的,我发现这非常令人困惑!
我怀疑,还有另一个我失踪的关键步骤.这里的任何指针都会非常有用!
谢谢,SN248
我正在尝试将我的第一个包提交到CRAN我的机器上,我在运行时收到以下警告R CMD check(通过RStudio)
checking compilation flags used ... WARNING
Compilation used the following non-portable flag(s):
‘-Wno-unused-function’ ‘-Wno-unused-variable’
including flag(s) suppressing warnings
R CMD check results
0 errors | 1 warning | 0 notes
R CMD check succeeded
Run Code Online (Sandbox Code Playgroud)
在Rwin-builder 上构建我的包时,我没有收到此警告.我确实NOTE从win-builder服务中得到了一个,但我认为这是因为这是第一次提交并且有拼写CRAN无法识别,即
* checking CRAN incoming feasibility ... NOTE
New submission
Possibly mis-spelled words in DESCRIPTION:
CVODE (8:167)
CVODES (8:219)
Livermore (8:108)
Run Code Online (Sandbox Code Playgroud)
我并不那么担心第一次提交和错误拼写的单词,因为我可以在评论(和cran-comments.md文件)中解释它们.但有没有办法删除我在我的系统上的警告(macOS,R = 3.5.0).该软件包构建良好的 …
我正在使用 Rmarkdown 生成 HTML 报告,其中我希望用户可以选择在每个部分或图形之前查看代码(当他们需要时使用切换显示/隐藏代码)。
我想知道是否有一个选项可以为每个代码块全局和单独地这样做。
我看过一些以前使用 javascript 的解决方案,但我不熟悉该语言。我希望我可以在 Rmarkdown 中选择一个选项。
此处和此处显示了以前使用 javascript 的方法,但我不确定如何将这些方法包含在我的 Rmarkdown 文件中。我尝试了以下方法,但没有奏效
<script src="toggleR.js"></script>
```{r}
summary(cars)
```
Run Code Online (Sandbox Code Playgroud)
Rmarkdown 中的一个工作示例将非常有帮助!!
谢谢
我正努力scale_color_manual()工作ggplot2而且我没有得到颜色.
我在这个链接上关注这个例子
我的数据集由.df给出
structure(list(cond = structure(1:3, .Label = c("A", "B", "C"
), class = "factor"), yval = c(2, 2.5, 1.6)), .Names = c("cond",
"yval"), class = "data.frame", row.names = c(NA, -3L))
Run Code Online (Sandbox Code Playgroud)
如果我使用示例中的代码来制作条形图,它就可以工作
ggplot(df, aes(x=cond, y=yval, fill=cond)) + geom_bar(stat="identity") +
scale_fill_manual(values=c("red", "blue", "green"))
Run Code Online (Sandbox Code Playgroud)
我更改了代码以制作散点图,我现在看不到颜色的点.
ggplot(df, aes(x=cond, y=yval)) + geom_point() +
scale_color_manual(values=c("red", "blue", "green"))
Run Code Online (Sandbox Code Playgroud)
这可能是微不足道的,但我很难找到我在这里做错了什么.
任何帮助将非常感激!!
谢谢
我正在尝试开发一个R包,它使用Sundials C库来求解微分方程.为了不让用户安装库,我将库的源代码放在我的包中.
我已将库中的所有头文件/inst/include/sundials-2.6.2和我的包文件夹中的.c文件放入src/sundials-2.6.2.
从我对这个主题的SO帖子的阅读,sourceCpp多个文件中的代码(例如,如果它们被构造成包的一部分,则单独.h和.cpp文件应该有用.我试图从Sundials包中运行示例代码文件
我的代码(只是开头部分)看起来像
#include <Rcpp.h>
#include "../inst/include/sundials-2.6.2/cvode/cvode.h" /* prototypes for CVODE fcts., consts. */
#include "../inst/include/sundials-2.6.2/nvector/nvector_serial.h" /* serial N_Vector types, fcts., macros */
#include "../inst/include/sundials-2.6.2/cvode/cvode_dense.h" /* prototype for CVDense */
#include "../inst/include/sundials-2.6.2/sundials/sundials_dense.h" /* definitions DlsMat DENSE_ELEM */
#include "../inst/include/sundials-2.6.2/sundials/sundials_types.h" /* definition of type realtype */
Run Code Online (Sandbox Code Playgroud)
但是,我收到了一个错误
fatal error: sundials/sundials_nvector.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我在以下github存储库中做了类似的例子
Rcppsundials - https://github.com/AleMorales/RcppSundials.R/blob/master/src/cvode.cpp
使用调用头文件
#include <cvodes/cvodes.h> // CVODES functions and …Run Code Online (Sandbox Code Playgroud) 我试图找到一种更简单的方法来计算使用dplyr. 我的玩具数据集是这样的
structure(list(CAR = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 1L,
2L, 3L, 4L, 5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L), .Label = c("a",
"b", "c", "d", "e", "f"), class = "factor"), TIME = c(0L, 0L,
0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L
), VAR = c(20L, 30L, 40L, 50L, 60L, 70L, 30L, 40L, 50L, 60L,
70L, 80L, 40L, 50L, 60L, 70L, 80L, 90L)), .Names = c("CAR", "TIME", …Run Code Online (Sandbox Code Playgroud) 我正在使用bookdownR 中的包编写 gitbook,但我不希望最终的书有 facebook、twitter 的共享链接。我正在使用类似的东西YAML
---
title: "A Minimal Book Example"
author: "SN"
date: "`r Sys.Date()`"
output:
bookdown::gitbook
gitbook_config:
sharing:
facebook: false
twitter: false
documentclass: book
link-citations: yes
description: "This book ... ."
---
Run Code Online (Sandbox Code Playgroud)
但我收到错误
Error in yaml::yaml.load(enc2utf8(string), ...) :
Scanner error: mapping values are not allowed in this context at line 6, column 19
Calls: <Anonymous> ... yaml_load_utf8 -> mark_utf8 -> <Anonymous> -> .Call
Execution halted
Run Code Online (Sandbox Code Playgroud)
谁能帮助我设置选项,YAML以便最终渲染中不会显示共享选项?
谢谢!序列号