if (FALSE) {
# ==== Example 1 , 8 regions ====
z1 <- EasyData("z1")
ProtectTable(z1,1:2, 3)
ProtectTableData(z1,1:2, 3)
ProtectTable(z1, c("region","hovedint"), "ant") # Input by name
# --- Unstacked input data ---
z1w = EasyData("z1w")
ProtectTable(z1w, 1, 2:5)
ProtectTableData(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, method ="Simple")
# ==== 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
# ==== 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
z3wb <- EasyData("z3wb")
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 ====
exeArgus <- "C:/TauArgus4.1.4/TauArgus.exe" # Change to TauArgus.exe-path in your computer
pathArgus <- "C:/Users/nnn/Documents" # Change to an existing folder
z1 = EasyData("z1")
ProtectTable(z1,1:2,3,method=list(exe=exeArgus, path=pathArgus, typ="tabular", method="OPT"))
ProtectTable(z1,1:2,3,method=list(exe=exeArgus, path=pathArgus, typ="tabular", method="MOD"))
ProtectTable(z1,1:2,3,method=list(exe=exeArgus, path=pathArgus, typ="tabular", method="GH"))
ProtectTable(z1,1:2,3,maxN=-1,
method=list(path=pathArgus, exe=exeArgus, method="OPT",
primSuppRules= list(list(type="freq", n=4, rg=20))))
z3 <- EasyData("z3")
ProtectTable(z3,c(1:2,4,5),7,maxN=-1,
method=list(path=pathArgus, exe=exeArgus, method="OPT",
primSuppRules=list(list(type="freq", n=4, rg=20))))
# ==== Examples with parameter dimList ====
z2 <- EasyData("z2")
dList <- FindDimLists(z2[-5])
ProtectTable(z2[, c(1,4,5)], 1:2, 3, dimList = dList[c(1,3)])
ProtectTable(z2[, c(1,4,5)], 1:2, 3, dimList = dList[2])
ProtectTable(z2[, c(1,4,5)], 1:2, 3, dimList = DimList2Hrc(dList[c(2,3)]))
}
Run the code above in your browser using DataLab