# NOT RUN {
# ==== Example 1 , 8 regions ====
z1 <- EasyData("z1")
ProtectTable(z1,1:2,3)
ProtectTable(z1,c("region","hovedint") ,"ant") # Input by name
# --- Unstacked input data ---
z1w = EasyData("z1w")
ProtectTable(z1w,1,2:5)
ProtectTable(z1w,1,2:5,varName="hovedint")
ProtectTable(z1w,1,2:5,method="HITAS")
ProtectTable(z1w,1,2:5,totalFirst = TRUE)
# ==== Example 2 , 11 regions ====
z2 <- EasyData("z2")
ProtectTable(z2,c(1,3,4),5) # With region-variable kostragr
# --- Unstacked input data ---
z2w <- EasyData("z2w")
ProtectTable(z2w,1:2,4:7) # With region-variable fylke
ProtectTable(z2w,1:3,4:7) # Two linked tables
# }
# NOT RUN {
# ==== Example 3 , 36 regions ====
z3 <- EasyData("z3")
ProtectTable(z3,c(1,4,5),7) # Three dimensions. No subtotals
ProtectTable(z3,1:6,7) # Two linked tables
# --- Unstacked input data with coded column names
z3w <- EasyData("z3w")
ProtectTable(z3w,1:3,4:15,varName="g12") # coding not used when single varName
ProtectTable(z3w,1:3,4:15,varName=c("hovedint","mnd")) # Two variables found automatically
ProtectTable(z3w,1:3,4:15,varName=c("hovedint","mnd"),
removeTotal=FALSE) # Keep "Total" in variable names
# --- Unstacked input data with three level column name coding
ProtectTable(z3wb,1:3,4:15,varName=c("hovedint","mnd","mnd2")) # Two variables found automatically
ProtectTable(z3wb,1:3,4:15,varName=c("hovedint","mnd","mnd2"),
split="_") # Three variables when splitting
ProtectTable(z3wb,1:3,4:15,varName=c("hovedint","mnd","mnd2"),
split="_",namesAsInput=FALSE,orderAsInput=FALSE) # Alternative ouput format
# ==== Examples Tau-Argus ====
exe <- "C:/Users/oyl/R/TauArgus/TauWindows4.1.4_updated/TauArgus4.1.4/TauArgus.exe"
path <- "C:/Users/oyl/Documents/work/tull"
z1 = EasyData("z1")
ProtectTable(z1,1:2,3,method=list(exe=exe, path=path, typ="tabular", method="OPT"))
ProtectTable(z1,1:2,3,method=list(exe=exe, path=path, typ="tabular", method="MOD"))
ProtectTable(z1,1:2,3,method=list(exe=exe, path=path, typ="tabular", method="GH"))
z1$ant[17] = 0
ProtectTable(z1,1:2,3,maxN=-1,
method=list(path=path, exe=exe, method="OPT",primSuppRules= list(
list(type="freq", n=4, rg=20),
list(type="zero", rg=1)
)))
z3w <- EasyData("z3")
ProtectTable(z3,c(1:2,4,5),7,maxN=-1,
method=list(path=path, exe=exe, method="OPT",primSuppRules=list(list(type="freq", n=4, rg=20))))
# }
Run the code above in your browser using DataLab