小编Wil*_*iam的帖子

如何使用 R 执行 EUR-Lex API 的 SOAP 请求?

您将如何SOAP使用 R 请求 EUR-Lex 的 API?

EUR-Lex 是一个包含许多法律行为的欧盟数据库。在他们的 Web 服务手册中,他们描述了他们的SOAP系统,但没有描述如何使用 R。我已经尝试了一段时间就业httrRCurl但没有成功。我想使用 R 而不是 SOAPUI。

这里有人有这方面的经验吗?

从下面的链接中,我应该按如下方式定义正文吗?

body <- "<sear:searchRequest>
<sear:expertQuery>${expert query}</sear:expertQuery> <sear:page>${page}</sear:page>
<sear:pageSize>${pageSize}</sear:pageSize> <sear:searchLanguage>${search language
</sear:searchLanguage>
          </sear:searchRequest>"
Run Code Online (Sandbox Code Playgroud)

然后我如何将其与 结合起来headerfields使用RCurlhttr包?

以下三个答案似乎相关,但我不知道如何将它们应用到我的 EUR-Lex 示例中:

  1. 如何将 SOAP 请求curl 转换为 RCurl
  2. 带有 WSDL for R 的 SOAP 客户端
  3. R 中的 SOAP 请求

EUR-Lex API 链接:

  1. WSDL: https: //eur-lex.europa.eu/eurlex-ws?wsdl
  2. 手册:https ://eur-lex.europa.eu/content/tools/webservices/SearchWebServiceUserManual_v2.00.pdf

soap web-services r rcurl httr

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

使用 gganimate() 沿日期对点和回归线进行动画处理

我正在尝试对点和黄土回归线进行动画处理,以便它们在一年中同时出现/显示,但我返回了一个错误,如下所述,带有 reprex。

这将是理想的动画:https://user-images.githubusercontent.com/1775316/49728400-f0ba1b80-fc72-11e8-86c5-71ed84b247db.gif 不幸的是,我发现这个的线程没有附带的代码。

在这里查看我的 reprex 问题:

#Animate points and regression loess line along with dates at the same time
library(MASS) #for phones reprex dataset
phones <- data.frame(phones) #Prepare reprex data
library(ggplot2) #for plotting
library(gganimate) #for animation

#Animation
ggplot(phones, aes(x = year, y = calls)) +
  geom_point() + geom_smooth(method = "loess", colour = "orange",
                             se = FALSE) +
  transition_time(year) + shadow_mark() + ease_aes("linear")
Run Code Online (Sandbox Code Playgroud)

这会返回错误:

Error in `$<-.data.frame`(`*tmp*`, "group", value = "") : 
  replacement has 1 row, data has 0 …
Run Code Online (Sandbox Code Playgroud)

animation regression r ggplot2 gganimate

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

gganimate:结合transition_layers和geom_smooth

如何将geom_smooth(method =“ lm)函数与gganimate()的transition_layers结合使用,以便随着各个条的向上偏移/增长,出现geom_smooth的线性线,如下所示:geom_smooth线所需外观示例唯一的不同是,在我的情况下,随着线的出现,条形图会向上移动而不是点。

通过使用gganimate的transition_layers函数,通过向上漂移而出现的条形电流效果很好。

但是,我无法弄清楚如何添加geom_smooth线,因此随着条形的增长而出现。现在,该行显示在结尾处,如下所示。

有关动画的当前外观,请参见下文。

这是我的问题的简单代表:

#Df for reprex
library(ggplot2)
library(tidyverse)

year <- as.numeric(c(1996:2002,
                     1996:2002,
                     1996:2002))
c <- c(39, 40, 67, 80, 30, 140, 90, 23, 100, 123,
       140, 1, 2, 1, 13, 3, 3, 30, 1, 3, 3)
df <- data.frame(year, c) %>%
  select(year, c) %>%
  arrange(year)

#Static plot
(static_plot <- ggplot(data = df) +
    geom_bar(data = df %>% filter(year == 1996), stat="identity", position ="stack",
             aes(x = year, y = c)) +
    geom_bar(data = …
Run Code Online (Sandbox Code Playgroud)

plot animation r ggplot2 gganimate

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

标签 统计

r ×3

animation ×2

gganimate ×2

ggplot2 ×2

httr ×1

plot ×1

rcurl ×1

regression ×1

soap ×1

web-services ×1