Sample lines from a CSV file within R using C code