INNER CODE UNIT · Python

_as_data_frame

briscverse/ryp · ryp.py:934

def _as_data_frame(result: _cffi_backend._CDataBase, rmemory: _RMemory) -> \
        _cffi_backend._CDataBase:
    """
    Convert an R list to data.frame; set check.names=FALSE to not name-mangle.
    
    Handle vctrs_unspecified: as.data.frame(list(a=vctrs::unspecified(1)))
    gives the error `cannot coerce class '"vctrs_unspecified"' to a data.frame`
    on Windows, so strip vctrs_unspecified beforehand and re-add after.
    
    Args:
        result: an R list
        rmemory: an instance of the _RMemory class

    Returns:
        result, converted to a data.frame.
    """
    if platform.system() == 'Windows':
        vctrs_unspecified_cols = []

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…