Questions tagged as 'r'

2
answers

How to make mobile sum in R?

I have a 1:50 vector and I need to make a moving sum (equal to the moving average), ie in the case of the last 5 observations, the new vector would be c(sum(1:5), sum(2:6), sum(3:7), ..., sum(45:49), sum(46:50)) . The aggregate func...
asked by 17.12.2018 / 15:51
3
answers

Fill column of a data frame with data from another date frame in R

I have the following df (data1): ITEM CLASSIFICACAO 123 AZUL 456 AMARELO 789 234 VERDE 345 PRETO 456 567 678 ROSA I need to fill in the blank lines of the CLASSIFICACAO column using another data frame: ITE...
asked by 14.09.2018 / 22:02
2
answers

Create new array from a fairly large first array efficiently

Dear, in R, I have a very large database and I want to create new columns. I will try to explain my problem with a very small matrix. Next, "1" means private school and "2", publishes. I have for example a database >Data Casa Escola 1...
asked by 16.08.2014 / 00:21
1
answer

Detect the last day of the month

At the beginning of the month I always need to calculate the age of the people within a given database. I always do considering the last date of that month, for example: in September I calculated the age using September 30th as a reference, so e...
asked by 17.10.2017 / 14:48
2
answers

How to separate characters from a string in R?

I have values a string containing a date "01/01/2000" I want to separate the day, month and year. #Data #01/01/2000 #Dia Mês Ano #01 01 2000 How do I do this in R?     
asked by 15.09.2015 / 13:35
1
answer

How to position text in the middle columns?

Hello, I generated a column chart that is composed of 15 groups of 3 columns (each group of 3 refers to one patient in 3 distinct times) and would like to identify each patient by placing a text aligned to each column of the medium (in each group...
asked by 03.12.2015 / 16:05
3
answers

Knowing the frequency of words

Hello, I would like to know if there is any function / command in R that I can find out what are the most frequent words in a text and how many times it appears. For example, I have a very large database, but it is a database where each row i...
asked by 20.02.2015 / 19:01
2
answers

Repeating the subtraction of groups in a data frame for all numeric variables

I have the following code: df <- data.frame(grp = rep(letters[1:3], each = 2), index = rep(1:2, times = 3), value = seq(10, 60, length.out = 6), value2 = seq(20, 70, length.o...
asked by 03.12.2018 / 15:55
1
answer

How to solve the limit 53 R randomForest categories?

In R, using the library randomForest , when I run randomForest() I get the following error message: Error in randomForest.default(m, y, ...) : Can not handle categorical predictors with more than 53 categories. The factor in...
asked by 05.11.2018 / 17:22
2
answers

data.frame with hierarchy for nested list in R

I have the following data.frame d : x <- data.frame(a=letters[1:3], b=letters[4:6], c=letters[7:9], stringsAsFactors=F) d <- tidyr::expand(x) d Source: local data frame [27 x 3] a b c 1 a d g 2 a d h 3 a d i 4 a e g...
asked by 22.01.2015 / 14:13