R Under development (unstable) (2025-09-02 r88773 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # > # Test out subscripting > # > require(kinship2) Loading required package: kinship2 Loading required package: Matrix Loading required package: quadprog Warning: kinship2 package is deprecated for R <= 4.5; switch functionality to Pedixplorer from BioConductor> data(minnbreast) > > minnped <- with(minnbreast, pedigree(id, fatherid, motherid, sex, + affected=cancer, famid=famid)) > ped8 <- minnped['8'] # a modest sized family > > # Subjects 150, 152, 154, 158 are children, and 143, 162, 149 are > # parents and a child > droplist <- c(150, 152, 154, 158, 143, 162, 149) > > keep1 <- !(ped8$id %in% droplist) #logical > keep2 <- which(keep1) #numeric > keep3 <- as.character(ped8$id[keep1]) #character > keep4 <- factor(keep3) > > test1 <- ped8[keep1] > test2 <- ped8[keep2] > test3 <- ped8[keep3] > test4 <- ped8[keep4] > all.equal(test1, test2) [1] TRUE > all.equal(test1, test3) [1] TRUE > all.equal(test1, test4) [1] TRUE > > proc.time() user system elapsed 1.20 0.17 1.31