enc: Read coding tables in RDC

Usage Arguments Examples

Usage

1
enc(x)

Arguments

x

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x) 
{
    tonum <- function(x) as.numeric(gsub(",", "", as.character(x)))
    ff <- function(x) format(x, big.mark = ",")
    tran.table <- scan(what = list("character", "integer", "character", 
        "character"), flush = T)
    sam <- tonum(tran.table[[3]])
    pop <- tonum(tran.table[[4]])
    samp.pct <- 100 * (sam/pop)/(sum(sam, na.rm = T)/sum(pop, 
        na.rm = T))
    print(data.frame(Code = tran.table[[2]], Content = tran.table[[1]], 
        Sample = ff(sam), Popn = ff(pop), Sampling.Pct = round(samp.pct, 
            1)))
    tran(tran.table[[2]], tran.table[[1]], x, tofactor = T)
  }

gmonette/spida15 documentation built on May 17, 2019, 7:26 a.m.