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

你可能感兴趣的:(tidyverse学习)