ComenzarEmpieza gratis

Reading files in parallel

The Data Analyst on your team has a long list of files that contains birth data from the USA. She has written the following loop to read them all into her workspace:

  df_all <- NULL

  for (file in file_list) {

    df <- read.csv(file)
    df_all <- rbind(df_all, df)
  }

The only problem is that this is taking too long. You, as the resident R expert, want to help. The parallel and profvis packages have been loaded for you.

Este ejercicio forma parte del curso

Parallel Programming in R

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Wrap this code in a profvis call
___
  df_all <- NULL
  
  for (file in file_list) {
    df <- read.csv(file)
    df_all <- rbind(df_all, df)
  }
___
Editar y ejecutar código