hospital <- data.frame(
PatientID = c(101, 102, 103, 104, 105),
PatientName = c("Aman", "Riya", "Karan", "Neha", "Rohit"),
Gender = factor(c("Male", "Female", "Male", "Female", "Male")),
Ward = factor(c("General", "ICU", "General", "Private", "ICU")),
TreatmentCost = c(12000, 25000, 15000, 30000, NA),
MedicineCost = c(3000, 5000, 4000, 6000, 4500),
DaysAdmitted = c(3, 5, 2, 6, 4)
)
print(hospital)
## PatientID PatientName Gender Ward TreatmentCost MedicineCost DaysAdmitted
## 1 101 Aman Male General 12000 3000 3
## 2 102 Riya Female ICU 25000 5000 5
## 3 103 Karan Male General 15000 4000 2
## 4 104 Neha Female Private 30000 6000 6
## 5 105 Rohit Male ICU NA 4500 4
str(hospital)
## 'data.frame': 5 obs. of 7 variables:
## $ PatientID : num 101 102 103 104 105
## $ PatientName : chr "Aman" "Riya" "Karan" "Neha" ...
## $ Gender : Factor w/ 2 levels "Female","Male": 2 1 2 1 2
## $ Ward : Factor w/ 3 levels "General","ICU",..: 1 2 1 3 2
## $ TreatmentCost: num 12000 25000 15000 30000 NA
## $ MedicineCost : num 3000 5000 4000 6000 4500
## $ DaysAdmitted : num 3 5 2 6 4