小编twb*_*b10的帖子

如何在R脚本中将更改提交到GitHub?

我正在尝试从R脚本中自动化一些基本的git操作。我在Windows OS上使用Rstudio。例如,如果您希望在脚本完成一些自动化任务后更新GitHub,这可能会有所帮助。

我编写了一些简单的函数,这些函数利用R shell()函数和Window的&管道运算符将命令链发送到OS终端:

# Git status.
gitstatus <- function(dir = getwd()){
  cmd_list <- list(
    cmd1 = tolower(substr(dir,1,2)),
    cmd2 = paste("cd",dir),
    cmd3 = "git status"
  )
  cmd <- paste(unlist(cmd_list),collapse = " & ")
  shell(cmd)
}

# Git add.
gitadd <- function(dir = getwd()){
  cmd_list <- list(
    cmd1 = tolower(substr(dir,1,2)),
    cmd2 = paste("cd",dir),
    cmd3 = "git add --all"
  )
  cmd <- paste(unlist(cmd_list),collapse = " & ")
  shell(cmd)
}

# Git commit.
gitcommit <- function(msg = "commit from Rstudio", …
Run Code Online (Sandbox Code Playgroud)

git shell r github rstudio

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

将 ggplot 保存为 EPS 格式以便在 Adob​​e Illustrator 中进行编辑 - 文本问题

问题

我想保存ggplotR 中的文件以便在 Adob​​e Illustrator (AI) 中进行编辑。我可以将绘图保存为EPSPS格式ggsave,但绘图总是在文本周围带来一些阴影。有没有办法在 R 或 Adob​​e Illustrator 中解决这个问题?

例如,我的情节如下所示:

PNG

但是,当我将其导入 AI 时,它看起来像这样(文本周围的粉红色阴影):

截屏

代码

# Saving a plot for editing in Adobe Illustrator.

library(ggplot2) # for plotting
library(cowplot) # for ggsave

# Generate an example scatter plot.
# From: http://r-statistics.co/Top50-Ggplot2-Visualizations-MasterList-R-Code.html
options(scipen=999)  # turn-off scientific notation like 1e+48
theme_set(theme_gray())  
data("midwest", package = "ggplot2")

plot <- ggplot(midwest, aes(x=area, y=poptotal)) + 
  geom_point(aes(col=state, size=popdensity)) + 
  geom_smooth(method="loess", se=F) + 
  xlim(c(0, 0.1)) + …
Run Code Online (Sandbox Code Playgroud)

r adobe-illustrator ggplot2 cowplot

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

标签 统计

r ×2

adobe-illustrator ×1

cowplot ×1

ggplot2 ×1

git ×1

github ×1

rstudio ×1

shell ×1