R Software Notes

This page contains personal notes about how to use the software R.

Installing and loading a library


Importing and Using data from ESDS

First go to esds data browser and select the data you are interested in.
Then download it in the format "Comma Separated Value File".

In R, do the following:

data <- read.csv('mydata.csv')

Then access the different fields using the dollar sign, for example
pdata2006 <- data.frame(

get the size size by using dim


more at tutrial on reading data.

Working with frames

the easiest way is to attach it using the following command:


This makes the different columns of the frame directly accessible, use list() to see them.

delcaring a column as a cotegory / dummy

d$mydummy <- factor(d$mydummy)

How easier could it be!

Running SOLS,3SLS,probit

systemfit documentation

## Not run: library( systemfit )
data( kmenta )
demand <- q ~ p + d
supply <- q ~ p + f + a
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## OLS estimation
fitols <- systemfit("OLS", system, labels, data=kmenta )
print( fitols )

help on glm probit

result1 <- glm(lvcert~DVRT, family=binomial(logit))

External Links

look at this help on how to create dummy variables.
nice wiki help

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License