Statistics can be used to describe a data set, or they can be used to infer how well a model fits a data set. In this post, we’ll look the the former kind of statistics, and how to extract them from R. The remaining posts in this series will mostly deal with statistical tests and …
Category: R
Jan 20
Plotting data
You can plot data using plot(). This can be used in several ways. The simplest is to plot some numeric x-values against some numeric y-values using: plot( x.variable.vector, y.variable.vector ) For example: x<-c( 1:10 ) y<-1 + 2*x plot( x, y ) However, for data you have imported into a data frame, the x and …
Jan 13
Formatting data
Although you will occasionally type data directly into R, more often than not, you will have a spread-sheet containing data which you want to import. R can easily import data from a comma-separated variable (CSV) file. If you open a CSV file using a text-editor, you will see that they look something like this inside …
Jan 13
Kinds of data
The sort of data you want to analyse in R may come in many forms. You will often be trying to model the interaction of some independent variables (a.k.a. input, predictor or explanatory variables, the things you’d plot on an x axis) to explain the values of some dependent variable (a.k.a. output, outcome or response variable, …
Jan 01
Running R code
The R interpreter is controlled by typing in plain-text commands at its command-line prompt >|. R commands are just text, so you can prepare a chunk of them in a text-editor, and then copy-and-paste them directly into R to run them immediately. Try copying and pasting the line below at the prompt: print(“Hello world”) Lo …
- 1
- 2