Skip to main content

Data

Creating, loading, querying, manipulating, joining tables.

Constructors

new Data()

new Data(): Data

Returns

Data

Properties

PropertyModifierTypeDefault value
dbpublicDb...
demopublicDemoDatasets...
filespublicFiles...

Methods

callQuery()

callQuery(queryName, queryParameters, adHoc): Promise <FuncCall>

Parameters

ParameterTypeDefault value
queryNamestringundefined
queryParametersnull | objectnull
adHocbooleanfalse

Returns

Promise <FuncCall>

Source

src/data.ts:223


compareTables()

compareTables(t1, t2, keyColumns1, keyColumns2, valueColumns1, valueColumns2): object

Opens the visual table comparison tool. Sample: https://public.datagrok.ai/js/samples/data-frame/compare-tables

Parameters

ParameterType
t1DataFrame
t2DataFrame
keyColumns1string[]
keyColumns2string[]
valueColumns1string[]
valueColumns2string[]

Returns

object

MemberType
changedColumnsnumber
changedValuesnumber
diffTableDataFrame
missingRowsnumber
t1MissingRowsnumber
t2MissingRowsnumber

Source

src/data.ts:174


detectSemanticTypes()

detectSemanticTypes(t): Promise<void>

Parameters

ParameterType
tDataFrame

Returns

Promise<void>

Source

src/data.ts:227


getDemoTable()

getDemoTable(path): Promise <DataFrame>

Parameters

ParameterType
pathstring

Returns

Promise <DataFrame>

Source

src/data.ts:138


joinTables()

joinTables(t1, t2, keyColumns1, keyColumns2, valueColumns1, valueColumns2, joinType, inPlace): DataFrame

Merges two tables by the specified key columns.

Parameters

ParameterTypeDefault valueDescription
t1DataFrameundefineda table to join
t2DataFrameundefineda table to join
keyColumns1string[]undefinedkey column names from the first table
keyColumns2string[]undefinedkey column names from the second table
valueColumns1null | string[]nullcolumn names to copy from the first table. Pass null to add all columns, an empty array [] to not add any columns, or an array with column names to add them specifically.
valueColumns2null | string[]nullcolumn names to copy from the second table
joinType"left" | "right" | "inner" | "outer"JOIN_TYPE.INNERinner, outer, left, or right. See [DG.JOIN_TYPE]
inPlacebooleanfalsemerges content in-place into the source table

Returns

DataFrame

Sample: https://public.datagrok.ai/js/samples/data-frame/join-link/join-tables

Source

src/data.ts:202


linkTables()

linkTables(t1, t2, keyColumns1, keyColumns2, linkTypes, initialSync): void

Links tables by the specified key columns using the specified link types (such as "current row to filter", see DG.SYNC_TYPE). Tables are synchronized on the first change, set the initialSync option to reflect the current table state according to the sync type.

Parameters

ParameterTypeDefault value
t1DataFrameundefined
t2DataFrameundefined
keyColumns1string[]undefined
keyColumns2string[]undefined
linkTypes("row to row" | "row to selection" | "row to filter" | "mouse-over to selection" | "mouse-over to filter" | "filter to filter" | "filter to selection" | "selection to filter" | "selection to selection")[]undefined
initialSyncbooleanfalse

Returns

void

Source

src/data.ts:166


loadTable()

loadTable(csvUrl): Promise <DataFrame>

Loads table from the specified URL. Sample: https://public.datagrok.ai/js/samples/data-access/load-csv

Parameters

ParameterTypeDescription
csvUrlstring

Returns

Promise <DataFrame>

Source

src/data.ts:158


openTable()

openTable(id): Promise <DataFrame>

Opens a table by its id. Sample: https://public.datagrok.ai/js/samples/data-access/open-table-by-id

Parameters

ParameterTypeDescription
idstringtable GUID

Returns

Promise <DataFrame>

Source

src/data.ts:212


parseCsv()

parseCsv(csv, options?): DataFrame

Parses the CSV string.

Parameters

ParameterTypeDescription
csvstringThe content of the comma-separated values file.
options?CsvImportOptions

Returns

DataFrame

Source

src/data.ts:148


query()

query(queryName, queryParameters, adHoc): Promise<any>

Executes a parameterized query. Sample: https://public.datagrok.ai/js/samples/data-access/parameterized-query

Parameters

ParameterTypeDefault value
queryNamestringundefined
queryParametersnull | objectnull
adHocbooleanfalse

Returns

Promise<any>

Source

src/data.ts:219


testData()

testData(dataset, rows, columns): DataFrame

Creates a generic dataset with the defined number of rows and columns. [dataset] allowed values: "wells" - experimental plate wells: barcode, row, col, pos, volume, concentration, role "demog" - clinical study demographics data: subj, study, site, sex, race, disease, start date "biosensor": wearable sensor data: time, x, y, z, temp, eda "random walk": random walk data for the specified number of dimensions "geo": geographic coordinates given as latitude/longitude pairs: lat, lng, value

Parameters

ParameterTypeDefault value
dataset"wells" | "demog" | "biosensor" | "random walk" | "geo" | "molecules" | "dose-response"undefined
rowsnumber10000
columnsnumber3

Returns

DataFrame

Source

src/data.ts:134