Description Usage Arguments Examples
Like data frames, data.set objects have
subset, unique,
cbind, rbind,
merge methods defined for them.
The semantics are basically the same as the methods defined
for data frames in the base package, with the only difference
that the return values are data.set objects.
In fact, the methods described here are front-ends to the
corresponding methods for data frames, which are constructed
such that the "extra" information attached to variables within
data.set objects, that is, to item objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## S4 method for signature 'data.set'
subset(x, ...)
## S4 method for signature 'data.set'
unique(x, incomparables = FALSE, ...)
## S3 method for class 'data.set'
cbind(..., deparse.level = 1)
## S3 method for class 'data.set'
rbind(..., deparse.level = 1)
## S4 method for signature 'data.set,data.set'
merge(x,y, ...)
## S4 method for signature 'data.set,data.frame'
merge(x,y, ...)
## S4 method for signature 'data.frame,data.set'
merge(x,y, ...)
|
x,y |
|
... |
for |
incomparables |
a vector of values that cannot be compared. See
|
deparse.level |
an argument retained for
reasons of compatibility of the default methods
of |
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ds1 <- data.set(
a = rep(1:3,5),
b = rep(1:5,each=3)
)
ds2 <- data.set(
a = c(3:1,3,3),
b = 1:5
)
ds1 <- within(ds1,{
description(a) <- "Example variable 'a'"
description(b) <- "Example variable 'b'"
})
ds2 <- within(ds2,{
description(a) <- "Example variable 'a'"
description(b) <- "Example variable 'b'"
})
str(ds3 <- rbind(ds1,ds2))
description(ds3)
ds3 <- within(ds1,{
c <- a
d <- b
description(c) <- "Copy of variable 'a'"
description(d) <- "Copy of variable 'b'"
rm(a,b)
})
str(ds4 <- cbind(ds1,ds3))
description(ds4)
ds5 <- data.set(
c = 1:3,
d = c(1,1,2)
)
ds5 <- within(ds5,{
description(c) <- "Example variable 'c'"
description(d) <- "Example variable 'd'"
})
str(ds6 <- merge(ds1,ds5,by.x="a",by.y="c"))
# Note that the attributes of the left-hand variables
# have priority.
description(ds6)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.