0

I can not find a solution to this error and I am not sure what the cause of it is.

I am trying to pull some stats Canada data sets. I have about 500 data points to update each month which can be identified by unique vector numbers. I have a way to quickly make the list of vectors (not included in provided code) but I'm struggling to separate the title information it provides.

library(dplyr)
library(cansim)
library(tidyr)
library(splitstackshape)

vectors_list <- data.table("v2063000", "v2063001")

Cansim_titles <- data.table(get_cansim_vector_info(vectors_list))
Cansim_titles <- Cansim_titles %>% select(title, VECTOR, table)

This gets me the information I need but I need to separate what is in the title. The title for v2063000 is "Newfoundland and Labrador;Employment;Both sexes;15 years and over;Estimate;Seasonally adjusted". I want to break that into separate columns at each semi-colon.

I have been trying to use cSplit using the code Cansim_titles <- cSplit(Cansim_titles, title, sep = ';', direction = "wide", fixed = FALSE)

Which give me the error "Error in [.data.table(indt, , splitCols, with = FALSE) : When with=FALSE, j-argument should be of type logical/character/integer indicating the columns to select."

I have no idea where the with = FALSE is coming from. I tried to set it to TRUE in the cSplit and that didn't work either. I think the error is coming from a problem in the data.table but I have no idea how to fix it.

Any advice or where to look for the solution to this would be greatly appreciated!

0 Answers0