From the course: R for Data Science: Analysis and Visualization
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Data types and structures - R Tutorial
From the course: R for Data Science: Analysis and Visualization
Data types and structures
- [Instructor] I mentioned earlier, that when you save some data into an object or a variable in R, you don't have to declare the type. Now, R does have data types and you can specify them, but it does certain things by default. Let me show you how this works. I'm going to come down here and I'm going to create a variable called n1 for numeric variable one, and I'm going to assign the value of 15 to it. Okay. You can see that the 15 has showed up over here. I'm going to have it display that value down here in the console, and then I'm going to ask for the type of, and notice it tells me that it is double. In other languages, if you give numbers without a decimal, it will assume that it is an integer value. Well, R doesn't do that. It assumes double precision by default. Here, I'll use one that says 1.5 and I'll save it to n2 for a numeric two, and then we can see this n5, and I get its type and it is also double. So…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Installing R3m 30s
-
(Locked)
Environments for R1m 50s
-
(Locked)
Installing RStudio1m 4s
-
(Locked)
Navigating the RStudio environment7m 53s
-
(Locked)
Entering data7m 2s
-
(Locked)
Data types and structures10m 35s
-
(Locked)
Comments and headers5m 59s
-
(Locked)
Packages for R4m 33s
-
(Locked)
The tidyverse5m 38s
-
(Locked)
Piping commands with |4m 42s
-
(Locked)
Sample datasets4m 35s
-
(Locked)
Importing data from a spreadsheet5m 24s
-
-
-
-
-