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 

Basic types of R object: 
Types of R object – 1. basicsR "recognises" various sorts of object. Every object holds a class attribute, which controls how the object is dealt with by various commands. At the most basic level you can think of R objects as being in one of three main forms:
The numeric type is obvious – numbers: > num = c(2.3, 4.1, 5, 12.2) The character type is also obvious – text: > chr = c("a", "b", "c") The last basic type is a factor. The factor can appear like a number or a character, depending upon its contents: > fact = gl(3, 2) The previous object (fact) looks like numbers. The following looks superficially like characters: > fac = gl(3, 2, labels = c("p", "q", "r")) In fact you can see that it is not a character object because the text items do not have quotes around them. Another "clue" is the Levels: part of the display – but beware because this is not always displayed. Factor objects are important and are used in many statistical analyses. When you import data using read.csv() for example, the columns of text are converted to factor objects unless you explicitly tell R otherwise. 

Top  << Previous Tip: Be classy  object class attributes  >> Next Tip: Types of R object – 2. logical  
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. 
My Publications about statistics and data analysis See my personal pages at GardenersOwn 

Top  Home  Contact  GardenersOwn Homepage 