Data table
Section of Descriptive statistics, part of Data analysis
Data table
| Type | Section |
| Taught in | Descriptive statistics |
| Part | Data analysis |
One row is one unit. One column is one variable. An identifier column names the unit. In a designed experiment some columns record the assignment and stay fixed if the measurements are repeated. The remaining columns are what the study measured.
| Variable | Meaning | Type |
|---|---|---|
age |
age in years | quantitative |
anaemia |
low red blood cell count, 1 = yes | categorical |
cp |
creatine phosphokinase in the blood, mcg/L | quantitative |
diabetes |
diabetes, 1 = yes | categorical |
ejection_fraction |
percentage of blood leaving the heart at each beat | quantitative |
hbp |
high blood pressure, 1 = yes | categorical |
platelets |
platelets in the blood, kiloplatelets/mL | quantitative |
serum_creatinine |
creatinine in the blood, mg/dL | quantitative |
serum_sodium |
sodium in the blood, mEq/L | quantitative |
sex |
1 = male, 0 = female | categorical |
smoking |
smoker, 1 = yes | categorical |
time |
follow-up period, days | quantitative |
death |
died during follow-up, 1 = yes | categorical |
The follow-up time is not a variable to explain death with. A patient who died was recorded at the time of death, so time is partly determined by the outcome itself; using it to predict death would be circular. It is left out of the analysis.
Variables come in two broad types. Quantitative variables are numbers on a scale where arithmetic makes sense: they are discrete when they count something and continuous when they measure. Categorical variables, called factors in R, put each unit in one of a fixed set of classes; they are ordinal when the classes have a natural order, such as “mild, moderate, severe”, and nominal otherwise. A categorical variable coded as 0 and 1 is still categorical, and R must be told so, or it will happily compute the mean of sex:
heart <- read.csv("heart.csv")
heart$anaemia <- factor(heart$anaemia) # and likewise for the other 0/1 columns
str(heart) # 299 obs. of 13 variablesUsed in
See also
Sample quantile · Interquartile range · Sample variance and standard deviation · Five-number summary and boxplot · Normal quantile plot · Summary statistics · One categorical variable, and two · One quantitative variable