Otherwise the, the semantics of the dollar sign are similar to the double bracket in

the sense that when you use the dollar sign to extract an element of

an object it may or may not be of the same class as the original object.

So, here is the first,

the first example, a very simple vector, a character vector called x.

And and

I'm going to use the single bracket operator to extract the first element.

So here, what I get back is a,

is another character vector with the single element a in it.

If I, if I use, if I try to extract the second element of x,

what I would get returned back to me is a character vector with the element b in it.

I could also extract a sequence of elements so

if I say, If I, If I want to get the first four elements of x I can cre,

construct the sequence one through four and then I get a, b, c, c.

So in these three examples here what I've done is I,

I, is I subset the vector x using a numeric index so the numeric index is one,

two or the sequence one through four.

The oth, another type of index that you can use is the, is a logical index.

So, in this next example here, I'm going to subset the vector x and I want,

I only want all the elements were, that are greater than or

equ, sorry, that are greater than the letter a, right?

So, you might, it might seem strange to you that

I'm using the greater than sign with letters instead of numbers but

there is a lexicographical ordering to the letters, and

all the letters that are greater than a are letters like b, c, d, e, et cetera.

So what I get returned to me is a character vector that only

contains the letters that are greater than a.

So, here I've got b, c, c, and d.

The other thing I can do, is I can create a logical vector,

which here I call u, which is just the it's a, it's, it tells it's a true or

false vector, which tells me,

which tells me which elements of the vector x are greater than a.

So, if I print out u here I can see that the, the first element is equal to a, so

it's not greater than a.

Then, the next four are greater than a,

but then the last element is equal to a, so again, that's false.

And so, I can subset the vector x with this u vector, and

then I get out all the elements that are greater than a.

So there are two types of indices that I use here,

one, the first type with the numeric index.

And the second type was the logical index.