series model for predicting yield and putting them into other formulas to generate cash rents forecast.
I want to show the counties' names in the columns and the years in rows in a dataframe.
So I have a vector containing 3 counties' names which all the elements are from other dataframe. I want to put them in all the dataframe and name the columns so I extracted them out. Now I just use an example.
ct_name <- c("Adams","Boone","Champaign")
And I want to combine then with my predicted yield dataframe table.
library(janitor)
table<- matrix(1:6,nrow = 2, ncol = 3, byrow = FALSE)
rownames(table) <- c("2015", "2016")
table <- rbind(ct_name, table)
table <- row_to_names(table, row_number = 1)
table <- data.frame(table)
There was integers in matrix. However, after using row_to_names()
, it all becomes factors or logic.
How can I solve this problem.
I tried is.numeric() and is.integer()
but it all failed and I need them to be integer to do the calculations!
How should I do? Thank you guys!