Skip to content

Commit

Permalink
Make 'subset' method for 'importer' object work with variable name st…
Browse files Browse the repository at this point in the history
…rings
  • Loading branch information
melff committed Oct 20, 2018
1 parent 050d4d5 commit 14e72ed
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: memisc
Type: Package
Title: Management of Survey Data and Presentation of Analysis Results
Version: 0.99.17
Date: 2018-10-18
Version: 0.99.16.1
Date: 2018-10-20
Author: Martin Elff (with contributions from Christopher N. Lawrence, Dave Atkins, Jason W. Morgan, Achim Zeileis)
Maintainer: Martin Elff <memisc@elff.eu>
Description: An infrastructure for the management of survey data including
Expand Down
9 changes: 7 additions & 2 deletions pkg/R/importer-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,13 @@ setMethod("subset","importer",
nl <- as.list(1:nvars)
names(nl) <- names
cols <- logical(nvars)
cols[eval(substitute(select), nl, parent.frame())] <- TRUE
select.vars <- sapply(substitute(select)[-1],as.character)
if (class(substitute(select)) == 'call') {
cols[eval(substitute(select), nl, parent.frame())] <- TRUE
select.vars <- sapply(substitute(select)[-1],as.character)
} else { # As suggested by Diogo Ferrari (https://dioferrari.com/)
select.vars <- select
cols[which(names(nl) %in% select.vars )] <- TRUE
}

}
if(nobs < cs) cs <- nobs
Expand Down
4 changes: 4 additions & 0 deletions pkg/inst/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2018-10-20:
- The 'subset' method for 'importer' objects now accepts the names of
variables to be selected also as a character vector.

2018-10-15:
- A 'setCodeplan' and 'codeplan<-' assignment function is created that
can be used to copy the "item structure" or code plan from one object
Expand Down

0 comments on commit 14e72ed

Please sign in to comment.