用于R中的管道循环

时间:2018-12-26 03:56:34

标签: r pipe

我正在使用magrittr库在R中使用管道。我需要在两个管道之间使用for循环,我该怎么做

oracle.jdbc.driver.OracleDriver

它把我扔了

  

inherits(x,“ flextable”)中的错误:     参数“ x”丢失,没有默认值

2 个答案:

答案 0 :(得分:1)

希望代码可以为您提供帮助。

seq(1:10) %>% (function(x){
    print(x)
})

enter link description here在谈论这种方法

答案 1 :(得分:1)

只需预定义函数:

foo <- function(x){
  for (ii in 2:length(species))
{
  group_result <- group_vector(tm.rank.out.temp, grp.type, species[ii])
  for (jj in 1:length(group_result))
  {
    text_color <- grp.clr[[unique(grp.type[,grp][jj])]]
    color(i = group_result[[jj]], j = ~ species[ii], color = text_color)
  }
 }
}

tmrank.ft <- regulartable(
data = tm.rank.out) %>% 
theme_booktabs() %>% 
autofit() %>%
merge_v(j=missing_species) %>%
align(align = 'center') %>%
align(align = 'center', part = 'header') %>% 
bold(part = 'header') %>%
height(height = 1, part = 'header') %>% 
fontsize(size = 14, part = 'all') %>% 
width(j=1, width = 1.0 ) %>%
width(j=2:ncol(tm.rank.out), width = 2.5) %>%
foo()