R - Data first glimpse
Quick first look
head()
tail()
class()
dim()
names()
str()
glimpse(), from dplyr, like str
summary()
Quick plot
hist(x)
plot(x,y)
boxplot(x, horizontal = TRUE)
Tidy
- gather(df,key,value, …) key = name of new cat column, value = name of value column, … column to gather or to not gather
- spread(df, key, value) key = name of new cat column, value = name of value column
- separate(df, col, into) col = name of 1 column to separate, into = c(names of new columns), sep = ‘-‘
- unite(df, col, …) col = name of new united column, … = columns to unite, sep = ‘-‘
Clean
lubridate: ymd, ymd_hms etc.
text: tolower(), toupper()
NA values: complete.cases(df) – find rows without NA, na.omit(df) – only select rows without NA
Comments
Post a Comment