tidyverse学习

最近数据格式太繁杂了,感觉想要写出简单漂亮的代码还是需要学习一下tidyverse。

dplyr

Here is the complete list of functions dplyr offers:
select(): Select columns from your dataset
filter(): Filter out certain rows that meet your criteria(s)
group_by(): Group different observations together such that the original dataset does not change. Only the way it is represented is changed in the form of a list
summarise(): Summarise any of the above functions
arrange(): Arrange your column data in ascending or descending order
join(): Perform left, right, full, and inner joins in R
mutate(): Create new columns by preserving the existing variables

tidyr

The tidyr package complements dplyr perfectly. It boosts the power of dplyr for data manipulation and pre-processing. Below is the list of functions tidyr offers:
gather(): The function “gathers” multiple columns from your dataset and converts them into key-value pairs
spread(): This takes two columns and “spreads” them into multiple columns
separate(): As the name suggests, this function helps in separating or splitting a single column into numerous columns
unite(): Works completely opposite to the separate() function. It helps in combining two or more columns into one

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容