R Software Notes
This page contains personal notes about how to use the software R.
Installing and loading a library
package.install('name')
library(name)
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
summary(data$AGE)
pdata2006 <- data.frame(
age=data2006$age,
empstatus=data2006$empstat)
get the size size by using dim
dim(data)
length(data)
length(data$AGE)
more at tutrial on reading data.
Working with frames
the easiest way is to attach it using the following command:
attach(mydata)
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
## 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 )
result1 <- glm(lvcert~DVRT, family=binomial(logit))
External Links
look at this help on how to create dummy variables.
nice wiki help





