index.gdsn: Get the specified node

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/gdsfmt-main.r

Description

Get a specified GDS node.

Usage

1
index.gdsn(node, path=NULL, index=NULL, silent=FALSE)

Arguments

node

an object of class gdsn.class (a GDS node), or gds.class (a GDS file)

path

the path specifying a GDS node with '/' as a separator

index

a numeric vector or characters, specifying the path; it is applicable if path=NULL

silent

if TRUE, return NULL if the specified node does not exist

Details

If index is a numeric vector, e.g., c(1, 2), the result is the second child node of the first child of node. If index is a vector of characters, e.g., c("list", "x"), the result is the child node with name "x" of the "list" child node.

Value

An object of class gdsn.class for the specified node.

Author(s)

Xiuwen Zheng

References

http://github.com/zhengxwen/gdsfmt

See Also

cnt.gdsn, ls.gdsn, name.gdsn, add.gdsn, delete.gdsn

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# cteate a GDS file
f <- createfn.gds("test.gds")

# add a list to "test.gds"
node <- add.gdsn(f, name="list", val=list(x=c(1,2), y=c("T","B","C"), z=TRUE))
f

index.gdsn(f, "list/x")
index.gdsn(f, index=c("list", "x"))
index.gdsn(f, index=c(1, 1))
index.gdsn(f, index=c("list", "z"))

## Not run: 
index.gdsn(f, "list/x/z")
# Error in index.gdsn(f, "list/x/z") : Invalid path "list/x/z"!

## End(Not run)

# return NULL
index.gdsn(f, "list/x/z", silent=TRUE)

# close the GDS file
closefn.gds(f)


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

gdsfmt documentation built on Dec. 26, 2020, 6 p.m.