We want to perform a regression modelof the following dataset:
There are 3 different variables, all factors. For the regression model we want to dummify the variable: container_ids using the dummies package in R
Once that variable is dummified we want to combine the variables "datum" and "fill_level" with the different dummy variables so we can perform our regression model
the problem we have:
we can create dummy data of container_ids in a separate matrix but not in a dataframe. If we want to combine this matrix with the two variables datum and fill_level it doesn't show what we want it to show.
It shows this:
but it needs to add all the different container_ids dummy data
can someone please help us out, would be very nice!
the code we used:
#containerids dummies
library(dummies)
str(container_group)
#creating a matrix with all the dummy data
dummy_container_ids <- dummy(container_group$container_ids, sep="_")
#this doesn't work
containers_dummy <- dummy.data.frame(container_group,sep="_")
#combine the data
#but it only adds one column instead of the multiple dummy data we want to add
combined_data <- cbind(container_group[c(1,3)], dummy_container_ids)
the output i get when: dput(head(container_group, 20))
structure(list(datum = structure(1:20, .Label = c("2017-01-02",
"2017-01-04", "2017-01-05", "2017-01-09", "2017-01-12", "2017-01-16",
"2017-01-19", "2017-01-21", "2017-01-23", "2017-01-26", "2017-01-28",
"2017-01-30", "2017-02-02", "2017-02-03", "2017-02-06", "2017-02-10",
"2017-02-13", "2017-02-18", "2017-02-20", "2017-02-23", "2017-02-25",
"2017-02-27", "2017-03-03", "2017-03-06", "2017-03-13", "2017-03-15",
"2017-03-17", "2017-03-20", "2017-03-21", "2017-03-27", "2017-03-31",
"2017-04-03", "2017-04-05", "2017-04-07", "2017-04-10", "2017-04-15",
"2017-04-16", "2017-04-20", "2017-04-24", "2017-04-25", "2017-04-28",
"2017-05-01", "2017-05-06", "2017-05-08", "2017-05-11", "2017-05-13",
"2017-05-15", "2017-05-17", "2017-05-19", "2017-05-22", "2017-05-26",
"2017-05-31", "2017-06-03", "2017-06-06", "2017-06-08", "2017-06-13",
"2017-06-23", "2017-06-26", "2017-07-04", "2017-07-11", "2017-07-12",
"2017-07-15", "2017-07-17", "2017-07-19", "2017-07-28", "2017-07-31",
"2017-08-03", "2017-08-05", "2017-08-07", "2017-08-10", "2017-08-12",
"2017-08-15", "2017-08-16", "2017-08-18", "2017-08-21", "2017-08-24",
"2017-08-25", "2017-08-29", "2017-09-02", "2017-09-05", "2017-09-07",
"2017-09-12", "2017-09-13", "2017-09-16", "2017-09-18", "2017-09-25",
"2017-10-06", "2017-10-09", "2017-10-11", "2017-10-13", "2017-10-16",
"2017-10-17", "2017-10-20", "2017-10-23", "2017-10-25", "2017-10-27",
"2017-11-02", "2017-11-06", "2017-11-09", "2017-11-11", "2017-11-13",
"2017-11-15", "2017-11-20", "2017-11-24", "2017-11-27", "2017-11-28",
"2017-12-07", "2017-12-14", "2017-12-15", "2017-12-18", "2017-12-20",
"2017-12-22", "2017-12-24", "2017-12-29", "2017-12-31", "2018-01-02",
"2018-01-04", "2018-01-09", "2018-01-13", "2018-01-16", "2018-01-17",
"2018-01-22", "2018-01-25", "2018-01-29", "2018-02-02", "2018-02-03",
"2018-02-05", "2018-02-06", "2018-02-09", "2018-02-13", "2018-02-16",
"2018-02-19", "2018-02-24", "2018-02-26", "2018-03-05", "2018-03-08",
"2018-03-11", "2018-03-14", "2018-03-16", "2018-03-21", "2018-03-26",
"2018-03-29", "2018-03-30", "2018-03-31", "2018-04-04", "2018-04-05",
"2018-04-08", "2018-04-12", "2018-04-20", "2018-04-23", "2018-04-26",
"2018-05-06", "2018-05-10", "2018-05-15", "2018-05-18", "2018-05-22",
"2018-06-04", "2018-06-08", "2018-06-11", "2018-06-16", "2018-06-17",
"2018-06-20", "2018-06-22", "2018-06-28", "2018-07-02", "2018-07-04",
"2018-07-09", "2018-07-17", "2018-07-21", "2018-07-23", "2018-07-24",
"2018-07-31", "2018-08-01", "2018-08-02", "2018-08-03", "2018-08-06",
"2018-08-07", "2018-08-08", "2018-08-10", "2018-08-13", "2018-08-14",
"2018-08-15", "2018-08-17", "2018-08-21", "2018-09-07", "2018-09-11",
"2018-09-19", "2018-09-21", "2018-09-24", "2018-09-25", "2018-09-26",
"2018-09-28", "2018-10-02", "2018-10-05", "2018-10-07", "2018-10-10",
"2018-10-11", "2018-10-12", "2018-10-15", "2018-10-17", "2018-10-19",
"2018-10-22", "2018-10-23", "2018-10-24", "2018-10-26", "2018-10-28",
"2018-10-29", "2018-10-30", "2018-10-31", "2018-11-02", "2018-11-05",
"2018-11-06", "2018-11-07", "2018-11-09", "2018-11-10", "2018-11-11",
"2018-11-12", "2018-11-13", "2018-11-14", "2018-11-16", "2018-11-19",
"2018-11-20", "2018-11-21", "2018-11-23", "2018-11-24", "2018-11-26",
"2018-11-30", "2018-12-02", "2018-12-03", "2018-12-04", "2018-12-05",
"2018-12-06", "2018-12-07", "2018-12-09", "2018-12-10", "2018-12-11",
"2018-12-12", "2018-12-16", "2018-12-17", "2018-12-18", "2018-12-19",
"2018-12-21", "2018-12-24", "2018-12-25", "2018-12-28", "2018-12-30",
"2018-12-31", "2019-01-02", "2019-01-03", "2019-01-04", "2019-01-05",
"2019-01-06", "2019-01-09", "2019-01-11", "2019-01-14", "2019-01-15",
"2019-01-16", "2019-01-17", "2019-01-18", "2019-01-21", "2019-01-23",
"2019-01-26", "2019-01-27", "2019-01-28", "2019-01-29", "2019-01-30",
"2019-01-31", "2019-02-01", "2019-02-02", "2019-02-04", "2019-02-05",
"2019-02-06", "2019-02-08", "2019-02-10", "2019-02-11", "2019-02-12",
"2019-02-13", "2019-02-14", "2019-02-15", "2019-02-17", "2019-02-18",
"2019-02-19", "2019-02-20", "2019-02-22", "2019-02-24", "2019-02-25",
"2019-02-26", "2019-02-27", "2019-03-01", "2019-03-02", "2019-03-03",
"2019-03-04", "2019-03-05", "2019-03-06", "2019-03-08", "2019-03-11",
"2019-03-12", "2019-03-13", "2019-03-14", "2019-03-15", "2019-03-16",
"2019-03-18", "2019-03-20", "2019-03-22", "2019-03-24", "2019-03-25",
"2019-03-26", "2019-03-28", "2019-03-29", "2019-03-30", "2019-04-01",
"2019-04-02", "2019-04-03", "2019-04-05", "2019-04-07", "2019-04-08",
"2019-04-09", "2019-04-10", "2019-04-11", "2019-04-12", "2019-04-13",
"2019-04-14", "2019-04-15", "2019-04-16", "2019-04-17", "2019-04-19",
"2019-04-20", "2019-04-22", "2019-04-23", "2019-04-24", "2019-04-25",
"2019-04-26", "2019-04-28", "2019-04-29", "2019-04-30", "2019-05-01",
"2019-05-02", "2019-05-03", "2019-05-04", "2019-05-05", "2019-05-06",
"2019-05-07", "2019-05-08", "2019-05-09", "2019-05-10", "2019-05-12",
"2019-05-13", "2019-05-14", "2019-05-15", "2019-05-16", "2019-05-17",
"2019-05-18", "2019-05-20", "2019-05-21", "2019-05-22", "2019-05-23",
"2019-05-24", "2019-05-25", "2019-05-27", "2019-05-28", "2019-05-29",
"2019-05-31", "2019-06-01", "2019-06-03", "2019-06-04", "2019-06-05",
"2019-06-07", "2019-06-08", "2019-06-10", "2019-06-11", "2019-06-12",
"2019-06-13", "2019-06-14", "2019-06-15", "2019-06-17", "2019-06-18",
"2019-06-19", "2019-06-20", "2019-06-21", "2019-06-22", "2019-06-24",
"2019-06-25", "2019-06-27", "2019-06-28", "2019-06-30", "2019-07-01",
"2019-07-02", "2019-07-03", "2019-07-04", "2019-07-05", "2019-07-06",
"2019-07-07", "2019-07-08", "2019-07-09", "2019-07-10", "2019-07-11",
"2019-07-12", "2019-07-14", "2019-07-15", "2019-07-16", "2019-07-17",
"2019-07-19", "2019-07-20", "2019-07-22", "2019-07-23", "2019-07-26",
"2019-07-27", "2019-07-29", "2019-07-30", "2019-07-31", "2019-08-03",
"2019-08-05", "2019-08-07", "2019-08-09", "2019-08-10", "2019-08-12",
"2019-08-15", "2019-08-20", "2019-08-21&quo