Commit 39e95410 authored by Yong Liu's avatar Yong Liu

add the number of categories when selecting variables

parent 0ddd5c1e
No preview for this file type
......@@ -320,3 +320,78 @@ library(sdcMicroGUI)
library(sdcMicroGUI)
install.packages('rtools')
install.packages('RTools')
library(sdcMicroGUI)
library(Hmisc)
mydata <- spss.get("C:/Users/yl.NSD/Documents/smoke.dta", use.value.labels=TRUE)
mydata <- spss.get("e:/smoke.ssav", use.value.labels=TRUE)
mydata <- spss.get("e:/smoke.sav", use.value.labels=TRUE)
label(mydata)
label(mydata)[1]
label(mydata)[[1]
]
label(mydata)[[1]
]
label(mydata)[[1]]
label(mydata)[[2]]
label(mydata)[[3]]
labels <- label(mydata)[[1:4]]
labels <- label(mydata)[[1:3]]
labels <- label(mydata)[1:3
]
labels
labels <- label(mydata)[1:3[1]]
]
labels <- label(mydata)[1:3[1]]
f
labels
labels <- label(mydata)[1:4[1]]
labels
labels <- label(mydata)[1:5[1]]
labels
labels <- label(mydata)[1:5][1]
labels
labels <- label(mydata)[1:5,1]
labels <- label(mydata)[1[1]:5[1]]
labels
labels <- label(mydata)[1:5]
labels
labels <- label(mydata)[[1]]
labels
labels <- label(mydata)[[1:5]]
labels <- label(mydata)[[1:4]]
labels <- label(mydata)[[1:2]]
labels <- label(mydata)[[1,2]]
labels <- label(mydata)[[]]
labels <- label(mydata)[[2]]
labels
labels <- label(mydata)[[4]]
labels
labels <- label(mydata)[[5]]
labels
library(sdcMicroGUI)
sdcGUI()
library(sdcMicroGUI)
sdcGUI()
library(sdcMicroGUI)
sdcGUI()
library(sdcMicroGUI)
sdcGUI()
library(sdcMicroGUI)
sdcGUI()
library(sdcMicroGUI)
sdcGUI()
library(sdcMicroGUI)
sdcGUI()
library(sdcMicroGUI)
sdcGUI()
mydata <- spss.get("e:/smoke.sav")
l <- sapply(mydata, nlevels)
l
library(sdcMicroGUI)
sdcGUI()
library(sdcMicroGUI)
library(sdcMicroGUI)
sdcGUI()
library(sdcMicroGUI)
sdcGUI()
library(sdcMicroGUI)
......@@ -150,10 +150,15 @@ getVarLabels <- function(Vars, ...) {
activeLabels[i] <- label(ActiveDataSet())[[i]]
}
}
categories <- sapply(ActiveDataSet(), nlevels)
for( i in 1:length(Vars) ) {
for( j in 1:length(activeVars) ) {
if( Vars[i] == activeVars[j] ) {
ord <- c(ord, paste(Vars[i], activeLabels[j], sep=':'))
categorystr <- ''
if(categories[j] > 0 ) {
categorystr <- paste(paste(paste("(", categories[j], sep=''), "categories", sep=" "), ")", sep="")
}
ord <- c(ord, paste(paste(Vars[i], activeLabels[j], sep=':'), categorystr, sep=' '))
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment