Dr. Mark Gardener 


Home  
Providing training for:

Tips and Tricks  for R and ExcelOn this page you can find tips, tricks and hints for using both R and Excel. At the end of each tip there are links forwards and backwards as appropriate. There is also an index of R tips and an index of Excel tips. For most analytical purposes the combination of Excel and R is unbeatable! Excel is great as a data management tool and for preparing data for analysis. You can also use it to get an overview of your data or to make simple (and not so simple) graphs. R is an analytical "swiss army knife" and can carry out a mindboggling array of analytical routines as well as producing great graphics. Tips & Tricks for R  Tips & Tricks for Excel  An Introduction to R  MonogRaphs  Writer's Bloc 

Multidimensional objects: class() 
Multidimensional objects in RA vector is a onedimensional object in R. Usually the vector looks like a row but it really acts like a column. When you make more complicated objects you add more dimensions, commonly used multidimensional objects are:
A matrix is a 2dimensional object with rows and columns. A data.frame is also 2dimensional with rows and columns. A table can have more than 2 dimensions – a threedimensional table would appear as several twodimensional tables. An array is similar to a table (the difference is largely how you build it to start with). A list is the most "primitive" of the objects and is a loose collection of other objects, bundled together. A matrix contains rows and columns but all the data in the matrix must be of the same type, that is, all numbers or all text. You can think of a matrix as a single vector that happens to be split up into rows and columns. In fact, one way to make a matrix is to do just that: > matrix(1:12, ncol = 4) A data.frame also contains rows and columns but the columns can be of different types, so you can have one column that is numeric, one that is character and one that is a factor. > a = 1:4 You can use the class() command to tell you what kind of object you are dealing with. 

Top  << Previous Tip: Vector objects  >> Next Tip: Make a matrix  
Follow me... 

Top  Tips & Tricks Home  Index of R Tips  Index of Excel Tips  
More links: 
See my Publications about Excel, R, statistics and data analysis  Courses in R, data analysis, data management and statistics  Visit the R Project website  
See my Publications about statistics and data analysis. MonogRaphs: random topics in R Writer's Bloc – my latest writing project includes R scripts Courses in data analysis, data management and statistics. 


Top  Home  Contact  GardenersOwn Homepage 