Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/BioGeoBEARS_generics_v1.R

This function returns the `class`

of
each column in a `data.frame`

.

1 |

`dtf` |
Input |

`printout` |
Print the results to screen, if desired. |

R does lots of weird and unpredictable things when you
build up tables/matrices/data.frames by e.g.
`cbind`

and `rbind`

on vectors of results. The major problems are (1)
columns get made into class `list`

; (2)
`numeric`

columns are converted to
class `factor`

; (3)
`numeric`

columns are converted to
class `character`

; (4) you have a
`matrix`

when you think you have a
`data.frame`

.

All of this could be taken care of by detailed
understanding and tracking of when R recasts values in
vectors, matrices, and data frames...but this is a huge
pain, it is easier to just have a function that jams
everything back to a `data.frame`

with
no lists, no factors, and with columns being numeric
where possible. See `dfnums_to_numeric`

and
`unlist_df4`

for these options.

`dtf_classes`

A `data.frame`

showing the column, column name, and column class.

Go BEARS!

Nicholas J. Matzke [email protected]

http://phylo.wikidot.com/matzke-2013-international-biogeography-society-poster

Matzke_2012_IBS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
x = matrix(c(1,2,3,4,5,6), nrow=3, ncol=2)
cls.df(x)
dfnums_to_numeric(adf(x))
unlist_df4(x)
x = matrix(c(1,2,3,4,5,"A"), nrow=3, ncol=2)
cls.df(x)
dfnums_to_numeric(adf(x))
unlist_df4(x)
x = adf(matrix(c(1,2,3,4,5,"A"), nrow=3, ncol=2))
names(x) = c("A","B")
cls.df(x)
dfnums_to_numeric(adf(x))
unlist_df4(x)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.