put.attr.gdsn: Add an attribute into a GDS node

View source: R/gdsfmt-main.r

put.attr.gdsnR Documentation

Add an attribute into a GDS node

Description

Add an attribute to a GDS node.

Usage

put.attr.gdsn(node, name, val=NULL)

Arguments

node

an object of class gdsn.class, a GDS node

name

the name of an attribute

val

the value of an attribute, or a gdsn.class object

Details

Missing values are allowed in a numerical attribute, but not allowed for characters or logical values. Missing characters are converted to "NA", and missing logical values are converted to FALSE.

If val is a gdsn.class object, copy all attributes to node.

Value

None.

Author(s)

Xiuwen Zheng

See Also

get.attr.gdsn, delete.attr.gdsn

Examples

# cteate a GDS file
f <- createfn.gds("test.gds")

node <- add.gdsn(f, "int", val=1:10000)
put.attr.gdsn(node, "missing.value", 10000)
put.attr.gdsn(node, "one.value", 1L)
put.attr.gdsn(node, "string", c("ABCDEF", "THIS", paste(letters, collapse="")))
put.attr.gdsn(node, "bool", c(TRUE, TRUE, FALSE))

f
get.attr.gdsn(node)

delete.attr.gdsn(node, "one.value")
get.attr.gdsn(node)


node2 <- add.gdsn(f, "char", val=letters)
get.attr.gdsn(node2)
put.attr.gdsn(node2, val=node)
get.attr.gdsn(node2)


# close the GDS file
closefn.gds(f)

# delete the temporary file
unlink("test.gds", force=TRUE)

zhengxwen/gdsfmt documentation built on Nov. 19, 2024, 1:03 p.m.