小编Pss*_*Pss的帖子

从列变量中删除前缀字母

我有所有以“ m”开头的列名称。例子:mIncome, mAge。我想删除prefix. 到目前为止,我已经尝试了以下方法:

df %>% 
rename_all(~stringr::str_replace_all(.,"m",""))
Run Code Online (Sandbox Code Playgroud)

这将删除所有包含字母“ ”的列名称m。我只需要从一开始就将其删除。有什么建议么?

r dplyr

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

RMarkdown:浮动目录和报告开头的目录

我想同时拥有:浮动目录和报告开头的目录(在 Rmarkdown 中)。我认为只有一个是可能的

我想要拥有什么

在这里,我手动添加了一个目录。

---
title: "Report"
author: "Anon"
date: '2022-07-20'
output: 
  html_document:
    toc: true
    toc_float: true
    toc_depth: 2
    collapsed: true
    smooth_scroll: true
---

## Table of Contents 

- R Markdown
- Including Plots



## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated …
Run Code Online (Sandbox Code Playgroud)

r knitr r-markdown

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

标签 统计

r ×2

dplyr ×1

knitr ×1

r-markdown ×1