![]() ![]() You might also have noticed the row of three (or four) letter abbreviations under the column names. For now, you don’t need to worry about the differences we’ll come back to tibbles in more detail in wrangle. Tibbles are data frames, but slightly tweaked to work better in the tidyverse. It prints differently because it’s a tibble. (To see the whole dataset, you can run View(flights) which will open the dataset in the RStudio viewer). You might notice that this data frame prints a little differently from other data frames you might have used in the past: it only shows the first few rows and all the columns that fit on one screen. We will use the function sum(is.na(x)), where the x represents one column of the data frame. You can create this user-defined function either before calling the sapply() function or define it directly within the sapply() function. Since there exists no generic R function to count the number of NA’s per column, you should create this function first. The operation can be either a generic R function (e.g., min, max, sum, etc.) or a user-defined function. The second argument (i.e., the operation) might need some extra explanation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |