Basic input filename parsing in R -
i have log files in directory , want generate graphs each of them. have written r functions plot graphs , save in jpg files. csv files named "_par1_par2_par3_date.log" there way can par1, par2 , par3 values inside r code use calculations? integers, if helps. take files , generate graphs in single command vs giving single commands each of 100 or files.
once read in of files want, can use str_extract()
or str_extract_all
pattern matching stringr
package pull out items file name:
> teststring <- "_2342_2773_23452_date.log" > library(stringr) > str_extract_all(teststring, "([0-9]+)") [[1]] [1] "2342" "2773" "23452" > str_extract_all(teststring, "([0-9]+)")[[1]][1] [1] "2342"
then read values data frame , charts there.
Comments
Post a Comment