пожалуйста, возвращайтесь позднее
пожалуйста, возвращайтесь позднее
In this lecture we're going to start getting into the nitty gritty and the details of R. In particular I'm going to talk about different data types that are used in R, and some basic operations on these data types. So first it's important to kind of get the language right, correctly, so all of those things you manipulate in R, all things that we encounter in R are what might be called objects. Objects can be all different kinds, can contain all kinds of data but everything in R is an object. So the R has five basic atomic classes of objects. So these are the kind of a very low level, or, or basic classes of objects. And they are character numeric so these are like real numbers or decimal numbers. integers, complex numbers and logicals. So logicals are just true false type things. And so the best basic object in R is what's called a vector, and a vector cont, conta, contain multiple copies of, for example, of a single type of object. So it can have a vector of characters, or a vector of integers. One thing you cannot do with a standard vector, is have mixed types of objects. So you cannot have a vector of characters and numerics, or numerics and integers, or integers and logicals. Everything in a vector has to be of the same class. Of course, with any great rule, there's always an exception. And this, this one is no exception. So in this, with vectors, there's one type of vector that can have multiple different types of classes, and that's called the list. So a list is represented as a vector so there's a se, it's a sequence of objects. But each element of that vector can be a different, can ha, can be an object of a different class. So, for example, you can have a list that has a character, it has a numeric it has a logical you can have a list that's inside a list note one element of a list can be a data frame. So any element of a list can be anything. And that's actually why, what makes lists so useful. So the list is the one exception to the to the ru, general rule that the vectors can only contain elements of the same class. So you can create an empty vector with the vector function and the vector function has two basic arguments. The first argument is the class of the objects, so the type of object that you want to in the vector, and the second argument is the length of the vector itself. Perhaps the most important type of object in R of course, is the number. The numbers in R are generally treated as what are called numeric objects. So pretty much all numbers are treated as double precision real numbers. So even if you're looking at a number that's like one or two, R thinks of those numbers as numeric objects. There is a way to explicitly say you want an integer and you can specify the L suffs, the L suff, the capital L suffix there. So, for example, if you just entered the number one in R, that gives you a numeric object but entering one with a capital L next to it, explicitly gives you an integer. This distinction is not very important right now but it will become important later. There's also a special number called Inf which stands for infinity. An Inf, an Inf is like a real number it can be used in calculations and you'll get bwa, the expected result. So for example, if you take 1 divided by 0, you'll get infinity. And you take 1 and divide it by infinity, and you'll get 0. So Inf is a special number and you can also have minus infinity too. There's another special value called NaN, or NaN and this represents an undefined value. So, you can think of it as not a number.