Description Usage Arguments Value Author(s) Examples
This function open a CSV, copies its first three columns to a data set and then sort it by the first column, the function assumes the first column is the X values, the second one the Y values and the third one to be the weights column and names these columns accordingly
1 |
str |
A string containing the full path of the CSV file to be imported, should be left blank if manual data entry is desired |
head |
A boolean variable indicating if the imported CSV file has a header row or not, ignored if str is null |
A data set sorted by the first column
Tal Carmi, Liat Gaziel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #Assuming there is a three column csv in C drive named "data.csv" with no header
#mydata<-fillCSVData("c:/data.csv",FALSE)
## The function is currently defined as
function (str, head)
{
mat <- read.table(str, header = head, sep = ",")
names(mat)[1] = "X"
names(mat)[2] = "Y"
if ((is.null(mat[1, 3]) && is.null(mat[2, 3])) || (mat[1,
3] == 0 && mat[2, 3] == 0))
mat <- calcWeights(mat)
names(mat)[3] = "Weights"
mat <- mat[order(mat[1]), ]
return(mat)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.