Gå till index

Första kursen: Forskningsmetoder och Analys med R

0% färdig
0/0 Steps
  1. Analys och forskning med R och Posit (Rstudio)
  2. Grunderna i R och Rstudio
    7 Ämnen
  3. Importera, exportera, spara och ladda data
    5 Ämnen
  4. Strängar och regular expressions (regex)
    1 Ämne
  5. Bearbetning av data med dplyr
    12 Ämnen
  6. Visualisera och presentera
    14 Ämnen
  7. Explorerande och deskriptiva analyser
    6 Ämnen
  8. Prediktionsmodeller
    12 Ämnen
  9. Klassisk regressionsanalys
    8 Ämnen
  10. Machine learning (ML) och Artificiell Intelligens (AI)
    9 Ämnen
  11. Skapa prediktionsmodeller med Tidymodels
    6 Ämnen
  12. Hypotestester och epidemiologiska mått
    5 Ämnen
Avsnitt Progress
0% färdig

Aktivera inbyggda datamängder

Standardinstallationen av R inkluderar flera paket som har inbygda datamängder (data frames) som du kan aktivera när som helst. För att se vilka data frames som finns tillgänliga använder du funktionen data(). Notera att det framgår av utskriften vilket paket som innehåller datamängden.

R
data()
Resultat
Data sets in package ‘datasets’:

AirPassengers                      Monthly Airline Passenger Numbers 1949-1960
BJsales                            Sales Data with Leading Indicator
BJsales.lead (BJsales)             Sales Data with Leading Indicator
BOD                                Biochemical Oxygen Demand
CO2                                Carbon Dioxide Uptake in Grass Plants
ChickWeight                        Weight versus age of chicks on different diets
DNase                              Elisa assay of DNase
EuStockMarkets                     Daily Closing Prices of Major European Stock Indices, 1991-1998
Formaldehyde                       Determination of Formaldehyde
HairEyeColor                       Hair and Eye Color of Statistics Students
Harman23.cor                       Harman Example 2.3
Harman74.cor                       Harman Example 7.4
Indometh                           Pharmacokinetics of Indomethacin
InsectSprays                       Effectiveness of Insect Sprays
JohnsonJohnson                     Quarterly Earnings per Johnson & Johnson Share
LakeHuron                          Level of Lake Huron 1875-1972
LifeCycleSavings                   Intercountry Life-Cycle Savings Data
Loblolly                           Growth of Loblolly pine trees
Nile                               Flow of the River Nile
Orange                             Growth of Orange Trees
OrchardSprays                      Potency of Orchard Sprays
PlantGrowth                        Results from an Experiment on Plant Growth
Puromycin                          Reaction Velocity of an Enzymatic Reaction
Seatbelts                          Road Casualties in Great Britain 1969-84
Theoph                             Pharmacokinetics of Theophylline
Titanic                            Survival of passengers on the Titanic
ToothGrowth                        The Effect of Vitamin C on Tooth Growth in Guinea Pigs
UCBAdmissions                      Student Admissions at UC Berkeley
UKDriverDeaths                     Road Casualties in Great Britain 1969-84
UKgas                              UK Quarterly Gas Consumption
USAccDeaths                        Accidental Deaths in the US 1973-1978
USArrests                          Violent Crime Rates by US State
USJudgeRatings                     Lawyers' Ratings of State Judges in the US Superior Court
USPersonalExpenditure              Personal Expenditure Data
UScitiesD                          Distances Between European Cities and Between US Cities
VADeaths                           Death Rates in Virginia (1940)
WWWusage                           Internet Usage per Minute
WorldPhones                        The World's Telephones
ability.cov                        Ability and Intelligence Tests
airmiles                           Passenger Miles on Commercial US Airlines, 1937-1960
airquality                         New York Air Quality Measurements
anscombe                           Anscombe's Quartet of 'Identical' Simple Linear Regressions
attenu                             The Joyner-Boore Attenuation Data
attitude                           The Chatterjee-Price Attitude Data
austres                            Quarterly Time Series of the Number of Australian Residents
beaver1 (beavers)                  Body Temperature Series of Two Beavers
beaver2 (beavers)                  Body Temperature Series of Two Beavers
cars                               Speed and Stopping Distances of Cars
chickwts                           Chicken Weights by Feed Type
co2                                Mauna Loa Atmospheric CO2 Concentration
crimtab                            Student's 3000 Criminals Data
discoveries                        Yearly Numbers of Important Discoveries
esoph                              Smoking, Alcohol and (O)esophageal Cancer
euro                               Conversion Rates of Euro Currencies
euro.cross (euro)                  Conversion Rates of Euro Currencies
eurodist                           Distances Between European Cities and Between US Cities
faithful                           Old Faithful Geyser Data
fdeaths (UKLungDeaths)             Monthly Deaths from Lung Diseases in the UK
freeny                             Freeny's Revenue Data
freeny.x (freeny)                  Freeny's Revenue Data
freeny.y (freeny)                  Freeny's Revenue Data
infert                             Infertility after Spontaneous and Induced Abortion
iris                               Edgar Anderson's Iris Data
iris3                              Edgar Anderson's Iris Data
islands                            Areas of the World's Major Landmasses
ldeaths (UKLungDeaths)             Monthly Deaths from Lung Diseases in the UK
lh                                 Luteinizing Hormone in Blood Samples
longley                            Longley's Economic Regression Data
lynx                               Annual Canadian Lynx trappings 1821-1934
mdeaths (UKLungDeaths)             Monthly Deaths from Lung Diseases in the UK
morley                             Michelson Speed of Light Data
mtcars                             Motor Trend Car Road Tests
nhtemp                             Average Yearly Temperatures in New Haven
nottem                             Average Monthly Temperatures at Nottingham, 1920-1939
npk                                Classical N, P, K Factorial Experiment
occupationalStatus                 Occupational Status of Fathers and their Sons
precip                             Annual Precipitation in US Cities
presidents                         Quarterly Approval Ratings of US Presidents
pressure                           Vapor Pressure of Mercury as a Function of Temperature
quakes                             Locations of Earthquakes off Fiji
randu                              Random Numbers from Congruential Generator RANDU
rivers                             Lengths of Major North American Rivers
rock                               Measurements on Petroleum Rock Samples
sleep                              Student's Sleep Data
stack.loss (stackloss)             Brownlee's Stack Loss Plant Data
stack.x (stackloss)                Brownlee's Stack Loss Plant Data
stackloss                          Brownlee's Stack Loss Plant Data
state.abb (state)                  US State Facts and Figures
state.area (state)                 US State Facts and Figures
state.center (state)               US State Facts and Figures
state.division (state)             US State Facts and Figures
state.name (state)                 US State Facts and Figures
state.region (state)               US State Facts and Figures
state.x77 (state)                  US State Facts and Figures
sunspot.month                      Monthly Sunspot Data, from 1749 to "Present"
sunspot.year                       Yearly Sunspot Data, 1700-1988
sunspots                           Monthly Sunspot Numbers, 1749-1983
swiss                              Swiss Fertility and Socioeconomic Indicators (1888) Data
treering                           Yearly Treering Data, -6000-1979
trees                              Diameter, Height and Volume for Black Cherry Trees
uspop                              Populations Recorded by the US Census
volcano                            Topographic Information on Auckland's Maunga Whau Volcano
warpbreaks                         The Number of Breaks in Yarn during Weaving
women                              Average Heights and Weights for American Women

Data sets in package ‘lubridate’:

lakers                             Lakers 2008-2009 basketball data set

Data sets in package ‘R4DS’:

01-sales                           
02-sales                           
03-sales                           
gapminder                          
heights                            
students                           



Data sets in package ‘survival’:

aml (cancer)                       Acute Myelogenous Leukemia survival data
bladder (cancer)                   Bladder Cancer Recurrences
bladder1 (cancer)                  Bladder Cancer Recurrences
bladder2 (cancer)                  Bladder Cancer Recurrences
cancer                             NCCTG Lung Cancer Data
capacitor (reliability)            Reliability data sets
cgd                                Chronic Granulotamous Disease data
cgd0 (cgd)                         Chronic Granulotomous Disease data
colon (cancer)                     Chemotherapy for Stage B/C colon cancer
cracks (reliability)               Reliability data sets
diabetic                           Ddiabetic retinopathy
flchain                            Assay of serum free light chain for 7874 subjects.
gbsg (cancer)                      Breast cancer data sets used in Royston and Altman (2013)
genfan (reliability)               Reliability data sets
heart                              Stanford Heart Transplant data
ifluid (reliability)               Reliability data sets
imotor (reliability)               Reliability data sets
jasa (heart)                       Stanford Heart Transplant data
jasa1 (heart)                      Stanford Heart Transplant data
kidney (cancer)                    Kidney catheter data
leukemia (cancer)                  Acute Myelogenous Leukemia survival data
logan                              Data from the 1972-78 GSS data used by Logan
lung (cancer)                      NCCTG Lung Cancer Data
mgus (cancer)                      Monoclonal gammopathy data
mgus1 (cancer)                     Monoclonal gammopathy data
mgus2 (cancer)                     Monoclonal gammopathy data
myeloid (cancer)                   Acute myeloid leukemia
myeloma (cancer)                   Survival times of patients with multiple myeloma
nafld1 (nafld)                     Non-alcohol fatty liver disease
nafld2 (nafld)                     Non-alcohol fatty liver disease
nafld3 (nafld)                     Non-alcohol fatty liver disease
nwtco                              Data from the National Wilm's Tumor Study
ovarian (cancer)                   Ovarian Cancer Survival Data
pbc                                Mayo Clinic Primary Biliary Cholangitis Data
pbcseq (pbc)                       Mayo Clinic Primary Biliary Cirrhosis, sequential data
rats (cancer)                      Rat treatment data from Mantel et al
rats2 (cancer)                     Rat data from Gail et al.
retinopathy                        Diabetic Retinopathy
rhDNase                            rhDNASE data set
rotterdam (cancer)                 Breast cancer data set used in Royston and Altman (2013)
solder                             Data from a soldering experiment
stanford2 (heart)                  More Stanford Heart Transplant data
survexp.mn (survexp)               Census Data Sets for the Expected Survival and Person Years Functions
survexp.us (survexp)               Census Data Sets for the Expected Survival and Person Years Functions
survexp.usr (survexp)              Census Data Sets for the Expected Survival and Person Years Functions
tobin                              Tobin's Tobit data
transplant                         Liver transplant waiting list
turbine (reliability)              Reliability data sets
udca                               Data from a trial of usrodeoxycholic acid
udca1 (udca)                       Data from a trial of usrodeoxycholic acid
udca2 (udca)                       Data from a trial of usrodeoxycholic acid
uspop2 (survexp)                   Projected US Population
valveSeat (reliability)            Reliability data sets
veteran (cancer)                   Veterans' Administration Lung Cancer study

För att se vilka datamängder som finns i ett specifikt paket används följande kommando:

R
data(package="survival")

Alla dessa datamängder är avsedda att användas som övningsdata, exempelvis för att experimentera med funktioner och förstå hur de fungerar. Om du vill använda någon av dessa datamängder skriver du namnet på den i funktionen data(). För att ladda datamängderna AirPassengers och lakers skriver man som följer:

R
data("AirPassengers")
data("lakers")

Detta laddar datamängderna, vilka förblir inaktiva tills de faktiskt används. Detta kommer märkas i din Environment, genom att objektet flaggas med <Promise>, som framgår av Figur 10.1.

Figur 10.1: Aktiverade datamängder som ännu inte använts får notisen <Promise>.

När du använder datamängden kommer den aktiveras och <Promise> försvinner.

I paketet survival finns flera användbara datamängder för överlevnadsanalys. För att ladda alla dataset med cancerpatienter skriver man kommandot:

R
# Aktivera paketet survival
library(survival)

# Ladda alla dataset med cancerstudier
data(cancer)

Då aktiveras samtliga datamängder med cancerstudier, vilket framgår i vår Environment:

Figur 10.2: Nu har samtliga cancerstudier från paketet survival laddats.