Okay, so I have created a new column/variable through the help of previously existing one, and now I want to add this variable to my overall data set 'data.combined' however I cannot because the number of rows from my new variable is not big enough so I want to add rows to this variable labeled, 'unknown' . Sadly I also want to maintain index labels as I extracted them from another variable.
a.is.dependant.of.this.for.analysis.reasons <- c(1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1)
a.is.dependant.of.this.for.analysis.reasons <- as.factor(a.is.dependant.of.this.for.analysis.reasons)
a <- c("apple", "cat", "dogs", "penguins", "night", "day", "help", "madness", "grey", "orange", "green", "purple", "blue", "red", "vampires", "hunters", "gracious", "sunglasses", "happiness", "questionable", "scared")
a.data.set <- data.frame(a, a.is.dependant.of.this.for.analysis.reasons)
length.a <- c(a[nchar(a) > 5])
a <- as.factor(a)
length.a <- as.factor(length.a)
# Error ------- below
a.data.set <- data.frame(a, a.is.dependant.of.this.for.analysis.reasons, length.a)
#:
# Error in data.frame(a, a.is.dependant.of.this.for.analysis.reasons, length.a) :
# arguments imply differing number of rows: 21, 11