Chapter 20
Ten Tips for Excel Émigrés
IN THIS CHAPTER
Defining a vector and naming a range
Operating on vectors and ranges
Importing a table from Excel into R
Excel, the most widely used spreadsheet program, has an impressive array of statistical analysis tools, which many people use. (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 20-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 you highlight F2 through F7, right-click, and choose Define Name from the menu that pops up. Clicking OK defines x as the name of that range, just as the R statement creates the vector x.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
