Get startedGet started for free

It's tea time!

The Factominer package contains functions dedicated to multivariate explanatory data analysis. It contains for example methods (Multiple) Correspondence analysis , Multiple Factor analysis as well as PCA.

In the next exercises we are going to use the tea dataset. The dataset contains the answers of a questionnaire on tea consumption.

Let's dwell in teas for a bit!

This exercise is part of the course

Helsinki Open Data Science

View Course

Exercise instructions

  • Create the keep_columns object. Then select() the columns from tea to create a new dataset. Save the new data as tea_time.
  • Look at the summaries and structure of the tea_time data.
  • Visualize the dataset. Define the plot type by adding geom_bar() after initialization of the ggplot. (Ignore the warning.)
  • Adjust the code: the labels of the x-axis are showing poorly. Make the plot more readable by adding theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 8)) after barplot the code.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# the tea dataset and packages FactoMineR, ggplot2, dplyr and tidyr are available

# column names to keep in the dataset
keep_columns <- c("Tea", "How", "how", "sugar", "where", "lunch")

# select the 'keep_columns' to create a new dataset
tea_time <- select(tea, "change me!")

# look at the summaries and structure of the data



# visualize the dataset
gather(tea_time) %>% ggplot(aes(value)) + facet_wrap("key", scales = "free") 

Edit and Run Code