Want to learn more? Take the full course at https://learn.datacamp.com/courses/in... at your own pace. More than a video, you'll learn hands-on coding & quickly apply skills to your daily work.
---
Now that you're familiar with how to run commands in R, let's get a bit more technical into exactly what types of data you have been manipulating. There are a number of basic atomic data types in R. Here are the most common ones.
Numeric data are decimal numbers like 42.5. Numeric data could be stock prices, cash flow, or income. A special type of numeric data is integers. Integers are whole numbers that do not have a decimal place. By default, whole numbers like 5 are stored as numeric data unless you specifically tell R that you want it to store 5 as an integer. To do this, add a capital L after the number. You will almost always use numerics over integers in R, so this default behavior is nothing to worry about.
Characters, also called strings, are text values such as "Hello world", or "forty". Character data could be a sequence of names, or categories for your data, or even credit rating for bonds. Note the quotation marks telling R that you are giving it character data. Even numbers can be stored as character data if you put it in quotation marks.
And finally, Logicals are the so-called boolean values of TRUE and FALSE. R requires that true and false be capitalized, so this would cause an error. Technically, NA, to denote a missing value, is also logical, but we won't go deep into that here.
So far, you have stored numeric data in variables, but you could have just as easily stored logical or character data in a variable as well. Here, the logical TRUE is assigned to my_answer and the word "carrots" is assigned to food.
Given a variable, you can use R to determine what data type it is with class(). Using class on my_answer returns "logical", telling you that the my_answer variable contains a logical data type. class() is what is known as a function. You will see a number of useful functions throughout the course, but for now, you can think of them as a black box, where you pass in some kind of input, the function calculates some value, and presents it to you as output. You can use class() to see the difference in type between the numeric and integer versions of 5.
Let's find out what you learned, head over to the next exercise to try out your knowledge of data types.
#DataCamp #RTutorial #IntroductiontoRforFinance
On this page of the site you can watch the video online R Tutorial : Basic Data Types with a duration of hours minute second in good quality, which was uploaded by the user DataCamp 12 April 2020, share the link with friends and acquaintances, this video has already been watched 784 times on youtube and it was liked by 7 viewers. Enjoy your viewing!