Learn R Programming

villager (version 2.0.0)

resource: Resource

Description

This is an object that represents a single resource.

Arguments

Methods

initialize()

Create a new resource

as_table()

Represents the current state of the resource as a tibble

Creates a new resource.

Public fields

name

The name of the resource

quantity

The quantity of the resource that exists

Methods


Method new()

Creates a new resource object

Usage

resource$new(name = NA, quantity = 0)

Arguments

name

The name of the resource

quantity

The quantity present Returns a data.frame representation of the resource


Method as_table()

Usage

resource$as_table()

Returns

A data.frame of resources


Method clone()

The objects of this class are cloneable with this method.

Usage

resource$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.