Has your knowledge stopped updating?

Some years ago I read an article – I forget where – describing how our general knowledge often becomes frozen in time. Asked to name the tallest building in the world you confidently proclaim “the Sears Tower!”, because for most of your childhood that was the case – never mind that the record was surpassed long ago and it isn’t even called the Sears Tower anymore. From memory the example in the article was of a middle-aged speaker who constantly referred to a figure of 4 billion for the human population – again, because that’s what he learned in school and had never mentally updated. Is this the case with programming too? Oh yes – as I learned today when performing the simplest of tasks: reading CSV files using R. Here’s the scenario: given a directory containing CSV files with the same columns, read them into a single data frame with an additional column containing the file name. We start with list_files() of course, something along the lines of. csv_files <- list.files(path = "path/to/the/folder", pattern = ".csv", full.names = TRUE) My frozen, outdated knowledge tells me that the next steps are: (1) use lapply() to read the CSV files into a list of data frames, (2) use the vector of file names as names for the list and (3) use dplyr::bind_rows() to create a single data frame and add the column of file names, here named “path”. library(dplyr) library(readr) ...
Source: What You're Doing Is Rather Desperate - Category: Bioinformatics Authors: Tags: education R statistics readr read_csv rstats tidyverse Source Type: blogs