Skip to content
mcorrell edited this page Jun 28, 2016 · 43 revisions

WikiAPI Reference

Datalib API Reference

Below is the list of all top-level datalib functions and properties, grouped by category.

  • dl.load - Load data from a URL or file.
  • dl.load.headers - Custom request headers to include with all HTTP requests.
  • dl.load.useXHR - Flag indicating if XMLHttpRequest should be used to load files.
  • dl.load.sanitizeURL - Checks URLs for validity prior to loading.
  • dl.read - Parse loaded data according to format types.
  • dl.type - Return first non-null type in an array of values.
  • dl.type.all - Return first non-null types for fields of an input data table.
  • dl.type.infer - Perform type inference over an array of values.
  • dl.type.inferAll - Perform type inference over an input data table.
  • dl.json - Load and parse JSON data.
  • dl.csv - Load and parse CSV (comma-separated values) data.
  • dl.tsv - Load and parse TSV (tab-separated values) data.
  • dl.dsv - Load and parse delimited text with a custom delimiter.
  • dl.topojson - Load and parse TopoJSON data.
  • dl.treejson - Load and parse JSON-format hierarchy data.
  • dl.count - Count the number of values.
  • dl.count.valid - Count the number of valid (non-null/undefined/NaN) values.
  • dl.count.missing - Count the number of null or undefined values.
  • dl.count.distinct - Count the number of distinct values.
  • dl.count.map - Construct a map of counts per distinct value.
  • dl.unique - Collect unique values.
  • dl.median - Compute the median of an array of numbers.
  • dl.quartile - Compute the quartile boundaries of an array of numbers.
  • dl.quantile - Compute the quantile of a sorted array of numbers.
  • dl.sum - Compute the sum of an array of numbers.
  • dl.mean - Compute the mean (average) of an array of numbers.
  • dl.mean.geometric - Compute the geometric mean of an array of positive numbers.
  • dl.mean.harmonic - Compute the harmonic mean of an array of numbers.
  • dl.variance - Compute the sample variance of an array of numbers.
  • dl.stdev - Compute the sample standard deviation of an array of numbers.
  • dl.modeskew - Compute the Pearson mode skewness of an array of numbers.
  • dl.min - Find the minimum value of an array of values.
  • dl.max - Find the maximum value of an array of values.
  • dl.extent - Find the minimum and maximum of an array of values.
  • dl.extent.index - Find the integer indices of the minimum and maximum values.
  • dl.dot - Compute the dot product of two arrays of numbers.
  • dl.rank - Compute ascending rank scores for an array of values.
  • dl.cor - Compute the sample product-moment correlation of two arrays of numbers.
  • dl.cor.rank - Compute the Spearman rank correlation of two arrays of values.
  • dl.cor.dist - Compute the distance correlation of two arrays of numbers.
  • dl.dist - Compute the vector distance between two arrays of numbers.
  • dl.dist.mat - Construct a mean-centered distance matrix for an array of numbers.
  • dl.covariance - Compute the covariance between two arrays of numbers.
  • dl.cohensd - Compute Cohen's d effect size between two arrays of numbers.
  • dl.entropy - Compute the Shannon entropy of an array of counts.
  • dl.mutual - Compute mutual information and distance statistics.
  • dl.mutual.info - Compute the mutual information between discrete variables.
  • dl.mutual.dist - Compute the information distance between discrete variables.
  • dl.bins - Determine quantitative bins (e.g., for a histogram).
  • dl.bins.date - Determine bins over common date/time units.
  • dl.$bin - Create an accessor that maps values to binned values.
  • dl.histogram - Compute a histogram for an array of values.
  • dl.profile - Compute a profile of summary statistics for a variable.
  • dl.summary - Compute profiles for all variables in a data set.
  • dl.number - Coerce a value to a number, ignoring nulls.
  • dl.boolean - Coerce a value to a Boolean, ignoring nulls.
  • dl.date - Coerce (parse) a value to a Date, ignoring nulls.
  • dl.array - Wrap non-array values in a single-element array, ignoring nulls.
  • dl.str - Coerce values to JSON-style strings with escaped quotes.
  • dl.duplicate - Create a deep duplicate of an object.
  • dl.equal - Check if two objects are deeply equal.
  • dl.extend - Extend an object with the properties of another.
  • dl.keys - Extract an array of an Object's keys.
  • dl.vals - Extract an array of an Object's values.
  • dl.toMap - Generate a boolean map Object from an array.
  • dl.field - Parse a string property descriptor (e.g., "foo.bar") to an array.
  • dl.accessor - Parse a string property descriptor to an accessor (getter) function.
  • dl.$ - A shorthand alias for dl.accessor.
  • dl.mutator - Parse a string property descriptor to a mutator (setter) function.
  • dl.$valid - Create an accessor that indicates if an extracted value is valid.
  • dl.$length - Create an accessor that extracts the length of String or Array values.
  • dl.$in - Create an accessor that tests if an extracted value is contained in a set.
  • dl.$year - Create an accessor that extracts the year from Date values.
  • dl.$utcYear - Create an accessor that extracts the UTC year from Date values.
  • dl.$month - Create an accessor that extracts the month from Date values.
  • dl.$utcMonth - Create an accessor that extracts the UTC month from Date values.
  • dl.$date - Create an accessor that extracts the day of the month from Date values.
  • dl.$utcDate - Create an accessor that extracts the UTC day of the month from Date values.
  • dl.$day - Create an accessor that extracts the day of the week from Date values.
  • dl.$utcDay - Create an accessor that extracts the UTC day of the week from Date values.
  • dl.$hour - Create an accessor that extracts the hour from Date values.
  • dl.$utcHour - Create an accessor that extracts the UTC hour from Date values.
  • dl.$minute - Create an accessor that extracts the minute from Date values.
  • dl.$utcMinute - Create an accessor that extracts the UTC minute from Date values.
  • dl.comparator - Generate a comparison function based on provided fields.
  • dl.cmp - Default comparison function across data types.
  • dl.numcmp - Default comparison function for numerical data.
  • dl.stablesort - Sorting method with guaranteed stable ordering.
  • dl.permute - Fisher-Yates permutation of an array.
  • dl.keystr - Map an array of values to a string to use as a hash key.
  • dl.pad - Pads a string to a specified length.
  • dl.truncate - Truncate a string value to limit its length.
  • dl.identity - Identity function that simply returns an input value.
  • dl.length - Function that returns the length of a String or Array.
  • dl.true - Function that simply returns true.
  • dl.false - Function that simply returns false.
  • dl.template - Generate a string template function for data objects.