Download the PHP package fiedsch/data_util without Composer
On this page you can find all versions of the php package fiedsch/data_util. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fiedsch/data_util
More information about fiedsch/data_util
Files in fiedsch/data_util
Informations about the package data_util
Utilities
PHP classes and helpers that might be helpful when working with data files, variable name lists, etc.
Data\Helper
provides some static helper functions
Usage
Examples
Create a list of variable names
Create a list of variable names that might make it easier to write code in your favourite software for statistical analysis.
Create a list of file names
Comparing Lists
Notice: result are a lists, not sets (see e.g. union()!)
Creating data records
Combined usage with Helper
Working with data arrays read from a (CSV) file
If you are working with data records stored in PHP arrays--e.g. when reading lines from a CSV file--you might find it useful to access the entries by their "column name" rather than their numerical index. This is especially useful if the data originally "lives" in an Excel Spreadsheet where you have column names "A", "B", ...
To map "A", "B", ... to the respective array indices 0, 1, ... you can use
The inverse funtion to columnIndex()
is columnName()
which might also be useful when
dealing with column name to array index mappings.
Working with column name mappings
Assume, you have an array that maps (some) variable names to column names:
(with "some" meaning that the mapping does not have to be continous).
Now, if you prepend new columns in a data management step you need to adapt the mapping for the next step to match the new data:
Working with wave specifications
Experimental: might change in future versions!
Consider a survey that is conducted 12 times a year. We call "these waves" something like '01-2023'
, '02-2023'
, ..., '12-2023'
.
When we want to access the name of a wave "tree waves back", we want to move from '08-2023'
to '05-2023'
for example,
but '02-2023'to
'11-2022'` should also be computed correctly.
Use a different pattern like so:
All versions of data_util with dependencies
ext-ctype Version *
ext-mbstring Version *
ext-json Version *