dataset

dataset

Synopsis

enum                DatasetStructure;
enum                DatasetMarkerType;
enum                VarinfoFlags;
enum                DatasetOp;
enum                DataCopyFlag;
#define             dataset_is_cross_section            (p)
#define             dataset_is_time_series              (p)
#define             dataset_is_seasonal                 (p)
#define             custom_time_series                  (p)
#define             dataset_is_daily                    (p)
#define             dataset_is_weekly                   (p)
#define             dataset_is_hourly                   (p)
#define             dataset_is_decennial                (p)
#define             dated_daily_data                    (p)
#define             dated_seven_day_data                (p)
#define             dated_weekly_data                   (p)
#define             calendar_data                       (p)
#define             quarterly_or_monthly                (p)
#define             dataset_is_panel                    (p)
#define             dataset_has_markers                 (p)
#define             var_is_discrete                     (p,
                                                         i)
#define             var_is_hidden                       (p,
                                                         i)
#define             var_is_generated                    (p,
                                                         i)
#define             var_is_listarg                      (p,
                                                         i)
#define             set_var_listarg                     (p,
                                                         i)
#define             unset_var_listarg                   (p,
                                                         i)
#define             series_set_flag                     (p,
                                                         i,
                                                         f)
#define             sample_size                         (p)
void                free_Z                              (double **Z,
                                                         const DATAINFO *pdinfo);
DATAINFO *          datainfo_new                        (void);
void                datainfo_init                       (DATAINFO *pdinfo);
DATAINFO *          create_new_dataset                  (double ***pZ,
                                                         int nvar,
                                                         int nobs,
                                                         int markers);
DATAINFO *          create_auxiliary_dataset            (double ***pZ,
                                                         int nvar,
                                                         int nobs);
void                destroy_dataset                     (double **Z,
                                                         DATAINFO *pdinfo);
void                clear_datainfo                      (DATAINFO *pdinfo,
                                                         int code);
int                 allocate_Z                          (double ***pZ,
                                                         const DATAINFO *pdinfo);
int                 dataset_allocate_varnames           (DATAINFO *pdinfo);
int                 dataset_allocate_obs_markers        (DATAINFO *pdinfo);
void                dataset_destroy_obs_markers         (DATAINFO *pdinfo);
void                dataset_obs_info_default            (DATAINFO *pdinfo);
void                copy_dataset_obs_info               (DATAINFO *targ,
                                                         const DATAINFO *src);
void                copy_varinfo                        (VARINFO *targ,
                                                         const VARINFO *src);
void                set_sorted_markers                  (DATAINFO *pdinfo,
                                                         int v,
                                                         char **S);
void                dataset_set_regular_markers         (DATAINFO *pdinfo);
int                 start_new_Z                         (double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int resample);
int                 is_trend_variable                   (const double *x,
                                                         int n);
int                 is_periodic_dummy                   (const double *x,
                                                         const DATAINFO *pdinfo);
int                 dataset_add_observations            (int newobs,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt);
int                 dataset_drop_observations           (int n,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);
int                 dataset_shrink_obs_range            (double ***pZ,
                                                         DATAINFO *pdinfo);
int                 dataset_add_series                  (int newvars,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);
int                 dataset_add_NA_series               (double ***pZ,
                                                         DATAINFO *pdinfo);
int                 dataset_add_allocated_series        (double *x,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);
int                 dataset_add_series_as               (double *x,
                                                         const char *newname,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);
int                 dataset_copy_variable_as            (int v,
                                                         const char *newname,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);
int                 overwrite_err                       (const char *name);
int                 series_is_parent                    (const DATAINFO *pdinfo,
                                                         int v);
int                 dataset_replace_series              (double **Z,
                                                         DATAINFO *pdinfo,
                                                         int v,
                                                         double *x,
                                                         const char *descrip,
                                                         DataCopyFlag flag);
int                 dataset_rename_series               (DATAINFO *pdinfo,
                                                         int v,
                                                         const char *name);
int                 dataset_drop_listed_variables       (int *list,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int *renumber,
                                                         PRN *prn);
int                 dataset_drop_variable               (int v,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);
int                 dataset_destroy_hidden_variables    (double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int vmin);
int                 dataset_drop_last_variables         (int delvars,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);
int                 dataset_renumber_variable           (int v_old,
                                                         int v_new,
                                                         double **Z,
                                                         DATAINFO *pdinfo);
int                 renumber_series_with_checks         (const char *s,
                                                         int fixmax,
                                                         double **Z,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn);
int                 maybe_prune_dataset                 (double ***pZ,
                                                         DATAINFO **ppdinfo,
                                                         void *p);
int                 dataset_stack_variables             (const char *vname,
                                                         const char *line,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn);
int                 dataset_sort_by                     (const int *list,
                                                         double **Z,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt);
int                 is_log_variable                     (int i,
                                                         const DATAINFO *pdinfo,
                                                         char *parent);
void                set_var_discrete                    (DATAINFO *pdinfo,
                                                         int i,
                                                         int s);
void                set_var_scalar                      (DATAINFO *pdinfo,
                                                         int i,
                                                         int s);
void                set_var_hidden                      (DATAINFO *pdinfo,
                                                         int i);
void                var_set_linewidth                   (DATAINFO *pdinfo,
                                                         int i,
                                                         int w);
int                 var_get_linewidth                   (const DATAINFO *pdinfo,
                                                         int i);
int                 var_set_display_name                (DATAINFO *pdinfo,
                                                         int i,
                                                         const char *s);
int                 var_set_description                 (DATAINFO *pdinfo,
                                                         int i,
                                                         const char *s);
int                 var_set_compact_method              (DATAINFO *pdinfo,
                                                         int i,
                                                         int method);
const char *        var_get_graph_name                  (const DATAINFO *pdinfo,
                                                         int i);
unsigned int        get_resampling_seed                 (void);
int                 dataset_resample                    (int n,
                                                         unsigned int seed,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);
int                 dataset_op_from_string              (const char *s);
int                 modify_dataset                      (int op,
                                                         const int *list,
                                                         const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn);
int                 dataset_get_structure               (const DATAINFO *pdinfo);
int                 panel_sample_size                   (const DATAINFO *pdinfo);
int                 multi_unit_panel_sample             (const DATAINFO *pdinfo);
int                 dataset_purge_missing_rows          (double **Z,
                                                         DATAINFO *pdinfo);
int                 check_dataset_is_changed            (void);
void                set_dataset_is_changed              (void);

Description

Details

enum DatasetStructure

typedef enum {
    DATA_NONE,
    DATA_XSECT,
    DATA_TS,
    DATA_PANEL
} DatasetStructure;


enum DatasetMarkerType

typedef enum {
    NO_MARKERS = 0,
    REGULAR_MARKERS,
    DAILY_DATE_STRINGS
} DatasetMarkerType;


enum VarinfoFlags

typedef enum {
    VAR_DISCRETE   = 1 << 0,
    VAR_HIDDEN     = 1 << 1,
    VAR_GENERATED  = 1 << 2,
    VAR_LISTARG    = 1 << 3
} VarinfoFlags;


enum DatasetOp

typedef enum {
    DS_NONE,
    DS_ADDOBS,
    DS_COMPACT,
    DS_EXPAND,
    DS_TRANSPOSE,
    DS_DELETE,
    DS_KEEP,
    DS_SORTBY,
    DS_DSORTBY,
    DS_RESAMPLE,
    DS_RESTORE,
    DS_CLEAR,
    DS_RENUMBER,
    DS_INSOBS
} DatasetOp;


enum DataCopyFlag

typedef enum {
    DS_COPY_VALUES,
    DS_GRAB_VALUES
} DataCopyFlag;


dataset_is_cross_section()

#define dataset_is_cross_section(p) (p != NULL && p->structure == CROSS_SECTION)

Attempt to determine whether a data set contains cross-sectional data (1) or not (0).

p :

pointer to data information struct.

dataset_is_time_series()

#define             dataset_is_time_series(p)

Attempt to determine whether a data set contains time series data (1) or not (0).

p :

pointer to data information struct.

dataset_is_seasonal()

#define             dataset_is_seasonal(p)

Attempt to determine whether a data set contains seasonal time series data (1) or not (0).

p :

pointer to data information struct.

custom_time_series()

#define custom_time_series(p) (p != NULL && p->structure == SPECIAL_TIME_SERIES)

Attempt to determine whether a data set contains time series data with custom (non-standard) frequency (1) or not (0).

p :

pointer to data information struct.

dataset_is_daily()

#define             dataset_is_daily(p)

Attempt to determine whether a data set contains daily time series data (1) or not (0).

p :

pointer to data information struct.

dataset_is_weekly()

#define             dataset_is_weekly(p)

Attempt to determine whether a data set contains weekly time series data (1) or not (0).

p :

pointer to data information struct.

dataset_is_hourly()

#define             dataset_is_hourly(p)

Attempt to determine whether a data set contains hourly time series data (1) or not (0).

p :

pointer to data information struct.

dataset_is_decennial()

#define             dataset_is_decennial(p)

Attempt to determine whether a data set contains decennial time series data (1) or not (0).

p :

pointer to data information struct.

dated_daily_data()

#define             dated_daily_data(p)

Attempt to determine whether a data set contains dated daily time series data (1) or not (0).

p :

pointer to data information struct.

dated_seven_day_data()

#define             dated_seven_day_data(p)

Attempt to determine whether a data set contains dated daily (seven-day) time series data (1) or not (0).

p :

pointer to data information struct.

dated_weekly_data()

#define             dated_weekly_data(p)

Attempt to determine whether a data set contains dated weekly time series data (1) or not (0).

p :

pointer to data information struct.

calendar_data()

#define             calendar_data(p)

Attempt to determine whether a data set uses calendar dates for observation strings (1) or not (0).

p :

pointer to data information struct.

quarterly_or_monthly()

#define             quarterly_or_monthly(p)

Attempt to determine whether a data set is a quarterly or monthly time series (1), or something else (0).

p :

pointer to data information struct.

dataset_is_panel()

#define dataset_is_panel(p) (p != NULL && p->structure == STACKED_TIME_SERIES)

Attempt to determine whether a data set contains panel data (1) or not (0).

p :

pointer to data information struct.

dataset_has_markers()

#define dataset_has_markers(p) (p != NULL && p->markers && p->S != NULL)

Determine whether a data set has observation marker strings (1) or not (0).

p :

pointer to data information struct.

var_is_discrete()

#define var_is_discrete(p, i) (p->varinfo[i]->flags & VAR_DISCRETE)

Determine whether a variable should be treated as discrete or not.

p :

pointer to data information struct.

i :

index number of variable.

var_is_hidden()

#define var_is_hidden(p, i) (p->varinfo[i]->flags & VAR_HIDDEN)

Determine whether or not a variable is hidden.

p :

pointer to data information struct.

i :

index number of variable.

var_is_generated()

#define var_is_generated(p, i) (p->varinfo[i]->flags & VAR_GENERATED)

Determine whether or not a variable was generated using a formula or transformation function.

p :

pointer to data information struct.

i :

index number of variable.

var_is_listarg()

#define var_is_listarg(p, i) (p->varinfo[i]->flags & VAR_LISTARG)

Determine whether or not a variable has been marked as belonging to a list argument to a function.

p :

pointer to data information struct.

i :

index number of variable.

set_var_listarg()

#define set_var_listarg(p, i) (p->varinfo[i]->flags |= VAR_LISTARG)

Set the "listarg" flag on the given variable.

p :

pointer to data information struct.

i :

index number of variable.

unset_var_listarg()

#define unset_var_listarg(p, i) (p->varinfo[i]->flags &= ~VAR_LISTARG)

Remove the "listarg" flag from the given variable.

p :

pointer to data information struct.

i :

index number of variable.

series_set_flag()

#define series_set_flag(p, i, f) (p->varinfo[i]->flags |= f)

Set the given flag on the given (series) variable.

p :

pointer to data information struct.

i :

index number of variable.

f :

flag to set.

sample_size()

#define sample_size(p) ((p == NULL)? 0 : (p->t2 - p->t1 + 1))


free_Z ()

void                free_Z                              (double **Z,
                                                         const DATAINFO *pdinfo);

Does a deep free on the data matrix.

Z :

data matrix.

pdinfo :

dataset information.

datainfo_new ()

DATAINFO *          datainfo_new                        (void);

Creates a new data information struct pointer from scratch, properly initialized as empty (no variables, no observations).

Returns :

pointer to data information struct, or NULL on error.

datainfo_init ()

void                datainfo_init                       (DATAINFO *pdinfo);

Zeros all members of pdinfo and sets it as a plain cross-section. Designed for use with a DATAINFO structure that has not been obtained via datainfo_new().

pdinfo :

pointer to DATAINFO struct.

create_new_dataset ()

DATAINFO *          create_new_dataset                  (double ***pZ,
                                                         int nvar,
                                                         int nobs,
                                                         int markers);

Allocates space in the two-dimensional array to which pZ points, to hold the specified number of variables and observations. Also allocates a new dataset information struct that matches the dimensions of the data array.

pZ :

pointer to data array.

nvar :

number of variables.

nobs :

number of observations per variable.

markers :

1 if space should be allocated for "case markers" for the observations, 0 otherwise.

Returns :

pointer to data information struct, or NULL on error.

create_auxiliary_dataset ()

DATAINFO *          create_auxiliary_dataset            (double ***pZ,
                                                         int nvar,
                                                         int nobs);


destroy_dataset ()

void                destroy_dataset                     (double **Z,
                                                         DATAINFO *pdinfo);

Frees all resources associated with Z and pdinfo, including the pointers Z and pdinfo themselves.

Z :

data array.

pdinfo :

dataset information struct.

clear_datainfo ()

void                clear_datainfo                      (DATAINFO *pdinfo,
                                                         int code);

Frees the allocated content of a data information struct; note that pdinfo itself is not freed.

pdinfo :

data information struct.

code :

either CLEAR_FULL or CLEAR_SUBSAMPLE.

allocate_Z ()

int                 allocate_Z                          (double ***pZ,
                                                         const DATAINFO *pdinfo);

Allocates the two-dimensional array to which pZ points, based on the v (number of variables) and n (number of observations) members of pdinfo. The variable at position 0 is initialized to all 1s; other variables are initialized to NADBL.

pZ :

pointer to data array.

pdinfo :

dataset information struct.

Returns :

0 on success, E_ALLOC on error.

dataset_allocate_varnames ()

int                 dataset_allocate_varnames           (DATAINFO *pdinfo);

Given a blank pdinfo, which should have been obtained using datainfo_new(), allocate space for the names of variables. The v member of pdinfo (representing the number of variables, including the automatically added constant at position 0) must be set before calling this function.

pdinfo :

dataset information struct.

Returns :

0 on sucess, E_ALLOC on failure.

dataset_allocate_obs_markers ()

int                 dataset_allocate_obs_markers        (DATAINFO *pdinfo);

Allocates space in pdinfo for strings indentifying the observations and initializes all of the markers to empty strings. Note that These strings have a fixed maximum length of OBSLEN - 1.

pdinfo :

dataset information struct

Returns :

0 on success, E_ALLOC on error.

dataset_destroy_obs_markers ()

void                dataset_destroy_obs_markers         (DATAINFO *pdinfo);

Frees any allocated observation markers for pdinfo.

pdinfo :

data information struct.

dataset_obs_info_default ()

void                dataset_obs_info_default            (DATAINFO *pdinfo);

Sets the "date" or observations information in pdinfo to a simple default of cross-sectional data, observations 1 to n, where n is the n element (number of observations) in pdinfo.

pdinfo :

dataset information struct.

copy_dataset_obs_info ()

void                copy_dataset_obs_info               (DATAINFO *targ,
                                                         const DATAINFO *src);

Sets the "date" or observations information in targ to that found in src.

targ :

target dataset information struct.

src :

source dataset information struct.

copy_varinfo ()

void                copy_varinfo                        (VARINFO *targ,
                                                         const VARINFO *src);

Copies all relevant information from src to targ.

targ :

target to which to copy.

src :

source to copy from.

set_sorted_markers ()

void                set_sorted_markers                  (DATAINFO *pdinfo,
                                                         int v,
                                                         char **S);


dataset_set_regular_markers ()

void                dataset_set_regular_markers         (DATAINFO *pdinfo);


start_new_Z ()

int                 start_new_Z                         (double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int resample);

Initializes the data matrix pointed to by pZ (adding the constant in position 0) and the data information struct pdinfo.

pZ :

pointer to data matrix.

pdinfo :

data information struct.

resample :

1 if we're sub-sampling from a full data set, 0 otherwise.

Returns :

0 on successful completion, non-zero on error.

is_trend_variable ()

int                 is_trend_variable                   (const double *x,
                                                         int n);

x :

array to examine.

n :

number of elements in array.

Returns :

1 if x is a simple linear trend variable, with each observation equal to the preceding observation plus 1, or if x is a quadratic trend starting at 1 for the first observation in the data set, and 0 otherwise.

is_periodic_dummy ()

int                 is_periodic_dummy                   (const double *x,
                                                         const DATAINFO *pdinfo);

x :

array to examine.

pdinfo :

pointer to dataset information struct.

Returns :

1 if x is a periodic dummy variable, 0 otherwise.

dataset_add_observations ()

int                 dataset_add_observations            (int newobs,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt);

Extends all series in the dataset by the specified number of extra observations. The added values are initialized to the missing value code, NADBL, with the exception of simple deterministic variables when OPT_A is given.

newobs :

number of observations to add.

pZ :

pointer to data array.

pdinfo :

dataset information.

opt :

use OPT_A to attempt to recognize and automatically extend simple deterministic variables such as a time trend and periodic dummy variables; use OPT_D to drop any observation markers rather than expanding the set of markers and padding it out with dummy values.

Returns :

0 on success, non-zero code on error.

dataset_drop_observations ()

int                 dataset_drop_observations           (int n,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);

Deletes n observations from the end of each series in the dataset.

n :

number of observations to drop.

pZ :

pointer to data array.

pdinfo :

dataset information.

Returns :

0 on success, non-zero code on error.

dataset_shrink_obs_range ()

int                 dataset_shrink_obs_range            (double ***pZ,
                                                         DATAINFO *pdinfo);

Truncates the range of observations in the dataset, based on the current values of the t1 and t2 members of pdinfo.

pZ :

pointer to data array.

pdinfo :

dataset information.

Returns :

0 on success, non-zero code on error.

dataset_add_series ()

int                 dataset_add_series                  (int newvars,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);

Adds space for the specified number of additional series in the dataset. Values are initialized to zero.

newvars :

number of series to add.

pZ :

pointer to data array.

pdinfo :

dataset information.

Returns :

0 on success, E_ALLOC on error.

dataset_add_NA_series ()

int                 dataset_add_NA_series               (double ***pZ,
                                                         DATAINFO *pdinfo);

Adds space for one additional series in the dataset; the values of the new series are initialized to NADBL.

pZ :

pointer to data array.

pdinfo :

dataset information.

Returns :

0 on success, E_ALLOC on error.

dataset_add_allocated_series ()

int                 dataset_add_allocated_series        (double *x,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);

Adds x as an additional series in the dataset. The array x is not copied; it should be treated as belonging to pZ after this operation.

x :

one-dimensional data array.

pZ :

pointer to data array.

pdinfo :

dataset information.

Returns :

0 on success, E_ALLOC on error.

dataset_add_series_as ()

int                 dataset_add_series_as               (double *x,
                                                         const char *newname,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);

Adds to the dataset a new series with name newname and values given by x. The new variable is added at one level "deeper" (in terms of function execution) than the current level. This is for use with user-defined functions.

x :

array to be added.

newname :

name to give the new variable.

pZ :

pointer to data array.

pdinfo :

dataset information.

Returns :

0 on success, E_ALLOC on error.

dataset_copy_variable_as ()

int                 dataset_copy_variable_as            (int v,
                                                         const char *newname,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);

Makes a copy of variable v under the name newname. The copy exists in a variable namespace one level "deeper" (in terms of function execution) than the variable being copied. This is for use with user-defined functions: a variable supplied to a function as an argument is copied into the function's namespace under the name it was given as a parameter.

v :

index number of variable to copy.

newname :

name to give the copy.

pZ :

pointer to data array.

pdinfo :

dataset information.

Returns :

0 on success, E_ALLOC on error.

overwrite_err ()

int                 overwrite_err                       (const char *name);


series_is_parent ()

int                 series_is_parent                    (const DATAINFO *pdinfo,
                                                         int v);

pdinfo :

dataset information.

v :

ID number of variable to test.

Returns :

1 if variable v is "parent" to a transformed variable (e.g. a log, lag or difference), othewise 0.

dataset_replace_series ()

int                 dataset_replace_series              (double **Z,
                                                         DATAINFO *pdinfo,
                                                         int v,
                                                         double *x,
                                                         const char *descrip,
                                                         DataCopyFlag flag);

Replaces the description and numerical content of series v with the information provided.

Z :

data array.

pdinfo :

dataset information.

v :

ID number of the series to be replaced.

x :

replacement values.

descrip :

replacement description.

flag :

if = DS_GRAB_VALUES then replace Z[v] with x, otherwise copy the values the values in x to Z[v];

Returns :

0 on success, non-zero on error.

dataset_rename_series ()

int                 dataset_rename_series               (DATAINFO *pdinfo,
                                                         int v,
                                                         const char *name);

pdinfo :

dataset information.

v :

ID number of the variable to be renamed.

name :

new name to give the variable.

Returns :

0 on success, non-zero on error.

dataset_drop_listed_variables ()

int                 dataset_drop_listed_variables       (int *list,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int *renumber,
                                                         PRN *prn);

Deletes the variables given in list from the dataset. Remaining variables may have their ID numbers changed as a consequence. If renumber is not NULL, this location receives 1 in case variables have been renumbered, 0 otherwise.

list :

list of variable to drop, by ID number.

pZ :

pointer to data array.

pdinfo :

dataset information.

renumber :

location for return of information on whether remaining variables have been renumbered as a result, or NULL.

prn :

pointer to printing struct.

Returns :

0 on success, E_ALLOC on error.

dataset_drop_variable ()

int                 dataset_drop_variable               (int v,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);

Deletes variable v from the dataset.

v :

ID number of variable to drop.

pZ :

pointer to data array.

pdinfo :

dataset information.

Returns :

0 on success, E_ALLOC on error.

dataset_destroy_hidden_variables ()

int                 dataset_destroy_hidden_variables    (double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         int vmin);

Deletes from the dataset any "hidden" variables that have been added automatically (for example, auto-generated variables used for the x-axis in graph plotting), and that have ID numbers greater than or equal to vmin. Never deletes the automatically generated constant (ID number 0).

pZ :

pointer to data array.

pdinfo :

dataset information.

vmin :

do not drop variables with ID numbers less than this.

Returns :

0 on success, E_ALLOC on error.

dataset_drop_last_variables ()

int                 dataset_drop_last_variables         (int delvars,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);

Deletes from the dataset the number delvars of variables that were added most recently (that have the highest ID numbers).

delvars :

number of variables to be dropped.

pZ :

pointer to data array.

pdinfo :

dataset information.

Returns :

0 on success, E_ALLOC on error.

dataset_renumber_variable ()

int                 dataset_renumber_variable           (int v_old,
                                                         int v_new,
                                                         double **Z,
                                                         DATAINFO *pdinfo);

Moves the variable that was originally at position v_old in the datset to position v_new, renumbering other variables as required.

v_old :

original ID number of variable.

v_new :

new ID number.

Z :

data array.

pdinfo :

dataset information.

Returns :

0 on success, error code on error;

renumber_series_with_checks ()

int                 renumber_series_with_checks         (const char *s,
                                                         int fixmax,
                                                         double **Z,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn);


maybe_prune_dataset ()

int                 maybe_prune_dataset                 (double ***pZ,
                                                         DATAINFO **ppdinfo,
                                                         void *p);


dataset_stack_variables ()

int                 dataset_stack_variables             (const char *vname,
                                                         const char *line,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn);

Really for internal use. Don't worry about it.

vname :

name for new variable, to be produced by stacking.

line :

instructions for stacking existing variables.

pZ :

pointer to data array.

pdinfo :

dataset information.

prn :

printing apparatus.

Returns :

0 on success, non-zero code on error.

dataset_sort_by ()

int                 dataset_sort_by                     (const int *list,
                                                         double **Z,
                                                         DATAINFO *pdinfo,
                                                         gretlopt opt);


is_log_variable ()

int                 is_log_variable                     (int i,
                                                         const DATAINFO *pdinfo,
                                                         char *parent);

Tries to determine if the variable with ID number i is the logarithm of some other variable.

i :

ID number of variable.

pdinfo :

dataset information.

parent :

location to which to write the name of the "parent" variable if any.

Returns :

1 if variable i appears to be a log, else 0.

set_var_discrete ()

void                set_var_discrete                    (DATAINFO *pdinfo,
                                                         int i,
                                                         int s);

Mark a variable as being discrete or not.

pdinfo :

pointer to data information struct.

i :

index number of variable.

s :

non-zero to mark variable as discrete, zero to mark as not discrete.

set_var_scalar ()

void                set_var_scalar                      (DATAINFO *pdinfo,
                                                         int i,
                                                         int s);


set_var_hidden ()

void                set_var_hidden                      (DATAINFO *pdinfo,
                                                         int i);

Mark a variable as being "hidden" (an automatically generated variable that will not be shown in the main GUI window).

pdinfo :

pointer to data information struct.

i :

index number of variable.

var_set_linewidth ()

void                var_set_linewidth                   (DATAINFO *pdinfo,
                                                         int i,
                                                         int w);

Set the line width for use when this variable is displayed in a line graph.

pdinfo :

pointer to data information struct.

i :

index number of variable.

w :

with of plot line.

var_get_linewidth ()

int                 var_get_linewidth                   (const DATAINFO *pdinfo,
                                                         int i);

pdinfo :

pointer to data information struct.

i :

index number of variable.

Returns :

the line width set for use when graphing variable i.

var_set_display_name ()

int                 var_set_display_name                (DATAINFO *pdinfo,
                                                         int i,
                                                         const char *s);


var_set_description ()

int                 var_set_description                 (DATAINFO *pdinfo,
                                                         int i,
                                                         const char *s);


var_set_compact_method ()

int                 var_set_compact_method              (DATAINFO *pdinfo,
                                                         int i,
                                                         int method);


var_get_graph_name ()

const char *        var_get_graph_name                  (const DATAINFO *pdinfo,
                                                         int i);


get_resampling_seed ()

unsigned int        get_resampling_seed                 (void);


dataset_resample ()

int                 dataset_resample                    (int n,
                                                         unsigned int seed,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo);


dataset_op_from_string ()

int                 dataset_op_from_string              (const char *s);


modify_dataset ()

int                 modify_dataset                      (int op,
                                                         const int *list,
                                                         const char *s,
                                                         double ***pZ,
                                                         DATAINFO *pdinfo,
                                                         PRN *prn);


dataset_get_structure ()

int                 dataset_get_structure               (const DATAINFO *pdinfo);


panel_sample_size ()

int                 panel_sample_size                   (const DATAINFO *pdinfo);

pdinfo :

pointer to data information struct.

Returns :

the numbers of units/individuals in the current sample range, or 0 if the dataset is not a panel.

multi_unit_panel_sample ()

int                 multi_unit_panel_sample             (const DATAINFO *pdinfo);

pdinfo :

pointer to data information struct.

Returns :

1 if the dataset is a panel and the current sample range includes two or more individuals, otherwise 0.

dataset_purge_missing_rows ()

int                 dataset_purge_missing_rows          (double **Z,
                                                         DATAINFO *pdinfo);

Removes empty rows from the dataset -- that is, observations at which there are no non-missing values. This is intended for daily data only.

Z :

data array.

pdinfo :

pointer to data information struct.

Returns :

0 on success, non-zero code on error.

check_dataset_is_changed ()

int                 check_dataset_is_changed            (void);

Returns :

1 if the current dataset has been modified since the last call to this function, or since the library was initialized if this function has not yet been called; otherwise 0.

set_dataset_is_changed ()

void                set_dataset_is_changed              (void);

Sets the internal "dataset changed" flag to 1