O'Reilly logo

Statistical Analysis with R For Dummies by Joseph Schmuller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 19

Ten Tips for Excel Emigrés

IN THIS CHAPTER

check Defining a vector and naming a range

check Operating on vectors and ranges

check Importing a table from Excel into R

Excel, the most widely used spreadsheet program, has an impressive array of statistical analysis tools. Although some have characterized Excel as the Rodney Dangerfield of analysis software (“don’t get no respect!”), a lot of people use Excel’s analysis tools. (And believe me, no one is happier about that than I am!)

If you’re one of those people and you need a bit of help transitioning to R, this chapter is for you. I point out similarities and differences that might help you make the leap.

Defining a Vector in R Is Like Naming a Range in Excel

Here’s a standard, everyday garden-variety vector in R:

x <- c(15,16,17,18,19,20)

If you’re used to naming arrays in Excel, you’ve already done something like this. Figure 19-1 shows a spreadsheet with these numbers in cells F2 through F7 and headed by x in F1. The figure also shows the New Name dialog box that opens when I highlight that range, right-click, and select Define Name from the menu that pops up. Clicking OK defines x as the name of that range, just as the R statement creates ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required