convertCSV {wpm} | R Documentation

## Convert a CSV File into a valid dataframe for WPM

### Description

This function converts a CSV into a dataframe to make it usable by the shiny application of wpm as well as by the wrapper function (version of wpm in command line). Be sure that the first column of the CSV file corresponds to samples names.

### Usage

    convertCSV(dt_path, row_names = FALSE, gp_field = NULL, ...)

### Arguments

`dt_path` | file path.
`row_names` | logical value, indicates if the file has rownames or not.
`gp_field` | the column name indicating the grouping factor for the samples in the csv. If there is no grouping factor, then gp_field must be set to NULL or "none".
`...` | parameters to give to read.csv2 function

### Value

a list containing a dataframe containing the data of the imported CSV and a dataframe containing 3 fields (Sample, Group and ID) which will be used by WPM. Or NULL if there is an error when giving wrong parameters.

### Examples

    test <- data.frame("Sample" = c("s1","s2","s3","s4"),
                       "Group" = c("A","A","B", "C"))
    tf <- tempfile()
    write.csv2(test, tf, row.names = FALSE)
    convertCSV(tf, gp_field = "Group", header = TRUE, sep = ";")

    # if there are row names in the CSV file
    write.csv2(test, tf)
    convertCSV(tf, row_names = TRUE, gp_field="Group", header = TRUE, sep = ";")

    # if there is no grouping factor in the CSV file
    convertCSV(tf, row_names = TRUE, gp_field ="none", header = TRUE, sep = ";")
    # gives the same output as the previous example
    convertCSV(tf, row_names = TRUE, header = TRUE, sep = ";")

[Package wpm version 1.2.1 Index]