Questions tagged as 'r'

2
answers

Generate a date after a specific date

I have a column of a table with dates, I need to create another column with random dates and after that date. I used the seq.Date function for this but I get the following error. date_arq<-seq.Date(as.Date(base$DATE_END, "%Y-%m-%d")) Error...
asked by 06.06.2018 / 20:00
2
answers

How to select data in R?

I have a database with 1441 rows. I need to group them into groups of 30, and draw averages from each of those subgroups. Is there any command that will allow me to do all this automatically? "every 30 rows, create a new column and calculate the...
asked by 18.09.2017 / 04:51
1
answer

Join multiple in R

I have two tables: dados and dados_aux . I need to add to the table dados the REGIÃO column, present in the dados_aux table. However, I have to use two keys to join: CIDADE and UF . Otherwise, the i...
asked by 31.01.2018 / 14:58
2
answers

How to correlate qualitative and quantitative variables in R?

I have a data frame in which I have qualitative variables, such as sex and origin, and quantitative variables such as cholesterol, weight and height. It is possible to correlate these variables using the cor() function, when using it I ge...
asked by 24.03.2016 / 19:28
2
answers

Transform duplicate values to 0 by keeping an element in R with conditionals

Suppose there is a database where: x y z a 2015 122.4 a 2015 122.4 b 2016 200.5 a 2014 300.6 c 2016 80.1 What I was wondering is to do a programming in the R that transforms the repeated values of z of each group x and y in...
asked by 11.09.2017 / 19:23
2
answers

How to create a vector with repeating dates?

I need to create a vector with sequential dates between 01/01/2013 and 05/31/2018, but with repetitions, as shown below, associated with time. 01/01/2013 0:00 01/01/2013 1:00 01/01/2013 4:00 01/01/2013 8:00 01/01/2013 12:00 01/01/2013...
asked by 09.05.2018 / 15:21
2
answers

Installation lodown

I'm trying to install the lodown package, but the following error appears and I can not solve: ERROR: loading failed * removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/archive’ Installation failed: Command fai...
asked by 18.10.2017 / 00:29
2
answers

Generate repeated values in R

In the frame date below, I want the days that have no gain information to be repeated based on the last information collected. For example from day 2 to day 15 the gain will be 0.97 and day 79 to 86 of 0.45 How can I do this in R? Dia G...
asked by 08.11.2017 / 11:15
2
answers

Code for displaying BoxPlot in ggplot2

In the boxplot view created with the script below, I do not think the g2, g3 and g4 graphics are the same ones that appear in the g1 image, but I could not find anything wrong with the code! Notice that the median or maximum...
asked by 02.03.2017 / 18:31
2
answers

Error in the result of the optimum function of r

I am simulating values of the Birnbaum-Saunders distribution with alpha and beta parameters and then try to estimate these values using the optimum function, although the simulation converges, I am getting the error below, how to correct this er...
asked by 20.05.2016 / 03:27