![]() We see the variable names, and an (abbreviated) string indicating what type of data is stored in each variable. A tibble is a way of storing tabular data, which is part of the tidyverse. When we enter cats by itself on the command line, it will print the contents of cats we see that it consists of a 3 by 3 tibble. ![]() We then use the read_csv() function to import the data, which we store in the object named cats: We could use library(tidyverse) to load all of the commonly used packages in the tidyverse. Let’s make a new script for this episode, by choosing the menu options File, New File, R Script.Īlthough we loaded the tidyverse in the previous episode, we should make our scripts self-contained, so we should include library(readr) in the new script. ![]() We can import the data into R using the read_csv() function this is part of the readr package, which is part of the tidyverse. Note that viewing the file doesn’t make its contents available to R to do this we need to import the data. Each observation is on a separate line, and variables are separated by commas. We can see that the variables names are given in the first line of the file, and that the remaining lines contain the data itself. This will display the contents of the file in a new window in RStudio. We can view the contents of the file by selecting it from the “Files” window in RStudio, and selecting “View File”. Coat, weight, likes_string calico, 2.1, 1 black, 5.0, 0 tabby, 3.2, 1
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |