美文网首页
R语言-tips

R语言-tips

作者: 超级可爱的懂事长鸭 | 来源:发表于2021-08-23 11:44 被阅读0次
  1. 查看目录下文件
list.files("/home/0822")
  1. p值标星
unicox$star=ifelse(unicox$p<0.001,"***",ifelse(unicox$p >= 0.001 & unicox$p <0.01, "**",
ifelse(unicox$p >=0.01 & unicox$p <0.05, "*",NA)));unicox
  1. 批量替换表格中的NA
X[is.na(X)]=c("0")
  1. 看数据的变率
var(as.numeric (dat))
#结果为0,则表明数字都一样
  1. 跳过
if   next
  1. 切割数据
split(data,data$type)

7.增加一列

mutate(data.frame, new_variable_name=computed_value)
#或者
data$new_colname=new_variable

8.选择

#选择某一列
#1
data$colname
#2
library(dplyr)
starwars %>% select(height)
select(data,colname)

9.多个向量取交集

data <- Reduce(intersect, list(A, B, C, D ...))

相关文章

  • R语言-tips

    查看目录下文件 p值标星 批量替换表格中的NA 看数据的变率 跳过 切割数据 7.增加一列 8.选择 9.多个向量取交集

  • Day4-高大石头

    R语言基础 1. R & Rstudio 下载及安装 tips:文件路径最好不要有中文或者空格, 否则容易报错,...

  • R 和 RStudio 的安装

    R 和 RStudio 的安装是非常简单的,这里提供一些安装 Tips。 安装 R 现在最新版的 R 语言是 3....

  • R语言小tips-1

    整理R语言学习中遇到的边边角角,有的还挺有意思和挺重要! 1.用data()函数可列出已载入的包中的所有数据集。 ...

  • R tips

    在数据框X 中有a,b,c,d,e5列,顺序排列,现在将d移动到a,b之间。 X[,c('a','d','b','...

  • R Tips: ":::" "::"

    For a package pkg, pkg::name returns the value of the exp...

  • R和python的入门学习参考资料

    https://cmdlinetips.com/category/r/r-tips/[https://cmdlin...

  • python基础知识

    Tips 1.%r 和%s%r在print '%r' %("中文时")会输出一些non-ASCII charact...

  • [R Tips] switch

    有时候你写出了下面这种很简单的判断语句但判断的条件比较多。 这时候用 switch 函数就非常简洁。 除了用名字匹...

  • conda 安装的R使用 rstudio

    souce activae R35conda install rstudiorstudio tips 用来cond...

网友评论

      本文标题:R语言-tips

      本文链接:https://www.haomeiwen.com/subject/caakiltx.html