Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to load a particular data set from a package in R?

In a tutorial for the survival package there is an example of the ‘ovarian’ data set. It should be loaded with data(ovarian) but it returns

Warning message:
In data(ovarian): data set ‘ovarian’ not found

according to Missing "ovarian" dataset in "survival" package I learned the data is there but under a different name. Based on Get a list of the data sets in a particular package I listed the data sets:

> data(package = "survival")$results[, "Item"]
 [1] "aml (cancer)"            "bladder (cancer)"        "bladder1 (cancer)"       "bladder2 (cancer)"       "cancer"                 
 [6] "capacitor (reliability)" "cgd"                     "cgd0 (cgd)"              "colon (cancer)"          "cracks (reliability)"   
[11] "diabetic"                "flchain"                 "gbsg (cancer)"           "genfan (reliability)"    "heart"                  
[16] "hoel (cancer)"           "ifluid (reliability)"    "imotor (reliability)"    "jasa (heart)"            "jasa1 (heart)"          
[21] "kidney (cancer)"         "leukemia (cancer)"       "logan"                   "lung (cancer)"           "mgus (cancer)"          
[26] "mgus1 (cancer)"          "mgus2 (cancer)"          "myeloid (cancer)"        "myeloma (cancer)"        "nafld1 (nafld)"         
[31] "nafld2 (nafld)"          "nafld3 (nafld)"          "nwtco"                   "ovarian (cancer)"        "pbc"                    
[36] "pbcseq (pbc)"            "rats (cancer)"           "rats2 (cancer)"          "retinopathy"             "rhDNase"                
[41] "rotterdam (cancer)"      "solder"                  "stanford2 (heart)"       "survexp.mn (survexp)"    "survexp.us (survexp)"   
[46] "survexp.usr (survexp)"   "tobin"                   "transplant"              "turbine (reliability)"   "udca"                   
[51] "udca1 (udca)"            "udca2 (udca)"            "uspop2 (survexp)"        "valveSeat (reliability)" "veteran (cancer)"       

and found it [34] but I can’t find how to load only this one. Can anyone help?
data(ovarian (cancer)), data("ovarian (cancer)"), data(package = "survival")[34] , data(list = "ovarian (cancer)", package = "survival") do not work.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

you can use:

df <- survival::ovarian
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading