Binds with a database

Description

Adds columns to a Coo or Coe object from a data base. Data base must be provided as a data.frame or as a path which will be read.tabled with ... arguments.

Usage

1
bind_db(x, fac_col = "id", db, db_col = "id", ...)

Arguments

x

Coo or Coe object

fac_col

character (no numeric here) where to find ids in the fac

db

data.frame with the right number of rows, or a path as character. Then use ... to pass arguments to read.table

db_col

character where to fin ids in db

...

more parameters passed to read.table

Details

Many checks are done on the binding and this is the main advantage of using this method. It requires an "id" on both the Coo/Coe and the database. There is no assumption that shapes/coefficients are in the right order in the Coo/Coe (but a mutate(your_object, id=1:length(your_object)) would do the trick, see examples).

See Also

Other babel functions: chc2Out, chc2pix, import_StereoMorph_curve1, import_jpg, import_tps, nef2Coe, ntsrow2Coo, pix2chc, tie_jpg_txt, tps2coo

Examples

1
2
3
4
5
6
7
8
# Coo example
df <- data.frame(foo_id=40:1, fake1=rnorm(40), fake2=factor(rep(letters[1:4], 10)))
bot <- mutate(bot, hello=1:length(bot))
bind_db(bot, "hello", df, "foo_id")

# example on a Coe
bf <- efourier(bot, 12)
bind_db(bf, "hello", df, "foo_id")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.