首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏火星娃统计

    dplyr_下篇

    The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union rowwise 按照行的形式,对行进行操作 # 按照行实现两列的行求和 iris[,1:4] %>% rowwise() %>% mutate(total = sum(c(Sepal.Length, Sepal.Width ))) %>% head() ## # A tibble: 6 x 5 ## # Rowwise: ## Sepal.Length Sepal.Width Petal.Length Petal.Width prevent printing of the R code that generated the plot. c_across()选择 # 从iris中选择数字列,并进行计算 iris %>% rowwise () %>% mutate(total = sum(c_across(where(is.numeric)))) %>% head() ## # A tibble: 6 x 6 ## # Rowwise

    98320发布于 2020-09-15
  • 来自专栏医学和生信笔记

    dplyr中的行操作

    但有时候我们也需要对某行做一些操作,dplyr中现在提供了rowwise()函数快速执行对行的操作。 简介 library(dplyr, warn.conflicts = FALSE) “rowwise()和group_by()很像,本身不做任何操作,但是使用了rowwise之后,再和mutate() df <- tibble(x = 1:2, y = 3:4, z = 5:6) df %>% rowwise() ## # A tibble: 2 × 3 ## # Rowwise: ## df %>% rowwise() %>% mutate(m = mean(c(x, y, z))) ## # A tibble: 2 × 4 ## # Rowwise: ## x rf <- df %>% rowwise(id) 计算加和: rf %>% mutate(total = sum(c(w, x, y, z))) ## # A tibble: 6 × 6 ## # Rowwise

    2.3K30编辑于 2022-11-15
  • 来自专栏优雅R

    「R」dplyr 行式计算

    你可以使用 rowwise() 创建它: df <- tibble(x = 1:2, y = 3:4, z = 5:6) df %>% rowwise() #> # A tibble: 2 x 3 #> 6 与 group_by() 类似, rowwise() 本身并不进行任何的操作,它仅改变其他动词操作如何工作。 df %>% rowwise() %>% mutate(l = length(x)) #> # A tibble: 3 x 2 #> # Rowwise: #> x ❞ 建模 rowwise() 数据框允许我们以一种特别优雅的方式解决很多的建模问题。 () rowwise() 也被质疑了很长一段时间,部分原因是我不明白有多少人需要通过本地能力来计算每一行的多个变量的摘要。

    7.2K20编辑于 2022-01-21
  • 来自专栏全栈程序员必看

    eigen库的使用_vcg库

    = ind2sub(size(R), i); R.sum() // sum(R(:)) R.colwise().sum() // sum(R) R.rowwise sum(R, 2) or sum(R')' R.prod() // prod(R(:)) R.colwise().prod() // prod(R) R.rowwise // trace(R) R.all() // all(R(:)) R.colwise().all() // all(R) R.rowwise ) // all(R, 2) R.any() // any(R(:)) R.colwise().any() // any(R) R.rowwise

    1.1K30编辑于 2022-11-10
  • 来自专栏医学和生信笔记

    手动计算logFC(wilcoxon差异分析)

    下面我们用dplyr中的rowwise操作实现这一过程,当然还有其他方法,选择自己喜欢的即可。 group_list == "UC"] normal <- colnames(exprSet)[group_list == "normal"] logfc_df <- exprSet %>% rowwise genesymbol = rownames(exprSet)) %>% arrange(desc(logfc)) head(logfc_df) ## # A tibble: 6 × 4 ## # Rowwise

    2.2K30编辑于 2023-09-12
  • 来自专栏小明的数据分析笔记本

    跟着Nature学作图:R语言ggplot2分组散点图并添加误差线

    dat<-read_excel("data/20230521/figure1c.xlsx") head(dat) plotrix::std.error(c(1,2,3)) dat %>% rowwise std_error=plotrix::std.error(c(rep1,rep2,rep3))) %>% ungroup() -> new.dat 作图代码 dat %>% rowwise

    1.3K21编辑于 2023-08-23
  • 来自专栏生信技能树

    一句代码完成lasso回归

    as.integer(Days.to.Date.of.Last.Contact)) %>% # Find max time between all days (ignoring missings) rowwise prad.primary.solid.tumor) %>% as.data.frame %>% # Find max time between all days (ignoring missings) rowwise colData(skcm.metastatic) %>% as.data.frame %>% # Find max time between all days (ignoring missings) rowwise ydata.raw <- colData(skcm) %>% as.data.frame %>% # Find max time between all days (ignoring missings) rowwise

    1.6K220发布于 2020-12-07
  • 来自专栏小明的数据分析笔记本

    跟着Nature Plants学作图:R语言ggplot2画热图展示基因表达量

    计算z-score library(tidyverse) library(stringr) dat01 %>% rowwise() %>% mutate(mean_value = mean

    1.2K20编辑于 2023-01-06
  • 来自专栏生信技能树

    高度定制的go和kegg富集分析R语言绘图 | Circular barplot

    4 base_data <- data %>% group_by(group) %>% summarize(start=min(id), end=max(id) - 1) %>% rowwise () %>% mutate(title=mean(c(start, end))) # > head(base_data) # # A tibble: 4 x 4 # # Rowwise: # group

    6.1K20编辑于 2022-01-21
  • 来自专栏R语言数据分析指南

    ggplot2绘制多边形热图

    0, "grey35", "grey85"), pal[severity + 1]), treat_case = 2 - study_id %% 2) %>% # 计算治疗案例 rowwise

    52910编辑于 2023-12-20
  • Eigen基础用法-实现线性回归预测

    Eigen::MatrixXf new_x(5, 2); new_x << 1, 1, 1, 2, 1, 3, 1, 4, 1, 5; auto new_y = new_x.array().rowwise ); std::cout << "Predicted values : \n" << new_y << std::endl; auto new_y_norm = new_x.array().rowwise

    48120编辑于 2025-05-03
  • 来自专栏R语言数据分析指南

    ggplot2绘制logo版环状条形图

    group_by(Category) %>% summarize(start = min(seq_id), end = max(seq_id) - empty_nrow) %>% rowwise

    74730编辑于 2023-09-11
  • 来自专栏NewBeeNLP

    Meta关于深度学习推荐系统的Scaling Law的研究

    训练dense层用Adam,训练embedding table用 Rowwise Adagrad。

    97810编辑于 2024-07-12
  • 来自专栏全栈程序员必看

    eigen库的使用_eigenvalue

    (2,3); mat << 1,2,3, 4,5,6; std::cout << mat.colwise().maxCoeff(); // output: 4, 5, 6 // mat.rowWise

    1.9K50编辑于 2022-11-02
  • 来自专栏全栈程序员必看

    eigen使用教程_kafka简单使用

    = ind2sub(size(R), i); R.sum() // sum(R(:)) R.colwise().sum() // sum(R) R.rowwise sum(R, 2) or sum(R')' R.prod() // prod(R(:)) R.colwise().prod() // prod(R) R.rowwise // trace(R) R.all() // all(R(:)) R.colwise().all() // all(R) R.rowwise ) // all(R, 2) R.any() // any(R(:)) R.colwise().any() // any(R) R.rowwise

    5.2K80编辑于 2022-11-02
  • 来自专栏优雅R

    「R」表格可视化 10+ 指南【正式篇】

    = "potatoes") %>% select(-crop) %>% pivot_wider(names_from = year, values_from = "yield") %>% rowwise is.na(yield) ) %>% pivot_wider(names_from = year, values_from = yield) %>% rowwise() %>% mutate Denmark" ) ) %>% pivot_wider(names_from = year, values_from = yield) %>% select(-crop) %>% rowwise

    1.7K20发布于 2020-11-06
  • GMSB文章二:数据汇总和数据探索

    estimate), LL = exp(estimate - 1.96*std.error), UL = exp(estimate + 1.96*std.error)) %>% rowwise estimate), LL = exp(estimate - 1.96*std.error), UL = exp(estimate + 1.96*std.error)) %>% rowwise estimate), LL = exp(estimate - 1.96*std.error), UL = exp(estimate + 1.96*std.error)) %>% rowwise

    37310编辑于 2024-06-29
  • GMSB文章七:微生物整合分析

    = "missing")​# Microbiome databias_corr_species <- bias_corr_species %>% dplyr::rowwise() %>% dplyr

    43710编辑于 2024-06-29
  • 来自专栏生信技能树

    数据框的列名居然会影响绘图

    ├─dplyr::rowwise(.) 17. ├─dplyr::select(...) 18. └─dplyr:::select.data.frame(...)

    1.1K10编辑于 2024-11-21
  • 来自专栏全栈程序员必看

    Eigen库学习教程(全)

    << m.colwise().lpNorm<1>().maxCoeff() << endl; cout << "infty-norm(m) = " << m.cwiseAbs().<em>rowwise</em> ().sum().maxCoeff() << " == " << m.<em>rowwise</em>().lpNorm<1>().maxCoeff() << endl; } 输出: 1-norm MatrixXf mat(2,4); mat << 1, 2, 6, 9, 3, 1, 7, 2; std::cout << "Row's maximum: " << std::endl << mat.rowwise

    7.1K61编辑于 2022-11-02
领券