Most voted "dplyr" questions
dplyr is an R package dedicated to data manipulation.
Learn more…124 questions
Sort by count of
-
0
votes1
answer105
viewsFilter columns conditionally to another column
I would like to select a single value in the dataframe below, according to the following parameters: 1) The values in column nJRS would be the reference; 2) The value of the column nJRS should…
-
0
votes2
answers123
viewsHow to turn column into row in dataframe
I have two dataframes and would like to transform the data of the two columns of the 2nd df into rows to be added in sequence of the data of the 1st df. To illustrate create the two df and the final…
-
0
votes2
answers51
viewsHow to find out how many times a certain level is repeated in a specific column (factor) of a data.frame?
I am working with 4 data frames (W, X, Y and Z) that have the same number of variables. Factor (column/variable) 11 was classified into 3 different levels (1, 2, 3). I need to find out how many…
-
0
votes1
answer476
viewsTake a sample without repetition taking into account 2 variables in the R
I have two bases. One with the lines I would like to take the sample and the other with the sample size with the dates. The first one that is the database of fact that I need to make the sample, is…
-
0
votes1
answer145
viewsdplyr filter() problems
Hi, guys. Well, I went to try to replicate a code I made on the work computer on my notebook. At some point, I do a data filtering with the dplyr using the signals "<" and ">". When I made the…
-
0
votes2
answers40
viewsI want to group 3 columns into one, separated by a comma in the R
My dataset is like this: x y z A 1.1 1.2 1.3 B 2.1 2.2 2.3 Using R, I want to group the 3 columns into one, separated by a comma. I want you to stay like this: x A 1.1, 1.2, 1.3 B 2.1, 2.2, 2.3 Dice…
-
0
votes1
answer34
viewsHow to separate data that is in the same column in Rstudio?
Good evening, I have a table that I imported from excel to Rstudio and I want to work with the "Date" column. I need to separate the date from the hours and so far have not succeeded through the…
-
0
votes2
answers81
viewsDifference between dates located in different rows and columns
In R, I have the following data: entrada saida id ordem 2013-01-15 2013-05-20 1 1 2015-03-13 2015-09-12 1 2 2016-01-12 2016-04-11 1 3 I want to add a column with the difference (days) between the…
-
0
votes1
answer38
viewsHow to enter the suffix of the name of an output in the input function$.... _rows_selected?
I am building a function in R Shiny and in this function I want to take the suffix of the name of a output$sufixo and incorporate it into a function of the DT input$sufix_rows_selected. Does anyone…
-
0
votes1
answer422
viewsGroup and sum columns - r
Dice: P<-c("Alemanha", "USA", "Alemanha", "USA", "USA", "França") Citacoes<-c(1,5,8,0,9,20) df<-data.frame(P,Citacoes) Each P (country) represents 1 document and each document has an amount…
-
0
votes1
answer15
viewsComplete values in column based on condition and value in another column
I’ve been trying to figure this out for a while, but it didn’t work out. I have this table below. What I want is for the inchikey column to be completed according to the "cid_pub_chem" column. If…
-
0
votes1
answer53
viewsWrong return when grouping rows from a data frame
I am working with a dataframe and I aim to group the lines that have the same content in the first column (Course, which are factors). Therefore the following commands: library(dplyr) data.test2…
-
0
votes2
answers172
viewsHow to remove NA from a dataframe in R?
I have a DF that has some NA, as I will use it to assemble a table, I needed to exchange the NA by " ", to only show the empty space in the table. I am using a mutate_if to leave the numbers to only…
-
0
votes1
answer116
viewsHow to use summarise?
I have a DF with energy data and would like to group the data by activity (because they are divided by state and I want to do the aggregate for Brazil) and add these data for each date. I was trying…
-
0
votes1
answer287
viewsI cannot install the dplyr package on Rstudio
I cannot install the "dplyr" package in Rstudio. When I try the following warnings appear: > install.packages("dplyr") Installing package into…
-
0
votes0
answers37
viewsdynamic table in Rstudio
I am using Rstudio and would like to transform a table that is in this format municipality affiliated to entities Antoinina yes Antonina nay Antonina Not Antonina yes Antoinina NI Paranaguá nay…
-
0
votes1
answer56
viewsName columns generated by Summarise() and use division in the same function
df is the data frame with the data that I will work with df <- data.frame(matrix(NA,nrow = 30, ncol = 6)) colnames(df) <- c("ano","mes","x1","x2","x3","x4") df$ano <-…
-
0
votes2
answers41
viewsR, How to calculate the mean of a variable x for each group of other variables
I wanted to make a table more or less like this: A column with the nominal variables and their groups and another column with the average of a variable x for each group of each variable. With dplyr…
-
0
votes1
answer33
viewsPlot multiple columns at the same time
I need to plot all columns of a table relative to a specific column. Dataset: df <- read.table( text = "c1 c2 c3 x 2 4 5 0 3 5 2 0 6 7 8 0 1 2 5 1 2 5 6 1 3 3 3 1", header = TRUE) I need to plot…
-
0
votes0
answers14
viewsExecution interrupted
I’m trying to run a script, but the following error is appearing: udunits system database read from C:/Users/André/Documents/R/win-library/4.1/udunits2/share/udunits/udunits2.xml summarise() has…
-
-1
votes1
answer60
viewsHow to make two loops for the same code just go varying the column of the courses and the columns of the questions?
I have a data.frame with lots of code in the rows and lots of columns of questions, I’m doing the simple frequency of each question I would like to know how to vary the courses and questions at…
-
-1
votes1
answer46
viewsDate manipulation using dplyr and lubridate
I have a date frame whose columns have dates (%Y/%m/%d), times and averages per hour over 4 months (01/01/2020 - 01/04/2020). I wonder how I could calculate the average of these hourly values, for…
-
-2
votes1
answer297
viewsFilter with 2 variable conditions
I have two databases, the first one has about 30,000 lines the second 571. I need to filter the first with two conditions from the second bank. Condition A: fctr be == Condition B: date <= I…
-
-3
votes2
answers67
viewsHow to group by text [R]
I have a column in the dataset that has several variants of 5 options. I wanted to group based on what you have written in common. For example: coluna1 lapis vermelho grande lapis azul grande lapis…