From the course: R Essential Training: Wrangling and Visualizing Data

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Data types and structures

Data types and structures

From the course: R Essential Training: Wrangling and Visualizing Data

Start my 1-month free trial

Data types and structures

- [Instructor] The same number can mean different things in different contexts depending on what the data type is, and also the structure that it's in, and even though you don't have to declare a variable type when you first enter things in R, you have an enormous amount of control over what your data means and how it is used. Let's start by going and looking at some of the fundamental data types in R. The most common is numeric, and so, I'm going to create a variable here called n1 for numeric number one, and I'm going to assign a value of 15. Now, the thing I want you to notice is that this is an integer number. I didn't say 15 point anything. But when I ask to see it, I'll just call n1. There's my 15, and then I use the command typeof. I'm asking R to tell me what type it is, and you'll notice it does not say that it's integer. It says that it's double precision, so, it's acting like it has lots and lots of decimal…

Contents