小编Tiz*_*ano的帖子

R - 四开 HTML 文档。如何在标题/副标题区域左侧插入徽标图像

Quarto我正在尝试在使用from生成的 HTML 报告中插入公司徽标图像RStudio。我的报告模板如下

---
title: "Report Title"
subtitle: "Report subtitle"
author: "Name and Sruname"
date: last-modified
date-format: "DD-MM-YYYY"
description: "Text Text Text Text Text Text Text Text "
last-modified:
title-block-banner: true
format: 
  html:
    embed-resources: true
    smooth-scroll: true
    theme: cosmo
    fontcolor: black
    toc: true
    toc-location: left
    toc-title: Summary
    toc-depth: 3
---

```{r sesPackages, results='hide', message=FALSE, warning=FALSE, echo=FALSE}    
library(tidyverse,  verbose = F, quietly = T)
library(knitr,      verbose = F, quietly = T)
library(kableExtra, verbose = F, quietly = T) …
Run Code Online (Sandbox Code Playgroud)

r knitr quarto

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

将字符串转换为定义小数位数的数字

从给定的georeferred点的data.frame我发现字符列中的坐标格式如下

"44.524768336 11.4832955249"
"44.6858512233 11.1698766486"
"44.498179364 11.6599683838"
Run Code Online (Sandbox Code Playgroud)

要从每行中提取数值,我使用了以下命令(我将以第一行为例).

res <- strsplit(x = "44.524768336 11.4832955249", split = " ", fixed = T)
res
[[1]]
[1] "44.524768336"  "11.4832955249"

as.numeric(res[[1]][1])
[1] 44.52477
as.numeric(res[[1]][2])
[1] 11.4833
Run Code Online (Sandbox Code Playgroud)

在这次转换中,我丢失了6位小数.是否有一种方法将字符串转换为数字设置小数位数而不修改任何R全局设置?

string r numeric

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

标签 统计

r ×2

knitr ×1

numeric ×1

quarto ×1

string ×1