File: convertListOfRowsToDataFrame.Rd

package info (click to toggle)
r-cran-bbmisc 1.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,256 kB
  • sloc: ansic: 176; sh: 9; makefile: 5
file content (42 lines) | stat: -rw-r--r-- 1,400 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/convertListOfRowsToDataFrame.R
\name{convertListOfRowsToDataFrame}
\alias{convertListOfRowsToDataFrame}
\title{Convert a list of row-vector of equal structure to a data.frame}
\usage{
convertListOfRowsToDataFrame(
  rows,
  strings.as.factors = NULL,
  row.names,
  col.names
)
}
\arguments{
\item{rows}{[\code{list}]\cr
List of rows. Each row is a list or vector of the same structure,
where all corresponding elements must have the same class.
It is allowed that in some rows some elements are not present, see above.}

\item{strings.as.factors}{[\code{logical(1)}]\cr
Convert character columns to factors?
Default is \code{default.stringsAsFactors()} for R < "4.1.0" and \code{FALSE} otherwise.}

\item{row.names}{[\code{character} | \code{integer} | \code{NULL}]\cr
Row names for result.
By default the names of the list \code{rows} are taken.}

\item{col.names}{[\code{character} | \code{integer}]\cr
Column names for result.
By default the names of an element of \code{rows} are taken.}
}
\value{
[\code{data.frame}].
}
\description{
Elements are arranged in columns according to their name in each
element of \code{rows}.
Variables that are not present in some row-lists, or encoded as \code{NULL}, are filled using NAs.
}
\examples{
convertListOfRowsToDataFrame(list(list(x = 1, y = "a"), list(x = 2, y = "b")))
}