Questions tagged as 'r'

2
answers

calculate the difference between two dates in months in the R

How do I calculate the difference between two dates in months in R? Suppose both dates: x <- as.Date("2014-01-07") y <- as.Date("2015-03-17") I can easily calculate in seconds, minutes, hours, etc. using the difftime functio...
asked by 10.06.2015 / 22:23
4
answers

Remove duplicate names with regular expression

Suppose I have the following vector, with the names of presidents of the republic: presidentes <- c("da Fonseca, DeodoroDeodoro da Fonseca", "Peixoto, FlorianoFloriano Peixoto", "de Morais, PrudentePrudente de Morais", "Sales, CamposCampo...
asked by 30.08.2016 / 20:58
1
answer

Calculate difference between dates in Hours in R

I have two dates in date and time format. Data1 <- 20/01/2018 20:33:58 Data2 <- 21/01/2018 20:23:48 The difference in hours is 23:49:50 . How is the calculation of this difference in R? In addition, I need to know if this dif...
asked by 07.03.2018 / 15:49
1
answer

How to use contents of a vector to assemble the name of a file to be saved?

I have tried to use colnames() , names() and nothing works. My data is something like (however, I have 38,000 names and 38,000 columns): nomes <- c("nome105", "outro.nome_26", "qualquerCoisa") dados <- as.data.frame(matri...
asked by 10.05.2016 / 21:19
2
answers

Create columns in R from another where some values are null

I'm wanting to create a column from another in the R where some of the rows have no value. The column should be constructed as follows: if the row of the base column has value, it will fetch that same value, otherwise it should fetch the informa...
asked by 14.08.2014 / 21:10
2
answers

Somatoria accumulating columns in a matrix in R

I have the following situation: In a numeric matrix type: Temp <- matrix(runif(25, 10, 100),nrow=5,ncol=5) V1 V2 V3 V4 V5 11 34 45 54 55 16 21 45 75 61 88 49 85 21 22 12 13 12 11...
asked by 25.04.2016 / 23:10
1
answer

Edit bar graph in R: Order of X-axis values - Legend - Bar color - Insert lines - Enter comments

1 - Contextualization I want to build a bar chart using ggplot2 , but I'm having trouble gathering the information and editing the chart. I have data of the oscillation of the phenomenon El niño ( ONI ) classified in intervals. With t...
asked by 04.07.2016 / 06:14
1
answer

Export Google Sheets data to the R

Everyone, okay? I'm new to R and I have a question: Is it possible, and if possible, what is the way to export data from a google sheets table (or Drive) to R. Is there any library for this?     
asked by 02.10.2018 / 19:54
1
answer

How to put the regression equation on a graph?

In another question , and how to put the regression line on a graph. But how to put the regression equation on the graph? For example: Or     
asked by 22.02.2014 / 14:55
2
answers

Look up values in one data.frame and add in another (R)

I have 2 data.frames, the first is a data.frame that contains stock data and a column with a unique identifier (column "ISIN") , as shown below: > Teste=data.frame(matrix(runif(20), nrow=5, ncol=4)) Teste$ISIN <- c("A1","A2","A3","A4","A5"...
asked by 19.04.2016 / 21:30