Currently we read in distance matrices and count tables from disk as if they were generated by mothur. But, if they were generated in R, how do we hand off the data to clustur without writing to/reading from disk?
This should be "easy" to do... Could we have a conversion function that converts between an object from stats::dist() or sparseMatrix and our read_dist() object or a data.frame object and our read_count() object? Possible functions convert_dist() / convert_count()
More challenging... Could we pass a memory address between packages? For example, if down the road we create a calc_dist() function that stores the distances as a pointer to a C++ object, can we pass that object to cluster() or do we need to output to a data.frame and then convert that to our pointer? What are the memory/speed considerations here? Are deep copies generated? It would be good to set up a toy package to see if we can create the pointer and pass it to cluster.
Currently we read in distance matrices and count tables from disk as if they were generated by mothur. But, if they were generated in R, how do we hand off the data to clustur without writing to/reading from disk?
This should be "easy" to do... Could we have a conversion function that converts between an object from
stats::dist()
orsparseMatrix
and ourread_dist()
object or adata.frame
object and ourread_count()
object? Possible functionsconvert_dist()
/convert_count()
More challenging... Could we pass a memory address between packages? For example, if down the road we create a
calc_dist()
function that stores the distances as a pointer to a C++ object, can we pass that object tocluster()
or do we need to output to a data.frame and then convert that to our pointer? What are the memory/speed considerations here? Are deep copies generated? It would be good to set up a toy package to see if we can create the pointer and pass it tocluster
.