Icon

m_​010_​unzip_​only_​csv

using R to only extract certain type of file (.csv) from a ZIP archive

using R to only extract certain type of file (.csv) from a ZIP archive

library(utils)# the name of the original ZIP-file containing several different data typesv_zip_file <- paste0(knime.flow.in[["var_path_data"]], "file_with_mixed_data.zip")# where to extract the files tov_path_files_to_unzip <- paste0(knime.flow.in[["var_path_data"]], "extract from r - csv_only/")# https://stackoverflow.com/questions/8986818/automate-zip-file-reading-in-r/31820607#31820607# get the list of all CSV fileszipped_csv_names <- grep('\\.csv$', unzip(zipfile=v_zip_file, list=TRUE)$Name, ignore.case=TRUE, value=TRUE) unzip(zipfile=v_zip_file, files = zipped_csv_names, list = FALSE, overwrite = TRUE, junkpaths = TRUE, exdir = v_path_files_to_unzip , unzip = "internal", setTimes = FALSE) knime.out <- as.data.frame(zipped_csv_names) using R to only extract certain type of file (.csv) from a ZIP archivehttps://forum.knime.com/t/outout-directory-does-not-exist-error/27610/4?u=mlauber71download the whole workflow group: https://hub.knime.com/mlauber71/spaces/Public/kn_example_r_zip_archiv~M9guutnmWfSzP8Pb/ KNIME and R — installation across operating systems — some remarkshttps://medium.com/p/6494a2a498cc locate and create/data/ folderwith absolute pathsunzip only CSV files../data/file_with_mixed_data.zipvar_path_data Collect LocalMetadata R Source (Table) create zip file withmultiple data types Java EditVariable (simple) library(utils)# the name of the original ZIP-file containing several different data typesv_zip_file <- paste0(knime.flow.in[["var_path_data"]], "file_with_mixed_data.zip")# where to extract the files tov_path_files_to_unzip <- paste0(knime.flow.in[["var_path_data"]], "extract from r - csv_only/")# https://stackoverflow.com/questions/8986818/automate-zip-file-reading-in-r/31820607#31820607# get the list of all CSV fileszipped_csv_names <- grep('\\.csv$', unzip(zipfile=v_zip_file, list=TRUE)$Name, ignore.case=TRUE, value=TRUE) unzip(zipfile=v_zip_file, files = zipped_csv_names, list = FALSE, overwrite = TRUE, junkpaths = TRUE, exdir = v_path_files_to_unzip , unzip = "internal", setTimes = FALSE) knime.out <- as.data.frame(zipped_csv_names) using R to only extract certain type of file (.csv) from a ZIP archivehttps://forum.knime.com/t/outout-directory-does-not-exist-error/27610/4?u=mlauber71download the whole workflow group: https://hub.knime.com/mlauber71/spaces/Public/kn_example_r_zip_archiv~M9guutnmWfSzP8Pb/ KNIME and R — installation across operating systems — some remarkshttps://medium.com/p/6494a2a498cc locate and create/data/ folderwith absolute pathsunzip only CSV files../data/file_with_mixed_data.zipvar_path_dataCollect LocalMetadata R Source (Table) create zip file withmultiple data types Java EditVariable (simple)

Nodes

Extensions

Links