Did you know ... Search Documentation:
Pack rserve_client -- prolog/r/r_data.pl
PublicShow source

This library provides predicates for creating and fetching R data frames. R data frames are typically 2-dimensional arrays where the data is organised in columns. In Prolog, data is typically organised in rows (or records).

 r_data_frame(+Rvar, +Columns, :Goal) is det
Create an R data.frame from the solutions of Goal. The resulting data frame is bound to the R variable Rvar. For example:
?- r_data_frame(movieyear,
                [movie=Name, year=Year],
                movie(Name, Year)).
Arguments:
Rvar- is the name of the R output variable
Columns- is a list Name=Var
 r_data_frame_to_rows(+DataFrame, +Functor, -Rows) is det
Translate a 2-dimensional R dataframe into a list of compound terms, each representing a row. The functor of each row is Functor. For example:
?- r_data_frame_to_rows(mtcars, car, Rows).
Rows = [ car(21.0, 6, 160.0, 110, 3.9, 2.62, 16.46, 0, 1, 4, 4),
         ...
       ].
 r_data_frame_from_rows(+DataFrame, +Rows) is det
Assign the R variable DataFrame the content of Rows. Rows is a list of compound terms.
 r_data_frame_colnames(+DataFrame, -ColNames:list(atom)) is det
ColNames are the column names for DataFrame as a list of atoms.
 r_data_frame_rownames(+DataFrame, -RowNames:list(atom)) is det
RowNames are the row names for DataFrame as a list of atoms.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 r_data_frame_from_dicts(Arg1, Arg2)
 r_data_frame_to_dicts(Arg1, Arg2)