Intro This is a documentation of how I split a string type column by its length, and combine them together in a directory format (which was a necessary step for me to check whether each directory existed in my analysis).
library(tidyverse) data <- tibble(string = c("123456", "987654")) print(data) ## # A tibble: 2 x 1 ## string ## <chr> ## 1 123456 ## 2 987654 Step 1 strsplit splits the string into a list of strings, and in tibble it will show up as a column of list type.
This will be a part of a series of articles on learning programming and data science. There are many articles on this topic already, but these are for my friends.
This post focuses on learning programming. Most data scientists use Python and R. Between the two, I think Python is a more programming-oriented language. The types of objects are more straightforward, the syntax is easier, the object-oriented approach is clearer, too.