小编rma*_*gno的帖子

无法登录rstudio-server

我以前brew install rstudio-server在Mac OS X 10.11.4 上成功安装了rstudio-server .

现在,我试图登录到rstudio-server 0.99.902但没有成功.从客户端,我得到一个弹出窗口说 -

"RStudio初始化错误","无法连接到服务".

我使用的用户具有用户ID 1100,因此我认为该问题与帐户权限无关.

在运行守护程序时,当我尝试登录时,显示的错误/var/log/system.log是:

rserver [1100]:ERROR系统错误61(连接被拒绝)[request-uri =/rpc/client_init]; 发生在:void rstudio :: core :: http :: LocalStreamAsyncClient :: handleConnect(const boost :: system :: error_code&)/tmp/rstudio-server-20160803-68705-uhvyws/rstudio-0.99.902/src/cpp /core/include/core/http/LocalStreamAsyncClient.hpp:119; LOGGED FROM:void rstudio :: server :: session_proxy ::(匿名命名空间):: logIfNotConnectionTerminated(const rstudio :: core :: Error&,const http :: Request&)/ tmp/rstudio-server-20160803-68705-uhvyws /rstudio-0.99.902/src/cpp/server/ServerSessionProxy.cpp:308

崩溃报告:http://pastebin.com/GYkFZ8fT

在运行时sudo /usr/local/bin/rserver --server-daemonize=0,当我尝试登录时,没有错误输出到控制台,但我确实在浏览器的弹出窗口中出现此错误:Error occurred during transmission.

崩溃报告:http://pastebin.com/kJMsPh6s

附加信息:

rstudio-server verify-installation回报 …

macos r rstudio-server

48
推荐指数
1
解决办法
2084
查看次数

Error: function is not available for .Call() for package X

I'm just starting to experiment with the Rcpp package, so please be patient with me.

I read the Rcpp vignettes and I've tried a few given examples in the Rcpp documentation. Now, I thought I'd start by wrapping some functions from the GLFW libray, a library written in C.

So I thought I'd start with the function glfwInit. I wrote this simple cpp source file in a package named pixel to wrap it under the name glfw_init:

#include …
Run Code Online (Sandbox Code Playgroud)

r rcpp

7
推荐指数
1
解决办法
1965
查看次数

为什么RStudio View模式中的逻辑向量不显示长度?

在基本矢量类型中,逻辑上没有显示其长度的特殊原因是什么?

View(list(1:10, rep(NA, 10), rep(1.0, 10), rep('x', 10)))
Run Code Online (Sandbox Code Playgroud)

视图

r rstudio

6
推荐指数
1
解决办法
98
查看次数

如何绑定具有相同结构的两个列表?

介绍

我有两个嵌套列表,其结构与我想要组合的结构相同(在c()某种意义上).

对于这种关系,我可能已经存在一个关于图论或计算机科学中相同结构的概念,但我不知道.

所以这是我试图通过相同的结构澄清我的意思:

  • 某个级别的列表元素要么全部命名,要么没有命名;
  • 当我们命名元素时,在该级别上永远不会有重复的名称;
  • 当节点本身是命名元素时,两个列表的父子节点关系是相同的.

所以我想知道是否已经有一个解决这个问题的方法,我认为这可能是相当普遍和常见的...(?)任何解决方案涉及:

  • 使用基础rapply;
  • 具有某些purrr功能组合的Tidyverse解决方案;
  • rlist包中的功能

会很好!

foo并且bar是具有相同结构的两个示例列表.

wonderful是由组合foobar(手动完成)产生的所需列表.

我希望它足够清楚!

# Input lists: foo and bar
foo <- list(a = list(a1 = 1:3, a2 = rep('a', 3)), b = list(b1 = list(b11 = c(4,5,6), b12 = rep('b', 3)), b2 = list(b21 = list(b31 = c(0, 1, 2)))), c = list(list(c21 = 1:3), list(c21 = 4:6), …
Run Code Online (Sandbox Code Playgroud)

r list purrr

6
推荐指数
1
解决办法
151
查看次数

如何在包中使用 rlang 运算符?

我正在编写一个使用 tidyverse 函数的包,即使用非标准评估,dplyr::filter例如:

setMethod("filter_by_id",
          signature(x = "studies", id = "character"),
          definition = function(x, id) {
            study_id <- rlang::expr(study_id)
            lst <- purrr::map(s4_to_list(x), ~ dplyr::filter(.x, !!study_id %in% id))
            y <- list_to_s4(lst, "studies")
            return(y)
          })
Run Code Online (Sandbox Code Playgroud)

我正在使用!!运算符(我可能会使用rlang包中的其他几个),我想知道是否需要像使用 pipe-operator%>%一样显式导入它,如以下问题中所述:R: use magrittr pipe operator in自己写的包

有什么等价于usethis::use_pipe()但对于运营商 from rlang

r r-package non-standard-evaluation tidyverse rlang

6
推荐指数
1
解决办法
480
查看次数

如何设置 Rcpp::List 元素的类属性?

在下面的C++源文件中,在函数中glfw_get_monitors如何设置对象每个元素的类属性monitor_ptrs

\n\n

该行monitor_ptrs[i].attr("class") = "GLFWmonitor";抛出编译错误:

\n\n
\xe2\x80\x98Rcpp::Vector<19>::Proxy\xe2\x80\x99 {aka \xe2\x80\x98class Rcpp::internal::generic_proxy<19>\xe2\x80\x99} has no member named \xe2\x80\x98attr\xe2\x80\x99\n
Run Code Online (Sandbox Code Playgroud)\n\n

glfw_types.h

\n\n
#ifndef RCPP_GLFW_TYPES_H\n#define RCPP_GLFW_TYPES_H\n\n#include <Rcpp.h>\n#include <GLFW/glfw3.h>\n\nvoid glfw_destroy_monitor(GLFWmonitor*);\n\n// /sf/ask/2884741681/\n\ntypedef Rcpp::XPtr<GLFWwindow, Rcpp::PreserveStorage, glfwDestroyWindow> GLFWwindow_ptr;\ntypedef Rcpp::XPtr<GLFWmonitor, Rcpp::PreserveStorage, glfw_destroy_monitor> GLFWmonitor_ptr;\n\n\n#endif\n\n
Run Code Online (Sandbox Code Playgroud)\n\n

C++源文件

\n\n
#include "glfw_types.h"\nusing namespace Rcpp;\n\n// [[Rcpp::export]]\nGLFWmonitor_ptr glfw_get_primary_monitor() {\n\n  GLFWmonitor_ptr new_monitor = GLFWmonitor_ptr(glfwGetPrimaryMonitor(), true);\n\n  new_monitor.attr("class") = "GLFWmonitor";\n\n  return new_monitor;\n}\n\n// [[Rcpp::export]]\nRcpp::List glfw_get_monitors() {\n\n  int nr_monitors;\n  GLFWmonitor** monitors = glfwGetMonitors(&nr_monitors);\n  Rcpp::List monitor_ptrs(nr_monitors);\n\n  for(int i = 0; i < nr_monitors; i++) {\n    monitor_ptrs[i] …
Run Code Online (Sandbox Code Playgroud)

r rcpp

5
推荐指数
1
解决办法
379
查看次数

如何有效地计算data.table的唯一(数字)列向量?

foo <- data.table(x = 1:5/sum(1:5),
                  y = (-4):0/sum((-4):0),
                 z1 = 2:6/sum(2:6),
                 z2 = 2:6/sum(2:6))
Run Code Online (Sandbox Code Playgroud)

假设我有foo数据表(如上所述):

            x   y   z1   z2
1: 0.06666667 0.4 0.10 0.10
2: 0.13333333 0.3 0.15 0.15
3: 0.20000000 0.2 0.20 0.20
4: 0.26666667 0.1 0.25 0.25
5: 0.33333333 0.0 0.30 0.30
Run Code Online (Sandbox Code Playgroud)

如何有效地计算唯一列?在这种情况下只有3.

请假设一般:

  1. foo始终是数据表而不是矩阵; 虽然列总是数字.
  2. foo 实际上很大,nrow> 20k,ncol> 100

是否可以在不制作额外数据副本的情况下执行此操作?

我目前的方法是使用applypaste来获取每列的单个值,然后length(unique(.))对结果执行...

是否有任何魔法data.table::transpose(),data.table::uniqueN也许还有其他朋友?

r data.table

3
推荐指数
1
解决办法
88
查看次数

如何在此示例图的右侧添加直方图或密度图来描述 y 值的分布?

为了清楚起见,我正在寻找一种简单的方法来添加 90 度旋转的直方图或密度图,其 x 轴与下面给出的示例图的 y 轴对齐。

library(ggplot2)
library(tibble)

x <- seq(100)
y <- rnorm(100)

my_data <- tibble(x = x, y = y)
ggplot(data = my_data, mapping = aes(x = x, y = y)) +
  geom_line()
Run Code Online (Sandbox Code Playgroud)

由reprex 包(v0.2.1)于 2019-01-28 创建

r ggplot2

3
推荐指数
1
解决办法
2012
查看次数

在安装R软件包时,R如何检查系统外部依赖性?

例如,在尝试将R软件包安装curl为的依赖项时usethis

* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF …
Run Code Online (Sandbox Code Playgroud)

r

3
推荐指数
1
解决办法
39
查看次数

Julia 相当于 R 的帮助页面和小插图?

来自 R 背景,刚开始学习 Julia,我想知道 Julia 中的文档如何,以及是否有类似于 R 的帮助页面和小插图。

此外,在 R 中,可以使用 roxygen 注释块记录函数,Julia 中是否也有类似的东西?

julia

2
推荐指数
1
解决办法
61
查看次数

如何dplyr过滤器匹配?

我想这可能是一个相当简单的问题,但如何做到这一点(基础 R):

df <- data.frame(x=10:1,y=(1:10)^2)
df[match(c(3,5,7), df$x),]
Run Code Online (Sandbox Code Playgroud)

用惯用的 dplyr 说法:

tb <- dplyr::as.tbl(df)
dplyr::filter(tb, ??? )
Run Code Online (Sandbox Code Playgroud)

或者,换句话说,应该怎样做???才能使它在功能上等同于第一个片段?请注意,结果数据帧/tibble 中的行顺序是相关的。

r dplyr

1
推荐指数
1
解决办法
1034
查看次数

如何按照线性方程随机生成 (x, y) 点?

我有一个方程 y=9x+6。我想从这个函数中提取 10 个随机点。我应该如何进行?

random r

0
推荐指数
1
解决办法
636
查看次数