as_dataframe_of_labels: Convert a linked data frame to labels

View source: R/resource.r

as_dataframe_of_labelsR Documentation

Convert a linked data frame to labels

Description

This takes a data frame containing ldf_resource or ldf_interval vectors and converts those vectors into labels.

Usage

as_dataframe_of_labels(d, ...)

Arguments

d

A linked data frame

...

Additional arguments passed to data.frame

Details

The labels will either be character vectors or factors depending on the value of default.stringsAsFactors(). This can be ridden by passing the argument stringsAsFactors=F.

Value

A data frame with labels in place of any ldf vectors

Examples

uris <- c("http://example.net/id/apple",
          "http://example.net/id/banana",
          "http://example.net/id/carrot")
labels <- c("Apple","Banana","Carrot")
description <- data.frame(uri=uris, label=labels)

linked_data_frame <- data.frame(fruit=resource(uris, description))
labelled_data_frame <- as_dataframe_of_labels(linked_data_frame, stringsAsFactors=FALSE)

Swirrl/linked-data-frames documentation built on Sept. 14, 2022, 6:15 p.m.