There are two ways for transposing rows and columns in R.

  • Using t to just transpose the data frame as if it would be a matrix
  • Use tidyr::spread along with tidyr::gather

Note: R provides a wide variety of statistical (linear and nonlinear modeling, classical statistical tests,) and also graphical techniques, which is highly extensible. Read our list of r programming interview questions to get better in this language and even start working on your own data science project!

BY Best Interview Question ON 18 Jul 2020