我想在 D3.js 中的地图上合并两个数据集。
例如:
第一个数据集:.json 格式的空间数据。
第二个数据集:.csv 中区域的数据
--> 当您将鼠标悬停在地图上时,工具提示应显示一个句子,其中包含第二个数据集中的一些数据。
我可以制作地图并显示包含 .json 文件中数据的工具提示,但如何插入第二个数据集?
我很感激任何想法!:)
我想对我的传单地图进行一些样式更改.
是否可以包括
通过htmlwidgets为R或LeafletR?
最好
我想绘制我的数据帧的子集.我正在使用dplyr和ggplot2.我的代码仅适用于版本1,而不适用于通过管道版本2.有什么不同?
版本1(绘图工作):
data <- dataset %>% filter(type=="type1")
ggplot(data, aes(x=year, y=variable)) + geom_line()
Run Code Online (Sandbox Code Playgroud)
版本2带管道(绘图不起作用):
data %>% filter(type=="type1") %>% ggplot(data, aes(x=year, y=variable)) + geom_line()
Run Code Online (Sandbox Code Playgroud)
错误:
Error in ggplot.data.frame(., data, aes(x = year, :
Mapping should be created with aes or aes_string
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
I want to plot a world map with multiple points aka combinations of latitude and longitude coordinates.
I don't want to use Mercator, therefore I re-project both, the data for the world map and my coordinates.
While the projection for the world changes, all points are suddenly placed in the middle of the map (a common behavior, when the projections don't align, see https://www.earthdatascience.org/courses/earth-analytics/spatial-data-r/intro-to-coordinate-reference-systems/).
What am I doing wrong in when assigning the projection to the points?
My code: …
我正在构建一个 Quarto 网站(https://quarto.org/docs/websites/),该网站应该有一些与 Shiny 交互工作的页面。
假设这个迷你交互式文件应命名为mini-app.qmd
:
---
title: "Old Faithful"
format: html
server: shiny
---
```{r}
sliderInput("bins", "Number of bins:",
min = 1, max = 50, value = 30)
plotOutput("distPlot")
```
```{r}
#| context: server
output$distPlot <- renderPlot({
x <- faithful[, 2] # Old Faithful Geyser data
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
```
Run Code Online (Sandbox Code Playgroud)
这就像一个普通.qmd
文件一样,渲染、预览,一切都很棒。
但是,一旦此文件mini-app.qmd
成为使用此交互式组件创建的四开本的一部分,quarto create-project …
我想从 XML 文件中提取信息并将其转换为数据框架。
信息以 XML 文本和 XML 属性的形式存储在嵌套节点中:
结构示例:
<xmlnode node-id = "Text about xmlnode">
<xmlsubnode subnode-id = "123">
<xmlsubsubnode>
I want to extract this text
</xmlsubsubnode>
<xmlsubsubnode>
I want to extract this text
</xmlsubsubnode>
<xmlsubsubnode>
I want to extract this text
</xmlsubsubnode>
<xmlsubsubnode>
I want to extract this text
</xmlsubsubnode>
</xmlsubnode>
<xmlsubnode subnode-id = "456">
<xmlsubsubnode>
I want to extract this text
</xmlsubsubnode>
<xmlsubsubnode>
I want to extract this text
</xmlsubsubnode>
<xmlsubsubnode>
I want to extract this text
</xmlsubsubnode> …
Run Code Online (Sandbox Code Playgroud) 我使用 Quarto/RMarkdown 导出一个 PDF,其中包含一个代码块,该代码块可生成两个表(包括)。子帽。
如何增加下层子上限与上层表格的边距?
我的代码:
#| label: tbl-1985
#| tbl-cap: "*Was Wann Wo* im Jahr 1985"
#| tbl-subcap:
#| - "Auswertung nach Kategorien"
#| - "Besonderheiten"
#| layout-nrow: 2
#| fig-pos: 'H'
# table 1
df_table_1 %>%
knitr::kable(., caption = paste0("\\textit{Was Wann Wo} im Jahr ", year)) %>%
kableExtra::kable_styling(latex_options = "scale_down")
# table 2
df_table_2 %>%
knitr::kable(., caption = paste0("Besonderheiten im Jahr ", year)) %>%
kableExtra::column_spec(2, width = "12cm")
Run Code Online (Sandbox Code Playgroud)
我想将带有公式的字符串转换为带有该类型的对象,language
以便将其用作公式。
我怎样才能做到这一点?
一个简短的例子,显示了这个问题:
formula <- "(1 - sin(x^3)"
> typeof(formula)
[1] "character"
Run Code Online (Sandbox Code Playgroud)
工作参考是
> typeof(quote(1 - sin(x^3)))
[1] "language"
Run Code Online (Sandbox Code Playgroud)
当然,我不能只在引用中写公式:
> quote(formula)
formula
Run Code Online (Sandbox Code Playgroud)
那么,有没有办法将向量中的字符串转换为 typeof 的内容language
?