#> opdata_username opdata_CourseID question response Pivot_longer(cols = Q1MaincellgroupRow1:Q1MaincellgroupRow10, Here’s the new dataset, where a column called “question” contains the question names and a column called “response” contains the corresponding responses: # Pivot the dataset from wide to long format These are the column names we’ll be moving to a single column called “question” when the dataset transforms from wide to long. The third through eighth columns are named after each survey question-“Q1MaincellgroupRow1”, “Q1MaincellgroupRow2”, “Q1MaincellgroupRow3”, etc. #> # Q1MaincellgroupRow8, Q1MaincellgroupRow9 , #> # Q1MaincellgroupRow6, Q1MaincellgroupRow7 , #> # Q1MaincellgroupRow4, Q1MaincellgroupRow5 , #> # … with 1,092 more rows, and 8 more variables: Q1MaincellgroupRow3 , #> opdata_username opdata_CourseID Q1Maincellgroup… Q1Maincellgroup… Here’s the survey data in its original, wide format: # Wide format # devtools::install_github("data-edu/dataedu") Community guidelines for Stack Overflow posts and the package if you don't have it Sharing an idea by pairing an abstract programming concept with a reproducible example is a common practice for experienced R programmers. Pivot_longer(-religion, names_to = "income", values_to = "count") #> # A tibble: 180 x 3 Here’s one from the pivot_longer() vignette, which you can view with vignette("pivot"): library(tidyverse) # Simplest case where column names are character data The concept gets much clearer when you add an example-even one with little context-to the explanation. I’ve been using R for over five years and I still struggle to visualize the contents of many columns rearranging themselves into one. But it’s harder to imagine what happens with the variables and their contents as the dataset’s shape changes. When I read something like “Use pivot_longer() to transform a dataset from wide to long”, I can imagine the shape of a dataset changing. We’ll describe this process in three steps: discovering the concept, seeing how the concept is used, and seeing how the concept is used in education. This connection to their professional lives is a hook for readers as they engage R syntax which is, if you’ve never used it, literally a foreign language. We wanted readers to feel motivated and engaged by seeing words and data that reminds them of their everyday work tasks. Professional context includes scenarios, language, and data that readers will recognize in their education jobs. We learned from writing Data Science in Education Using R (DSIEUR) that we can combine words, code, and professional context. But what if we used education datasets to help them imagine using R on the job, just as the authors of ISL use words and code to teach about models and Julia Silge uses video to inspire coding? They have to imagine how to apply what they’ve read and seen to the problems they’re solving at work. Still, for most people using R in their jobs, there’s another step. Then I need to see what data scientists do for me to imagine myself doing what I’ve read. I need the reading to give me language for what I see data scientists do. Then I imagined myself using them when I watched Julia Silge fit a random forest model to predict attendance at NFL games. For example, I learned about random forest models when I read about them in An Introduction to Statistical Learning (ISL). But I get even more excited when I see somebody use new R concepts. You never know if you’re about to learn something that fundamentally changes the way you code or solve data science problems. If it has been experienced, trust it.ĭiscovering a new R concept like a function or package is exciting. This process is waiting to be discovered by all those who do not know of its existence … It can be discovered for yourself, if it hasn’t been already. …There is a natural learning process which operates within everyone, if it is allowed to. Timothy Gallwey wrote in The Inner Game of Tennis: Estrellado is a public education leader and data scientist helping administrators use practical data analysis to improve the student experience.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |