Skip to contents

If filenames are consistently named with the same character serating factors, and with every individual including its belonging levels, e.g.:

  • 001_speciesI_siteA_ind1_dorsalview

  • 002_speciesI_siteA_ind2_lateralview

etc., this function returns a data.frame from it that can be passed to Out, Opn, Ldk objects.

Usage

lf_structure(lf, names = character(), split = "_", trim.extension = FALSE)

Arguments

lf

a list (its names are used, except if it is a list from import_tps in this case names(lf$coo) is used) of a list of filenames, as characters, typically such as those obtained with list.files. Alternatively, a path to a folder containing the files. Actually, if lf is of length 1 (a single character), the function assumes it is a path and do a list.files on it.

names

the names of the groups, as a vector of characters which length corresponds to the number of groups.

split

character, the spliting factor used for the file names.

trim.extension

logical. Whether to remove the last for characters in filenames, typically their extension, e.g. '.jpg'.

Value

data.frame with, for every individual, the corresponding level for every group.

Details

The number of groups must be consistent across filenames.

Note

This is, to my view, a good practice to 'store' the grouping structure in filenames, but it is of course not mandatory.

Note also that you can: i) do a import_jpg and save is a list, say 'foo'; then ii) pass 'names(foo)' to lf_structure. See Momocs' vignette for an illustration.

Note this function will be deprecated from Momocs when Momacs and Momit will be fully operationnal.

See also

import_jpg1, import_Conte, import_txt, lf_structure. See also Momocs' vignettes for data import.

Other babel functions: tie_jpg_txt()