isKey: Determine strength of linking variables

Description Usage Arguments Value See Also Examples

Description

This function computes the percentage of unique values of a column x from table1 that appear in in a table2. It is called and computed on the fly in tableNet. However, these computations can be slow on large datasets, so it is provided a standalone function that can be run once to store the output and fed into the tableNet app to prevent repetitive slow computations on the fly.

Usage

1
isKey(dfL, xvar)

Arguments

dfL

list of data.frames. easily generated from dir2dfList

xvar

character string, name of the variable to calculate strength for across all tables in dfL

printdf

prints progress of flat file loads to R console.

Value

list of data.frames

See Also

tableNet dir2dfList

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
## download some baseball data. NOTE This will download 30MB of data (25 csv files) into a temporary directory
temp <- tempfile()
localDataDir <- paste0(tempdir(), '\\lahman2012-csv-onYourComp.zip')
download.file('http://seanlahman.com/files/database/lahman2012-csv.zip', localDataDir)
unzip(localDataDir, exdir=paste0(tempdir(), '\\lahman2012-csv-onYourComp')) ## may not be necessary

## create a list of data.frames from .CSVs
dfL <- dir2dfList(paste0(tempdir(), '\\lahman2012-csv-onYourComp'), ext='.csv', exclude=NULL, sep=',', stringsAsFactors=F)
isKey(dfL, 'playerID')

## End(Not run)

brooksandrew/Rsenal documentation built on May 13, 2019, 7:50 a.m.