removeSubsets {DASplusR}R Documentation

DASData - subsets

Description

The function 'removeSubsets()' alters the attribute 'subsets' of the DataSet dat by deleting the specified subsets.

Usage

removeSubsets(dat,subs)

Arguments

dat a data object of class 'DASData', which attribute 'subsets' will be altered.
subs a vector of integers, specifying the subsets to remove by the number in the list of 'subsets', or a vector of subset 'name's. Specifying subs=c(0,...) causes to reset the whole attribute to NA, regardless what follows 0.

Details

The function removes subsets from the list of the 'attribute(dat)$subsets', specified either by integers or characters.

The argument 'subs' is of the form c(1,2,3) to delete subset at positions 1, 2 and 3 in the list of subsets returned by attributes(dat)$subsets or as character vector of the form c("subname1","subname2",...) removing the subsets named "subname1", etc. If 'subs' is "all", all subsets are removed and the attribute 'subsets' is reset to an empty list.

Value

The function returns TRUE or FALSE regarding the success of the workflow. The new object is copied to the working environment and is visible there.

Note

There are no missing values allowed.

Author(s)

Stefan Schnabl, stefan.schnabl@gmail.com

See Also

'makeSubsets', 'selectSubsets', 'makeDASData', 'attributes', 'attr'

Examples

# example data object of class data.frame
x = 1:5
dat = data.frame(cbind(x1=x,x2=x,x3=x,x4=x),row.names=c("y1","y2","y3","y4","y5"))
attach(dat)
makeSubset(dat,"sub1","x1<4")
makeSubset(dat,"sub2",1:3)
makeSubset(dat,"sub3",c(T,F,T,F,T))
makeSubset(dat,"sub4",c(0,1,1,0,0))
makeSubset(dat,"sub5",c("y2","y3"))
makeSubset(dat,"sub6",c(1,3,5))

# remove subsets by integers
removeSubsets(dat,c(1,3,5))

# remove subsets by names
removeSubsets(dat,c("sub1","sub3","sub5"))

# remove all subsets
removeSubsets(dat,0)


[Package DASplusR version 1.0-1 Index]