guess.sep {tkWidgets}R Documentation

Automatically determines whether a data file has a header and what delimiter is used to separate data columns

Description

This function reads a few lines from a data text file and determines whether a header exists, what the delimiter, and what data type each column is for a given file.

Usage

guess.sep(file.name, numLine = 5, seps = "", isFile = TRUE)
guess.header(twoLines, sep)
find.type(line, sep, header = FALSE)
charOrNum(vect)

Arguments

file.name file.name a character string for the name of the file of interests
numLine n an integer or character indicating the total number of lines to be read from the file for making the determination
seps seps a vector of characters of potential delimiters to be used to make the determination. Default delimiters include " ", ",", ";", and "t". Anything inaddition to the default will have to be included in seps
twoLines twoLines a vector of character string including the first two lines of a file that will be used to determine whether the file has a header
sep sep a character for the delimiter used to separate columns in a file
line line a vector of character strings including the first few lines of file to be checked for data type of whose columns
vect vect a vector of character or numeric string
header header a boolean indicating whether a file has headers
isFile isFile a boolean that is TRUE when file.name is a file or FALSE an object

Details

guess.sep calls guess.sep and find.type to determine the header, delimiter, and column data type of a file.

charOrNum determines which elements of a vector are numeric or character.

Value

This function returns a list containing

header TRUE if there is a header and FALSE otherwise
separater A character string indicating the delimiter used
type A vector of character strings that are either character or numeric

Note

This function is part of the Bioconductor project at Dana-Farber Cancer Institute to provide Bioinformatics functionalities through R

Author(s)

Jianhua Zhang

See Also

fileWizard

Examples

# Create a temp file
tempData <- matrix(1:20, ncol = 4)
write.table(tempData, file = "tempData", quote = FALSE, sep =
"\t", row.names = FALSE, col.names = TRUE)

guess.sep("tempData")

unlink("tempData")

[Package Contents]