Questions tagged as 'r'

1
answer

Customize the x-axis values (abscissa) in the geom_smooth or geom_ribbon functions of the ggplot2 package

Although I already have a similar question to the solution presented there scale_x_continuous did not answer my problem. Normally for this I would use the function factor in ggplot(data,aes(x=factor(TEMPO),y=media) howeve...
asked by 16.12.2018 / 13:48
2
answers

Substitution in a text by words from another file

That should be easy, but I can not find a solution! It is as follows: File1 - with texts: Doc Texto doc1 Isto é um teste para substituições de palavras. doc2 As casas são parecidas. File2 - Reference: Termo Termo_pai é...
asked by 29.07.2018 / 17:12
2
answers

How to replace a space with a semicolon between two words with gsub ()

I have a problem to solve and I can not write the correct regex. I want to add a semicolon between two emails: ex <- "[email protected] [email protected]" #resultado esperado: [1] "[email protected];[email protected]" Thanks for the help!   ...
asked by 26.07.2018 / 22:00
1
answer

How do you return multiple objects in a function of r?

The basic structure of a function in R is: function( arglist ) expr return(value) My question is how to return multiple information. For example: funcao<-function(a,b,c){ if(c==1){d<-a+b} else{d<-a-b} return(d) } I want to k...
asked by 30.10.2018 / 19:40
1
answer

I can not keep the format of a date received from a dataframe

I have a dataframe with a date column and another time column: AndIwanttoconcatenatethedatewiththetimetobeinthestringformat"2016-12-25T08:38:00" Initially I was trying this way: datainicial=vpnsessions2[1,3] View(datainicial) horain...
asked by 11.05.2018 / 12:55
3
answers

How to create a Standard Deviation Mobile Window (R)

The matrix below the stock return ( ret_matrix ) for a given period. IBOV PETR4 VALE5 ITUB4 BBDC4 PETR3 [1,] -0.040630825 -0.027795652 -0.052643733 -0.053488685 -0.048455772 -0.061668282 [2,] -0.030...
asked by 04.06.2014 / 23:49
1
answer

How to parallelize a sapply with table

I can perform sapply without problems, but I can not parallelize. In the original script I have more than 9,000,000 lines and so it is unfeasible to continue without parallelization. dfteste<-data.frame(c(1,1,1),c(1,1,1),c(1,1,1)) apteste&l...
asked by 25.04.2018 / 16:43
1
answer

Negative age in R

I have a database that needs to calculate the age of the members in it, below a sample extracted with dput . base.teste <- c("04/03/73", "10/09/67", "21/12/74", "17/04/76", "25/03/66", "11/03/73", "06/08/79") I need to calculate t...
asked by 18.01.2018 / 17:38
1
answer

Similarity of Texts

Good evening guys, I would like a help from you, as I'm starting in R, and I have a demand, where I have to signal the lines where you have the similar phrases. For this, I am using the stringdist library. However, I can only make the comparison...
asked by 18.01.2018 / 02:57
1
answer

Represent the x-axis of the histogram as the classes of the frequency distribution?

I'm having trouble getting a histogram of this frequency distribution.    Class limits f rf rf (%) cf cf (%)       [22.691,25.57] 17 0.01 1.29 17 1.29       [25.57,28.45] 25 0.02 1.90 42 3.19       [28.45.31.33] 64 0.05 4.86 106 8.05     ...
asked by 10.01.2018 / 14:09