美文网首页生信星球培训第107期
《学习小组Day6笔记--杨彦杰》

《学习小组Day6笔记--杨彦杰》

作者: whaaaaasasswsws | 来源:发表于2021-05-01 09:28 被阅读0次

    R包的安装及dplyr基本包的使用

    -本章注重实践


    dplyr包的使用.png
    library(dplyr)
    select(iris,colnames="Sepal.Width")#筛选列#
    select(iris,-c(2,3))# 筛选列#
    mutate(iris,yyj=iris$Sepal.Length+iris$Sepal.Width)#增加列#
    filter(iris,group_by(iris,Species))#筛选行# 
    arrange(iris,Species=="setosa")#按照行的条件筛选整个表格数据“
    summarise(iris,mean(Sepal.Length),sd(Sepal.Length))#总结参数#
    iris%>%group_by(Species)%>%summarise(mean(Sepal.Width),sd(Sepal.Width))#传递符#
    count(iris,Species)#统计某一列的unique值#
    options(stringsAsFactors = F)#用dplyr处理关系数据#
    test1 <- data.frame(x = c('b','e','f','x'), z = c("A","B","C",'D'),stringsAsFactors = F)
    test2 <- data.frame(x = c('a','b','c','d','e','f'), y = c(1,2,3,4,5,6),stringsAsFactors = F)
    inner_join(test1, test2, by = "x")
    left_join(test2, test1, by = 'x')
    

    相关文章

      网友评论

        本文标题:《学习小组Day6笔记--杨彦杰》

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