write_preflib {prefio} | R Documentation |
Write preferences
to .soc
, .soi
, .toc
or .toi
file types, as
defined by the PrefLib specification:
{PrefLib}: A Library for Preferences.
write_preflib(
x,
file = "",
title = NULL,
publication_date = NULL,
modification_type = NULL,
modification_date = NULL,
description = NULL,
relates_to = NULL,
related_files = NULL
)
x |
An |
file |
Either a character string naming the a file or a writeable,
open connection. The empty string |
title |
The title of the data file, for instance the name of the
election represented in the data file. If not provided, we check for the
presence of |
publication_date |
The date at which the data file was published for the
first time. If not provided, we check for the presence of
|
modification_type |
The modification type of the data: one of
|
modification_date |
The last time the data was modified. If not
provided, we check for the presence of |
description |
A description of the data file, providing additional
information about it. If not provided, we check for the presence of
|
relates_to |
The name of the data file that the current file relates to,
typically the source file in case the current file has been derived from
another one. If not provided, we check for the presence of
|
related_files |
The list of all the data files related to this one,
comma separated. If not provided, we check for the presence of
|
The file types supported are
Strict Orders - Complete List
Strict Orders - Incomplete List
Orders with Ties - Complete List
Orders with Ties - Incomplete List
The PrefLib format specification requires some additional metadata. Note
that the additional metadata required for the PrefLib specification is not
necessarily required for the write_preflib
method; any missing fields
required by the PrefLib format will simply show "NA".
The title of the data file, for instance the year of the election represented in the data file.
A description of the data file, providing additional information about it.
The name of the data file that the current file relates to, typically the source file in case the current file has been derived from another one.
The list of all the data files related to this one, comma separated.
The date at which the data file was published for the first time.
The modification type of the data. One of:
Data that has only been converted into a PrefLib format.
Data that has been induced from another context. For example, computing a pairwise relation from a set of strict total orders. No assumptions have been made to create these files, just a change in the expression language.
Data that has been imbued with extra information. For example, extending an incomplete partial order by placing all unranked candidates tied at the end.
Data that has been generated artificially.
The last time the data was modified.
In addition to these fields, some required PrefLib fields will be generated
automatically depending on arguments to write_preflib()
and the attributes
of the aggregated_preferences
object being written to file:
The name of the output file.
The data type (one of soc
, soi
, toc
or toi
).
The number of items.
X
The name of each item, where X
ranges from
0
to length(items)
.
The total number of orderings.
The number of distinct orderings.
Note that PrefLib refers to the items as "alternatives".
The "alternatives" in the output file will be the same as the "items" in the
aggregated_preferences
object.
No return value. Output will be written to file or stdout.