r 相关问题

R是一种免费的开源编程语言和软件环境,用于统计计算,生物信息学,可视化和通用计算。请提供最小和可重复的示例以及所需的输出。对数据使用`dput()`并使用`library()`调用指定所有非基本包。不要为数据或代码嵌入图片,而是使用缩进的代码块。有关统计相关问题,请使用https://stats.stackexchange.com。

替代depars(替换())在函数中获取对象名称

InVignette(“编程”,package =“ dplyr”)有以下示例代码 my_summarise2<- function(data, expr) { data %>%总结( 平均值=平均值({{expr}})...

回答 1 投票 0


当使用read.csv rstudio不在工作目录中时,已确认了使用getWD()

已将WD设置为“ D:/rstudio/Working Directory”,但是当尝试使用read.csv()时,我会收到错误: 钻石<- read.csv("~/diamonds.csv") Error in file(file, "rt") :

回答 1 投票 0


有一种方法可以在脚注RTF文件中显示下划线?

# Load the necessary library library(dplyr) library(r2rtf) # Specify the URL of the image image_url <- "https://images.vexels.com/content/129159/preview/2d-colorful-bar-chart-infographic-9e35d8.png" # Define the filename for saving image_filename <- "bar_chart.png" # Download the image download.file(image_url, image_filename, mode = "wb") # Confirm the file has been created if (file.exists(image_filename)) { cat("Image saved as 'bar_chart.png' in the working directory.\n") } else { cat("Failed to save the image.\n") } filename2 <- paste0(getwd(), "/bar_chart.png") title2 <- "Figure 18.2: Proportion of patients achieving ESC/EAS and NICE guideline recommended LDL-C goals at baseline and 1-year follow-up (LDL-C dataset)" filename2 %>% r2rtf::rtf_read_figure() %>% r2rtf::rtf_page(orientation = "landscape", margin = c(1, 1, 1.25, 1.25, 1.25, 1.25)) %>% r2rtf::rtf_page_header(text ="Data Base Lock date: FINAL", text_font_size = 8, text_font = 9, text_justification = "l") %>% r2rtf::rtf_page_footer(text = "R program: p_figure_18_x_barchart.R Production date: 10OCT2024 Page \\pagenumber of \\pagefield", text_font_size = 8, text_font = 8, text_justification = "l") %>% r2rtf::rtf_title(title = title2, text_font_size = 8, text_font = 9, text_justification = "l", text_indent_left = 0, text_indent_reference = "page_margin") %>% r2rtf::rtf_figure(fig_width = 9, fig_height = 4.5) %>% r2rtf::rtf_encode(doc_type = "figure") %>% r2rtf::write_rtf(file = paste0(mypath, "p_figure_18_2_barchart.rtf"))

r rtf
回答 0 投票 0





如何在四分之一的pdf中呈现Pashto的文字? 我正在尝试在r中的四分之一pdf中渲染pashto文本。在我的代码下方: --- 标题:“ Pashto文本” 格式: PDF: TOC:是的 数字段:false colorLinks:是的 pdf-

--- title: "Pashto text" format: pdf: toc: true number-sections: false colorlinks: true pdf-engine: lualatex include-in-header: text: | \usepackage{fontspec} \usepackage[bidi=basic]{babel} \babelprovide[import=ps,mapdigits]{pashto} \babelfont[pashto]{rm}[Renderer=HarfBuzz]{Amiri} --- ```{r setup, echo=FALSE, include=FALSE} cat("\\selectlanguage{pashto} دا پښتو متن دی") cat("\\n") ```

回答 1 投票 0

根据因子

...... 我有一个看起来像这样的数据框架: # A tibble: 6 × 8 N S DG P locus replicate MLE_s_BwS MLE_s_WF <int> <dbl> <int> <int> <int> <int> <dbl> <dbl> 1 100 0 1 1 0 0 -0.174 -0.183 2 100 0 1 1 1 0 0.143 0.143 3 100 0 1 1 2 0 -0.0758 -0.0758 4 100 0.1 10 1 3 0 -0.141 -0.141 5 100 0.1 10 1 4 0 0.102 0.102 6 100 0.1 10 1 5 0 0.102 0.102

回答 1 投票 0

如何避免在rmarkDown中的两个行分开表的列 我正在尝试使用rmarkDown文件创建一个表格并编织到PDF: --- 标题:“无题” 作者:“ L” 日期:“ 2025-03-13” 输出:pdf_document --- ````{r} set.seed(8 ...

--- title: "Untitled" author: "L" date: "2025-03-13" output: pdf_document --- ```{r} set.seed(84) dt <- data.frame(month = rep(c(1:12), 10), value = sample(c("A", "B", "C"), 120, replace = TRUE)) addmargins(round(prop.table(table(dt$value, dt$month), 1)*100,2))

回答 1 投票 0




使用r

我想在R中的特定位置添加列,但是突变(xx,.before =“ exisiting列)无法正常工作:

回答 2 投票 0


提取从存储在数据帧中的超链接字符串中显示的文本

I存储在数据框架中,Excel公式作为字符串。其中一些字符串是超链接。从这些超链接公式中,我只想提取显示的文本并在适当的位置进行数据帧的单元格。

回答 1 投票 0

每日数据的每月平均量 我将此数据框架“ DF1”为例,实际上是更大的(15年)的一部分: X1 X2 3798 2009-12-29 0 3799 2009-12-30 0 3800 2009-12-31 ...

X1 X2 3798 2009-12-29 0 3799 2009-12-30 0 3800 2009-12-31 0 3802 2010-01-02 0 3803 2010-01-03 2.1 3804 2010-01-04 0 3805 2010-01-05 0 3806 2010-01-06 0 3807 2010-01-07 0 3808 2010-01-08 0 3809 2010-01-09 0 3810 2010-01-10 6.8 3811 2010-01-12 0 3812 2010-01-13 0 3813 2010-01-14 17.7 3814 2010-01-16 0 3815 2010-01-17 0 3816 2010-01-18 1.5 3817 2010-01-19 0 3818 2010-01-20 0 3819 2010-01-21 0 3820 2010-01-22 0 3821 2010-01-23 0 3822 2010-01-24 0 3823 2010-01-25 0 3824 2010-01-26 0 3825 2010-01-27 4.5 3826 2010-01-28 0 3827 2010-01-29 0 3828 2010-01-31 0 3829 2010-02-01 0 3830 2010-02-03 0 3831 2010-02-04 0 3832 2010-02-05 0 3833 2010-02-07 0 3834 2010-02-08 0 3835 2010-02-09 1.2

回答 1 投票 0

分配观察坐标为多个多边形

I有一个数据框,并在LAT/LON坐标处进行了观察。我有三个多边形跨越了进行观测的广泛区域。我想在新的...

回答 1 投票 0

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.