Closed ajdamico closed 6 years ago
lapply doesn't work nicely with file connections
tf1 <- tempfile()
tf2 <- tempfile()
write.csv( mtcars , tf1 , row.names = FALSE )
write.csv( mtcars , tf2 , row.names = FALSE )
con1 <- file( tf1 , 'r' )
con2 <- file( tf2 , 'r' )
# fails because of this line..
c( con1 , con2 )
# works
lapply( c( tf1 , tf2 ) , read.csv )
# works
lapply( list( con1 , con2 ) , read.csv )
con1 <- file( tf1 , 'r' )
# fails
lapply( con1 , read.csv )
# works
lapply( list( con1 ) , read.csv )
should be simple to add, if it is possible to get a file name from the connection. Seems possible summary(file("/tmp/mtcars"))$description
need to write testthats once this is implemented