# nobsY

0th

Percentile

##### Compute Number of Observations for Left Hand Side of Formula

After removing any artificial observations added by addMarginal, computes the number of non-missing observations for all left-hand-side variables in formula. If formula contains a term id(variable) variable is assumed to be a subject ID variable, and only unique subject IDs are counted. If group is given and its value is the name of a variable in the right-hand-side of the model, an additional object nobsg is returned that is a matrix with as many columns as there are left-hand variables, and as many rows as there are levels to the group variable. This matrix has the further breakdown of unique non-missing observations by group. The concatenation of all ID variables, is returned in a list element id.

Keywords
manip, utilities
##### Usage
nobsY(formula, group=NULL, data = NULL, subset = NULL, na.action = na.retain, matrixna=c('all', 'any'))
##### Arguments
formula
a formula object
group
character string containing optional name of a stratification variable for computing sample sizes
data
a data frame
subset
an optional subsetting criterion
na.action
an optional NA-handling function
matrixna
set to "all" if an observation is to be considered NA if all the columns of the variable are NA, otherwise use matrixna="any" to consider the row missing if any of the columns are missing
##### Value

"formula" containing the original formula but with an id variable (if present) removed

• nobsY
##### Examples
d <- expand.grid(sex=c('female', 'male', NA),
country=c('US', 'Romania'),
reps=1:2)
d\$subject.id <- c(0, 0, 3:12)
dm <- addMarginal(d, sex, country)
dim(dm)
nobsY(sex + country ~ 1, data=d)
nobsY(sex + country ~ id(subject.id), data=d)
nobsY(sex + country ~ id(subject.id) + reps, group='reps', data=d)
nobsY(sex ~ 1, data=d)
nobsY(sex ~ 1, data=dm)
nobsY(sex ~ id(subject.id), data=dm)

Documentation reproduced from package Hmisc, version 4.0-2, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.
{"ft_lang_label":"__label__en","ft_lang_prob":0.65822,"math_prob":0.8828451,"size":1895,"snap":"2019-13-2019-22","text_gpt3_token_len":510,"char_repetition_ratio":0.1300899,"word_repetition_ratio":0.0067340066,"special_character_ratio":0.24538259,"punctuation_ratio":0.12188365,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98601115,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-03-22T06:13:45Z\",\"WARC-Record-ID\":\"<urn:uuid:64b83026-338a-417c-ba01-2acdb8c88821>\",\"Content-Length\":\"15802\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:14b8ab9d-e802-4c4e-91a7-5e7986b97688>\",\"WARC-Concurrent-To\":\"<urn:uuid:b28d4176-7783-4644-ac9f-ffcfd8c866dc>\",\"WARC-IP-Address\":\"54.173.200.236\",\"WARC-Target-URI\":\"https://www.rdocumentation.org/packages/Hmisc/versions/4.0-2/topics/nobsY\",\"WARC-Payload-Digest\":\"sha1:6EKS2XHU2Z7G4H666YGPL7MF67V4CKOC\",\"WARC-Block-Digest\":\"sha1:EXZWHXBQWPVQH7BRAH6ITTL74RMA3QL5\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-13/CC-MAIN-2019-13_segments_1552912202635.43_warc_CC-MAIN-20190322054710-20190322080710-00497.warc.gz\"}"}