Posts by Josiane Souza • 102 points
7 posts
-
5
votes3
answers53
viewsA: maximum values
One option would be: library(dplyr) arrange(dados, desc(km))[1:5] A second option would be: library(data.table) setDT(dados) dados[order(km, decreasing = T)][1:5,] Both generate the same solution:…
ranswered Josiane Souza 102 -
0
votes1
answer43
viewsA: Add equal lines from different tables in R
Through two ways I managed to solve this: A) using Aggregate and rbind aggregate(Changes ~ ., rbind(t1, t2), sum) B) or creating a new column with the sums: joined = merge(t1,t2,by =…
-
1
votes1
answer44
viewsQ: Extract position of values in a matrix in R
I have the following data: numbers <- c(303, 2107, 35000) matriz <- matrix(1:90000, nrow = 300, ncol = 300, byrow=T) I need the position of the values in the matrix. I am trying with the…
-
0
votes2
answers39
viewsA: How to sort my bar chart per day of the week on R
First you can sort the data by day of the week: date_manip$Dia_semana <- ordered(date_manip$Dia_semana, levels=c("domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira",…
-
0
votes1
answer31
viewsQ: loop to replicate a dataframe in R
I have the following dataframe: df <- data.frame(x1 = 1:7,x2 = 8:14, x3 = 15:21, x4 = 23:29, x5 = 30:36) I need to replicate the value of each row 150, 100, 60, 43 times and for each column. I…
-
1
votes1
answer46
viewsQ: Logical condition on a dataframe
After finding a value of a calculation I need to compare if this value is equal to any of the first column of the table below (percentile), if it is equal, the corresponding value will be selected…
rasked Josiane Souza 102 -
1
votes1
answer43
viewsQ: Add equal lines from different tables in R
I am having several tables with three columns as output, for example: Inicial Final Mudanca 1 1 200 1 3 500 3 1 250 3 3 175 Tabela 2 Inicial Final Mudanca 1 3 180 1 5 265 3 3 147 3 7 155 I need to…