The Motor Trend Car Road Testsdata set contains 11 aspects of cars collected by a magazine in 1971 (see table at the end of this post). Mtcars is a variable of type data frame and one of the built-in data sets in R. Filter rows by rownames in the index column Maybe packages like rmarkdown or knitr need to be loaded as well. Appreciative of any help I can get!įirst of load the tidyverse package, because the following code uses some helpful functions from this package. But R is like a foreign language and I don’t feel like the section of my textbook I was referred to explained the problem - especially for a brand new coder (and this class isn’t supposed to require any experience). This is just very frustrating to me because I could do this in Excel in less than 30 seconds. This is my first day working with R and my only coding experience before today was some C# two+ years ago. Also wouldn’t know how to search whether the row names contain the text “Honda” or “Toyota”. I have tried creating subsets, but unsure how to do so using row names. So I need to filter the results to print only rows whose names contain “Honda” or “Toyota” and I need to do it using knitr::kable(). ![]() The best I can tell is that the make and model of the cars are the row names. ![]() ![]() I clicked to read more about the function but it was all foreign to me. However that section only talks about printing the first 5 rows of the dataset, not about filtering it at all. My assignment is to print the rows corresponding to Honda and Toyota cards using knitr::kable(). I am working with the mtcars dataset in R.
0 Comments
Leave a Reply. |