课程: R for Data Science: Lunch Break Lessons

免费学习该课程!

今天就开通帐号,24,100 门业界名师课程任您挑!

Excel in R: LEFT and RIGHT

Excel in R: LEFT and RIGHT

- [Instructor] So I'd like to show you how to implement the Excel left and right function in R. Let's start by looking at how a spreadsheet would use left or right. You can see that in cell E6 I've got a formula of equals left the parentheses, the value that I want to subset, which in this case is E1, which is the word slithey. And then three, which stands for three characters on the left-hand side of E1, which is slithey. The entire function is equal to SLI. Below that I have an equivalent, but I'm selecting the right three characters of cell E1. So let's take a look at how to do that in R. So now we're looking at R and it's in R Studio. I've already run line five and line seven so that I have a variable called spreadsheet and that spreadsheet variable contains the text page from the sample spreadsheet that we've been using. In line 11, you'll see that I've created something that's equivalent to left and I'm using the…

内容