Connect to Causata and extract data.

Description

These functions open a connection to a Causata server, extract data, and close the connection.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
Connect(sql.server.host, sql.server.port, sql.username, sql.password, 
  group=NULL, verbose=FALSE)
  
## S3 method for class 'Connect'
GetData(conn, query, ...)

## S3 method for class 'Connect'
GetCausataData(conn, query, dependent.variable, ...)

## S3 method for class 'Connect'
GetRawData(conn, query, ...)

## S3 method for class 'CausataData'
GetQuery(this, ...)

## S3 method for class 'Connect'
GetNames(this, kind, ...)

## S3 method for class 'Connect'
Close(conn, ...)

Arguments

sql.server.host

The SQL server hostname. Contact your Causata Engagement Manager for the correct value.

sql.server.port

The SQL server port. Contact your Causata Engagement Manager for the correct value.

sql.username

Your Causata username. Contact your Causata Engagement Manager for the correct value.

sql.password

Your Causata password. Contact your Causata Engagement Manager for the correct value.

group

Configuration data from the group provided will be loaded from the configuration file. See LoadCausataConfig. If the same parameter is provided in the configuration file and the function argument then the function argument will take precedence.

verbose

If TRUE then the connection information will be printed to the screen.

conn

A connection object from Connect.

query

A query object from Query.

this

A CausataData object.

kind

The kind of variable name to return, valid values are 'display' and 'system'.

dependent.variable

See CausataData.

...

Unused arguments for other methods.

Details

  • Connect opens a SQL connection to a Causata server using functions from the RMySQL package.

  • GetData executes the provided query and returns data in a data frame.

  • GetCausataData executes the provided query and returns data in a CausataData object.

  • GetRawData returns unaltered data from the lower level query commands.

  • Close simply closes a database connection.

GetData and GetRawData return data encoded in different formats using the Causata SQL interface. GetData is consistent with Causata data exported into CSV files, so it should generally be used instead of GetRawData.

The default behavior when using SQL queries of Causata within R is that boolean data in Causata is returned as numeric (1=TRUE, 0=FALSE), and text data is returned as characters. The other functions, GetData and GetCausataData, convert boolean data to factors with level names "true" and "false", and return character data as factors. This is the same format as data exported from Causata to CSV files.

GetNames is used to return the system names or display names for Causata variables.

Value

Connect returns an object of class Connect. GetData and GetRawData return data frames, while GetCausataData returns an object of class CausataData. Finally, GetNames returns a character vector of variable names.

Author(s)

David Barker <support@causata.com>

See Also

Connect, Query, CausataData, RMySQL, LoadCausataConfig.

Examples

1
2
3
4
5
6
7
8
# This command requires a connection to a Causata server
# the example below is for illustration only
## Not run: 
conn <- Connect(hostname="example.causata.com", username="exampleuser", 
  password="examplepassword")
data <- GetData(conn, Query())
Close(conn)
## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.