Questions tagged as 'r'

1
answer

error in balancing with SMOTE

Hello, I have a slightly unbalanced dataset and I wanted to do some testing with smote, but I'm getting an error: library(DMwR) treinoSmote <- SMOTE(TARGET ~ .,m,k=5, perc.over = 100, perc.under = 200) Error in factor(newCases[, a], leve...
asked by 09.10.2017 / 19:18
1
answer

Read a typed number (R)

Hello everyone, I need to do a barbadinha script in R where I have to read a typed number and give its predecessor (type, if I type 10 the predecessor is 9). But I have a problem that I do not know how it makes the start ... print("Digite u...
asked by 13.09.2017 / 18:53
1
answer

Create a ROC curve in R

I need to plot a ROC curve in R, but I do not know how to correct it. cctrl2 <- trainControl(method = "cv", number = 10, classProbs = TRUE, savePredictions = TRUE) modelNb <- train(Treino[, -5], Treino$TOTAL_PEDIDO, method...
asked by 29.08.2017 / 01:31
1
answer

LineType and shape in ggplot2 in R

I'm using the following code to plot 3 functions: ggplot(data.frame(x = c(0, 2)), aes(x)) + stat_function(fun = exp, geom = "line")+ stat_function(fun = dnorm ,geom = "line")+ stat_function(fun = cos, colour = "blue") Iwouldlik...
asked by 26.08.2017 / 15:46
1
answer

Tapply function - arguments must have the same length

Hello, good evening! I have a date frame with thousands of rows and 58 columns containing, for example, vendor, material, quantity of material, and total value of the material. I made an example below, only what I need in this first moment....
asked by 25.07.2017 / 03:38
1
answer

How to use the tableStack function in R

Good evening my teacher of Biostatistics is teaching to use the R, he passed the following question (Construct frequency tables of RACE, CIVIL STATUS, and SCHOOLING.) Identify the categories of these variables that stand out, do the separatio...
asked by 16.07.2017 / 04:40
1
answer

Bar graph with relative and accumulated frequency

I'm trying to make a bar chart with the count on the bars and the relative and accumulated frequencies of the left and right sides respectively but I'm not getting it. The data is: dput(x2) c(1L, 5L, 3L, 3L, 5L, 3L, 4L, 1L, 2L, 2L, 7L,...
asked by 27.04.2017 / 05:16
2
answers

How to calculate the average of a column in RStudio but ignore the values 0 of the column?

example column 1 = 1 2 3 4 0 0 0 the normal average of this would give 1.428571 however ignoring the 0 would be 2.5, I would like to know how to do this by ignoring the 0 column values.     
asked by 23.04.2017 / 19:03
2
answers

Use values from a dataframe in ifelse

I have the following scenario: Data frame - Resources: recursos <- as.data.frame(c("server01","server02","server03")); colnames(recursos) <- "Server" Data frame - Events: eventos <- as.data.frame(c("falha no server01","e...
asked by 04.05.2017 / 19:23
1
answer

Sentences in a Loop in the R

I'm trying to make a very simple "for", but it does not work: Here are my data: data=structure(c(NA, NA, NA, 0.364282642384808, -3.01119851776463, -8.66579826331935, -3.65240790618631, -2.25772100857938, -1.32788331062106, -3.9345...
asked by 05.04.2017 / 22:04