Skip to content
Snippets Groups Projects
Commit 2d53905e authored by Jean-Karim Heriche's avatar Jean-Karim Heriche
Browse files

Create ide.config object when loading rds settings file. Replace deprecated aes_string() function.

parent 2803d834
No related branches found
No related tags found
No related merge requests found
Pipeline #45935 passed
......@@ -370,6 +370,7 @@ input_data_server <- function(input, output, session) {
for(field in inputChoices.params) {
rv$inputChoices[[field]] <- settings[[field]]
}
ide.config <- NULL
} else if(!is.null(input$readConfigFile) && has_extension(input$readConfigFile$datapath, 'toml') == TRUE) {
# A TOML config file was uploaded
ide.config <- read.config(file = input$readConfigFile$datapath)
......
......@@ -81,7 +81,7 @@ plot_server <- function(input, output, session, rv) {
}
if(length(selectedCols) > 0 && length(selectedCols) <= 2) {
colours <- "grey"
p <- ggplot(data = Dunselected, aes_string(x = selectedCols[1], y = selectedCols[2], key = "ide.id")) +
p <- ggplot(data = Dunselected, aes(x = .data[[selectedCols[1]]], y = .data[[selectedCols[2]]], key = .data[["ide.id"]])) +
labs(x = eval(selectedCols[1]), y = eval(selectedCols[2])) +
coord_cartesian(expand = TRUE)
if(!is.null(rv$clusters)) {
......@@ -118,7 +118,7 @@ plot_server <- function(input, output, session, rv) {
if(!is.null(rv$selectedRows) && length(rv$selectedRows)>0) {
# Selected points
p <- p + geom_point(data = D[rv$selectedRows,],
aes_string(x = selectedCols[1], y = selectedCols[2], key = "ide.id"),
aes(x = .data[[selectedCols[1]]], y = .data[[selectedCols[2]]], key = .data[["ide.id"]]),
colour = "black")
}
ggplotly(p, dynamicTicks = TRUE, tooltip = "none", source = "scatterPlot") %>%
......@@ -165,7 +165,7 @@ plot_server <- function(input, output, session, rv) {
} else {
clusters <- NULL
}
p <- ggplot(data = D, aes_string(x = selectedCols[1], fill = clusters, color = clusters))
p <- ggplot(data = D, aes(x = .data[[selectedCols[1]]], fill = clusters, color = clusters))
# Heuristic to choose binning
if(max(D[, get(selectedCols[1])], na.rm = TRUE)>10) { # use binwidth = 1
p <- p + geom_histogram(position = "identity", binwidth = 1, aes(y = after_stat(count)), alpha = 0.5) +
......@@ -175,7 +175,7 @@ plot_server <- function(input, output, session, rv) {
scale_color_manual(name = "", values = colours) + scale_fill_manual(name = "", values = colours)
}
} else {
p <- ggplot(data = D, aes_string(x = selectedCols[1]))
p <- ggplot(data = D, aes(x = .data[[selectedCols[1]]]))
if(max(D[, get(selectedCols[1])], na.rm = TRUE)>10) { # use binwidth = 1
p <- p + geom_histogram(position = "identity", binwidth = 1, aes(y = after_stat(count)), color=colours, fill=colours)
} else { # make 30 bins
......@@ -217,11 +217,11 @@ plot_server <- function(input, output, session, rv) {
if(any(levels(clusters)=="N/A")) {
clusters <- relevel(clusters, "N/A") # Make N/A first level
}
p <- ggplot(data = D, aes_string(x = "clusters", y = selectedCols[1])) +
p <- ggplot(data = D, aes(x = .data[["clusters"]], y = .data[[selectedCols[1]]])) +
theme(axis.text.x=element_blank(), axis.title.x=element_blank(), axis.ticks.x=element_blank())
if(n.clusters<=8) {
colours <- c("grey", brewer.pal(n = 8, name = "Set1"))
p <- p + geom_boxplot(aes_string(fill = "clusters", color = "clusters")) +
p <- p + geom_boxplot(aes(fill = .data[["clusters"]], color = .data[["clusters"]])) +
scale_fill_manual(name = "", values = colours) +
scale_color_manual(name = "", values = colours)
} else if(n.clusters<=25) {
......@@ -230,16 +230,16 @@ plot_server <- function(input, output, session, rv) {
"#FFCC99", "#94FFB5", "#8F7C00", "#9DCC00", "#C20088", "#003380", "#FFA405",
"#FFA8BB", "#426600", "#FF0010", "#5EF1F2", "#00998F", "#E0FF66", "#740AFF",
"#990000", "#FFFF80", "#FFE100", "#FF5005")
p <- p + geom_boxplot(aes_string(fill = "clusters", color = "clusters")) +
p <- p + geom_boxplot(aes(fill = .data[["clusters"]], color = .data[["clusters"]])) +
scale_fill_manual(name = "", values = colours) +
scale_color_manual(name = "", values = colours)
} else {
p <- p + geom_boxplot(aes_string(fill = "clusters", color = "clusters")) +
p <- p + geom_boxplot(aes(fill = .data[["clusters"]], color = .data[["clusters"]])) +
scale_fill_manual(name = "", values = rep('#A4A4A4', n.clusters)) +
scale_color_manual(name = "", values = rep('black', n.clusters))
}
} else {
p <- ggplot(data = D, aes_string(y = selectedCols[1])) +
p <- ggplot(data = D, aes(y = .data[[selectedCols[1]]])) +
geom_boxplot(color=colours, fill=colours)
}
p <- p + theme(plot.title = element_blank(), legend.title = element_blank())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment