-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.R
More file actions
44 lines (28 loc) · 1.13 KB
/
graph.R
File metadata and controls
44 lines (28 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require("ggplot2")
require("plyr")
require("reshape2")
require("datasets")
splitFunction <- function(dataFrame, spl = as.character(), namesVect = as.vector(), rm.rows = FALSE){
# Divides the elements of data frame, by a column variable
splList <- split(na.omit(dataFrame), dataFrame[, spl])
# Removes elements with 0 rows, if flag is set to TRUE, default FALSE
#dataList[sapply(dataList, nrow) > 0] experiencia
#experimentar remover com row.names lenght
# Number of rows length to eliminate difined by tresh.rows
splList <- splList[sapply(splList, function(x) !all(is.na(x)))]
If(rm.rows){
splList <- splList[lapply(splList, nrow) > tresh.rows]
}
}
gGraph <- function(dataFrame, spl = as.character(), namesVect = as.vector(), rm.rows = FALSE, tresh.rows = 0){
if(!is.data.frame(dataFrame)){
if(is.list(dataFrame)){
dataFrameSet <- do.call(cbind, dataFrame)
dataFrameSet.melt <- melt(dataFrame)
}
#adding names to the columns of the data frame
names(dataFrameSet) <- namesVect
dataFrameSet.melt
#dataSet <- as.data.frame(dataFrame)
}
}