Questions tagged as 'dplyr'

2
answers

Apply function in data groups

I need to separate the data into groups and perform the calculations in two or three groups / dimensions. I found the tapply function, it solves the problem. With it I get what I need using the average function, sum, etc. But now, I realiz...
asked by 09.10.2015 / 18:55
1
answer

How to change the class of a variable inside a table / data frame / tibble?

I have a table called tab01 with the following variables (columns) and their respective classes in parentheses: uf (character), regiao (character), ano (double) and pop (double ). I want, inside the table:...
asked by 27.06.2017 / 21:03
2
answers

Join for unequal records in R

I have two data frames called employees and employees. nome.empregado <- c('Renato', 'Miguel', 'Paulo', 'Patrícia', 'Inês', 'Saulo', 'Diego', 'Maria', 'Jose', 'Julia', 'Tiago') idade <- c(30, 31, 29, 30, 25, 30, 30, 35, 24, 31, 29) em...
asked by 28.12.2017 / 20:40
1
answer

How to use strings as parameters in R

Galera, I need to create a column using a string and use other column strings as arguments, for example: dataframe <- dataframe %>% mutate("Newstring" = case_when("stringA" < 65 & stringB == 0 ~ 1, TRUE ~ 0)) I believe parsi...
asked by 26.05.2018 / 18:36
1
answer

How to join two data.frames in R with different variables and out of order?

I have two data.frames: frame1 <- data.frame(dia=c("02/01/2017","03/01/2017","04/01/2017","05/01/2017"), y=c(2,2,1,2),w=c(4,4,2,2),z=c(25,16,24,30), k=c("sim","nao","sim","nao")) frame2 <- data.frame(dia=c("05/01/2017","04/01/2017","03/0...
asked by 30.12.2017 / 03:32
1
answer

Select ID vectors with certain characteristics in R

I have a data frame with four columns of values for each ID and I need to create a new df excluding the IDs whose vectors have more than zero or more than one NA. I created the DF library(dplyr) co_entidade<-c(23, 40, 58, 82, 104, 171,...
asked by 24.05.2017 / 20:05
1
answer

In R, use the dplyr functions to find the minimum distance

I have an array with two numeric variables: lat and long . Like this: > head(pontos_sub) id lat long 1 0 -22,91223 -43,18810 2 1 -22,91219 -43,18804 3 2 -22,91225 -43,18816 4 3 -22,89973 -43,20855 5 4 -22,8997...
asked by 07.04.2017 / 05:58
1
answer

Command to describe the data in a table

Hello, I have a database and would like to know the field names through a command in R. What is the best way to proceed? I tried using describe () but with no success.     
asked by 13.12.2018 / 19:56
2
answers

Indicator in R with more than one condition with duplicate values

Suppose there is a base with two variables as follows: Município IF RIOBOM Cooperativa RIOBOM Cooperativa ABADIA Múltiplo ABADIA Múltiplo ABADIA Cooperativa ABADIA Banco DOURADOS Banco DOURADOS Múltiplo DOURADOS Banco DOURADOS...
asked by 09.01.2018 / 17:17
2
answers

Percentage Frequency in R with dplyr

I was looking to use the dplyr package to calculate the Relative Frequency per group. I have a database like the first three columns below and I would like the last column to be the response variable: CNPJ Central depositos Re...
asked by 22.06.2017 / 23:19