File: stata.R

package info (click to toggle)
foreign 0.8.40-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,576 kB
  • ctags: 657
  • sloc: ansic: 6,997; asm: 4; sh: 2; makefile: 1
file content (33 lines) | stat: -rw-r--r-- 861 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
library(foreign)
pc5 <- read.dta("pc5.dta")
summary(pc5)
str(pc5)
compressed<-read.dta("compressed.dta")
summary(compressed)
all.equal(summary(pc5), summary(compressed))
sun6 <- read.dta("sun6.dta")
summary(sun6)
str(sun6)
all.equal(summary(sun6),summary(pc5))
df<-read.dta("datefactor.dta")
summary(df)
data(esoph)
write.dta(esoph,esophile<-tempfile())
esoph2<-read.dta(esophile)
all.equal(ordered(esoph2$alcgp),esoph$alcgp)
write.dta(esoph,esophile,convert.factors="string")
esoph2<-read.dta(esophile)
all.equal(as.character(esoph$alcgp),esoph2$alcgp)
write.dta(esoph,esophile,convert.factors="code")
esoph2<-read.dta(esophile)
all.equal(as.numeric(esoph$alcgp),as.numeric(esoph2$alcgp))

se<-read.dta("stata7se.dta")
print(se)
v8<-read.dta("stata8mac.dta")
print(v8)

stata8<-read.dta("auto8.dta",missing.type=TRUE,convert.underscore=FALSE)
str(stata8)

q()