Learn R Programming

cppcontainers (version 1.0.4)

type: Get data type

Description

Obtain the data type of a container.

Usage

type(x)

Value

A named character vector for CppMap, CppUnorderedMap, CppMultimap, and CppUnorderedMultimap objects. A character otherwise.

Arguments

x

A cppcontainers object.

Details

The available types are integer, double, string, and boolean. They correspond to the integer, numeric/ double, character, and logical types in R.

See Also

print, sorting, to_r.

Examples

Run this code
s <- cpp_set(4:6)
type(s)
# [1] "integer"

m <- cpp_unordered_map(c("hello", "world"), c(0.5, 1.5))
type(m)
#      key    value 
# "string" "double" 

Run the code above in your browser using DataLab