MarcDatafield | R Documentation |
This is the base class used to store and interact with marc data fields
This class provides the base functionality for storing marc data, as well as providing methods to retrieve that data and convert it into other formats like data.frames
tag
Marc tag of the data field
ind_1
First indictator of the data field
ind_2
Second indictator of the data field
codes
Subfield codes in this data field
values
Subfield values of this data field
to_data_frame()
Simplifies this data field by coercing it into a data frame.
MarcDatafield$to_data_frame()
A data frame containing the contents of this data field
record <- MarcRecord$new() record$read_record("http://d-nb.info/gnd/11897792X/about/marcxml") data_field <- record$get_fields(tag = "550")[[1]] data_field$to_data_frame()
get_values()
Retrieves values for one or more codes from the data field
MarcDatafield$get_values(codes)
codes
The code or codes for which to retreive values. Must be a vector of size >= 1 and type character
Character vector containing the requested values if there are any, NA otherwise
record <- MarcRecord$new() record$read_record("http://d-nb.info/gnd/11897792X/about/marcxml") data_field <- record$get_fields(tag = "550")[[1]] data_field$get_values(c("i", "a"))
print()
Print method for a marc data field
MarcDatafield$print(...)
new()
Constructor method for a marc data field.
MarcDatafield$new(tag, ind_1, ind_2, codes, values)
tag
Optional. The tag of the data field.
ind_1
Optional. First indicator of the data field.
ind_2
Optional. Second indicator of the data field.
codes
Optional. Data codes of the data field.
values
Optional. Data values of the data field.
field <- MarcDatafield$new(tag = 550, ind_1 = " ", ind_2 = " ", codes = c("0", "a"), values = c("A value", "Another value")) field
clone()
The objects of this class are cloneable with this method.
MarcDatafield$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------
## Method `MarcDatafield$to_data_frame`
## ------------------------------------------------
record <- MarcRecord$new()
record$read_record("http://d-nb.info/gnd/11897792X/about/marcxml")
data_field <- record$get_fields(tag = "550")[[1]]
data_field$to_data_frame()
## ------------------------------------------------
## Method `MarcDatafield$get_values`
## ------------------------------------------------
record <- MarcRecord$new()
record$read_record("http://d-nb.info/gnd/11897792X/about/marcxml")
data_field <- record$get_fields(tag = "550")[[1]]
data_field$get_values(c("i", "a"))
## ------------------------------------------------
## Method `MarcDatafield$new`
## ------------------------------------------------
field <- MarcDatafield$new(tag = 550,
ind_1 = " ",
ind_2 = " ",
codes = c("0", "a"),
values = c("A value", "Another value"))
field
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.