Data Science Initiative Introduction To R Bootcamp (part 2)

Of organizing it but what we actually ran was this command okay that’s the command B we made how I got change this so that I will so that the NA disappears how I like your optimism I wish it worked that way hey I did it’s much easier instead of thing now don’t pluck the NA is that just if we.

Had a command that says do what I mean please you know what I mean just do it okay but unfortunately it becomes a little trickier than that so how do you specify this okay so what are we gonna do here so that we basically gosh so first of all let’s look at this plot what is where is the NA value come from I see two na s there on that plot – two.

Words called na it’s the type in the bedroom so which one do we need to turn off potentially both but that’s but this is the one.

We were actually focusing on now so let’s focus on this one wait what’s that na from that that’s the one in type okay because these because these this tells us the type actual that the strip here tells us that the value of type for for each panel or each facet so how do I get rid of this one.

Basically I just want to say just I really wish you weren’t in the data set and I wouldn’t have a problem remove any from type or.

We went over here and said so we can do this directly in line here okay but let’s do it in two separate step steps okay okay what if I did this Davis give me Davis so let’s call this Davis.

Dot an OK and ok just give it a problem give it a real name okay but I’m just I’m just doing we basically want we want this new variable to be there to be all of the data frame that is Davis with any observation removed whose value for type is na okay and that’s harder to say.

Than it is to type okay that’s almost what we want but we want exactly the opposite of it which is go find me the ghost buying media tell me we are tell me whether it’s true or false that this hubs or each observation is an n/a for type okay that’s what we say is that na Davis dollar type that gives me a.

Hundred and seventy five long vector of trues and falses yes I want the opposite so I put a bang.

That says invert that which says no no I want the one it’s true if type is not okay now sake what I want so now I just say now subset those rows and by the way give me everything back I want everything back I want all the columns back so again it’s the same thing we talked about yesterday and this is what we live off everyday you just do this thing okay yeah okay so.

Of Davis that’s 175 what’s the dimension of this 174 there’s one missing that’s it life is good okay now let’s go back up and say okay ready where do we put this okay yep be very clear about what you’re kind of trying to say what do you want to do okay before you again before you do anything in our try to articulate in your chosen language as precisely as possible what you’re trying to attempt and then try to actually do so what do you mean as well as do.

That so put so does that mean and this is why the to be precise you have to be careful here does that mean we want to remove let’s just say identify then we’ll figure out what to do do we want to identify an observation as having being a candidate for removal as being it has a type which is with a value of n a and and the bedroom is n/a or that it’s either which means we change.

The command very much okay which means so we basically now but that we’re almost there we have not is in a type okay so now we have this now head heads explode because we’ve negated this so that means we actually do so we could write it one of these ways and this.

Is where you really want to step back do it separately and we.

Will do this Davis dollar type okay okay that one or is da 10a of Davis dollar path okay that says it’s true if either of these is the case okay that.

Says these are the ones I want to throw away okay yeah so let’s just let’s just I’m gonna do this.

Fourteen of these which is not one it’s.

Fourteen okay so what I’m one of the things I’m going to actually do now is I’m going.

Trust myself here okay let’s look at W and let’s look at type and again if you think I’m doing this if you think I’m doing this just for pedagogical effect the wrong I check these answers every time I do.

Something that’s potentially gonna get me into trouble I could easily get messed this up do I mean and or not so just just check these should all come back as hmm there should be an n/a in every single one of these rows but not every cell should.

Cuz that we only want it all and so there’s an n/a here and there’s.

An n/a there good we got it right okay how did I create I don’t know it’s such a it’s just on your lap it’s.

Just below the backspace I I don’t know I don’t think about it I just can’t live without this the vertical Barden says or by the way just there’s a very others a there’s a thing that gets people a lot in this language this.

And that are very different okay so let’s just do this so okay what’s the so let’s just do the first one this is this is let’s do it the right way.

W1 and then w2 is the wrong way what’s the class of w1 logical what’s.

The class of w2 it’s logical to so there’s no difference so what else should I do as for the length what’s the length of W 1 what’s the length of W 2 okay I’m with the recycling rule that one becomes the same thing well repeated 175 times when I use it No.

All hell breaks loose ok so we’re very bad news this says I want.

A scalar answer back this single vertical bar says do an element by elements and give me back the corresponding vector with the same number.

Of elements of the inputs it’s a there’s a lot of bugs the next or the next two vertical bar there and get totally different answers okay but now we have this ok so we’ve actually now figured out the W one is the right thing that actually that says with these 14 which.

Are true contain an n/a and either type.

Or bath so I want Davis Das and to be equal to Davis but not W 1 okay w1 that was a typo okay so I W 1 is a long vector hunson if I’ve it’s got 14 it identifies.

14 that I don’t want so I have to invert that okay everyone happy alternatively if.