@@ -214,7 +214,9 @@ tc_read <- tc_load
214214# compared to Python API, so also not available here.
215215# @return A list with two data.frames; the first contains tree sequence
216216# properties and their value; the second contains the numbers of rows in
217- # tables and the length of their metadata.
217+ # tables and the length of their metadata. All columns are character as they
218+ # contain different types of values. Use specific functions if you want to
219+ # obtain non-character values
218220# @seealso \code{\link[=TreeSequence]{TreeSequence$print}} on how this
219221# function is used and presented to users.
220222# @examples
@@ -243,17 +245,17 @@ rtsk_treeseq_print <- function(ts) {
243245 " file_uuid"
244246 ),
245247 value = c(
246- tmp_summary [[" num_samples" ]],
247- tmp_summary [[" num_trees" ]],
248- tmp_summary [[" sequence_length" ]],
249- tmp_summary [[" discrete_genome" ]],
250- tmp_summary [[" has_reference_sequence" ]],
251- tmp_summary [[" time_units" ]],
252- tmp_summary [[" discrete_time" ]],
253- tmp_summary [[" min_time" ]],
254- tmp_summary [[" max_time" ]],
255- tmp_metadata [[" ts" ]] > 0 ,
256- tmp_summary [[" file_uuid" ]]
248+ as.character( tmp_summary [[" num_samples" ]]) ,
249+ as.character( tmp_summary [[" num_trees" ]]) ,
250+ as.character( tmp_summary [[" sequence_length" ]]) ,
251+ as.character( tmp_summary [[" discrete_genome" ]]) ,
252+ as.character( tmp_summary [[" has_reference_sequence" ]]) ,
253+ as.character( tmp_summary [[" time_units" ]]) ,
254+ as.character( tmp_summary [[" discrete_time" ]]) ,
255+ as.character( tmp_summary [[" min_time" ]]) ,
256+ as.character( tmp_summary [[" max_time" ]]) ,
257+ as.character( tmp_metadata [[" ts" ]] > 0 ) ,
258+ as.character( tmp_summary [[" file_uuid" ]])
257259 )
258260 ),
259261 tables = data.frame (
@@ -268,24 +270,24 @@ rtsk_treeseq_print <- function(ts) {
268270 " mutations"
269271 ),
270272 number = c(
271- tmp_summary [[" num_provenances" ]],
272- tmp_summary [[" num_populations" ]],
273- tmp_summary [[" num_migrations" ]],
274- tmp_summary [[" num_individuals" ]],
275- tmp_summary [[" num_nodes" ]],
276- tmp_summary [[" num_edges" ]],
277- tmp_summary [[" num_sites" ]],
278- tmp_summary [[" num_mutations" ]]
273+ as.character( tmp_summary [[" num_provenances" ]]) ,
274+ as.character( tmp_summary [[" num_populations" ]]) ,
275+ as.character( tmp_summary [[" num_migrations" ]]) ,
276+ as.character( tmp_summary [[" num_individuals" ]]) ,
277+ as.character( tmp_summary [[" num_nodes" ]]) ,
278+ as.character( tmp_summary [[" num_edges" ]]) ,
279+ as.character( tmp_summary [[" num_sites" ]]) ,
280+ as.character( tmp_summary [[" num_mutations" ]])
279281 ),
280282 has_metadata = c(
281283 NA , # provenances have no metadata
282- tmp_metadata [[" populations" ]] > 0 ,
283- tmp_metadata [[" migrations" ]] > 0 ,
284- tmp_metadata [[" individuals" ]] > 0 ,
285- tmp_metadata [[" nodes" ]] > 0 ,
286- tmp_metadata [[" edges" ]] > 0 ,
287- tmp_metadata [[" sites" ]] > 0 ,
288- tmp_metadata [[" mutations" ]] > 0
284+ as.character( tmp_metadata [[" populations" ]] > 0 ) ,
285+ as.character( tmp_metadata [[" migrations" ]] > 0 ) ,
286+ as.character( tmp_metadata [[" individuals" ]] > 0 ) ,
287+ as.character( tmp_metadata [[" nodes" ]] > 0 ) ,
288+ as.character( tmp_metadata [[" edges" ]] > 0 ) ,
289+ as.character( tmp_metadata [[" sites" ]] > 0 ) ,
290+ as.character( tmp_metadata [[" mutations" ]] > 0 )
289291 )
290292 )
291293 )
@@ -299,7 +301,9 @@ rtsk_treeseq_print <- function(ts) {
299301# \code{\link{rtsk_table_collection_metadata_length}}.
300302# @return A list with two data.frames; the first contains table collection
301303# properties and their value; the second contains the numbers of rows in
302- # tables and the length of their metadata.
304+ # tables and the length of their metadata. All columns are character as they
305+ # contain different types of values. Use specific functions if you want to
306+ # obtain non-character values
303307# @seealso \code{\link[=TableCollection]{TableCollection$print}} on how this
304308# function is used and presented to users.
305309# @examples
@@ -323,12 +327,12 @@ rtsk_table_collection_print <- function(tc) {
323327 " has_index"
324328 ),
325329 value = c(
326- tmp_summary [[" sequence_length" ]],
327- tmp_summary [[" has_reference_sequence" ]],
328- tmp_summary [[" time_units" ]],
329- tmp_metadata [[" tc" ]] > 0 ,
330- tmp_summary [[" file_uuid" ]],
331- tmp_summary [[" has_index" ]]
330+ as.character( tmp_summary [[" sequence_length" ]]) ,
331+ as.character( tmp_summary [[" has_reference_sequence" ]]) ,
332+ as.character( tmp_summary [[" time_units" ]]) ,
333+ as.character( tmp_metadata [[" tc" ]] > 0 ) ,
334+ as.character( tmp_summary [[" file_uuid" ]]) ,
335+ as.character( tmp_summary [[" has_index" ]])
332336 )
333337 ),
334338 tables = data.frame (
@@ -343,24 +347,24 @@ rtsk_table_collection_print <- function(tc) {
343347 " mutations"
344348 ),
345349 number = c(
346- tmp_summary [[" num_provenances" ]],
347- tmp_summary [[" num_populations" ]],
348- tmp_summary [[" num_migrations" ]],
349- tmp_summary [[" num_individuals" ]],
350- tmp_summary [[" num_nodes" ]],
351- tmp_summary [[" num_edges" ]],
352- tmp_summary [[" num_sites" ]],
353- tmp_summary [[" num_mutations" ]]
350+ as.character( tmp_summary [[" num_provenances" ]]) ,
351+ as.character( tmp_summary [[" num_populations" ]]) ,
352+ as.character( tmp_summary [[" num_migrations" ]]) ,
353+ as.character( tmp_summary [[" num_individuals" ]]) ,
354+ as.character( tmp_summary [[" num_nodes" ]]) ,
355+ as.character( tmp_summary [[" num_edges" ]]) ,
356+ as.character( tmp_summary [[" num_sites" ]]) ,
357+ as.character( tmp_summary [[" num_mutations" ]])
354358 ),
355359 has_metadata = c(
356360 NA , # provenances have no metadata
357- tmp_metadata [[" populations" ]] > 0 ,
358- tmp_metadata [[" migrations" ]] > 0 ,
359- tmp_metadata [[" individuals" ]] > 0 ,
360- tmp_metadata [[" nodes" ]] > 0 ,
361- tmp_metadata [[" edges" ]] > 0 ,
362- tmp_metadata [[" sites" ]] > 0 ,
363- tmp_metadata [[" mutations" ]] > 0
361+ as.character( tmp_metadata [[" populations" ]] > 0 ) ,
362+ as.character( tmp_metadata [[" migrations" ]] > 0 ) ,
363+ as.character( tmp_metadata [[" individuals" ]] > 0 ) ,
364+ as.character( tmp_metadata [[" nodes" ]] > 0 ) ,
365+ as.character( tmp_metadata [[" edges" ]] > 0 ) ,
366+ as.character( tmp_metadata [[" sites" ]] > 0 ) ,
367+ as.character( tmp_metadata [[" mutations" ]] > 0 )
364368 )
365369 )
366370 )
0 commit comments