Questions tagged as 'r'

2
answers

Presentations (slidify and Rpres) with Latin characters (ç, ã, é ...) corrupted

I'm preparing slides in R, but Latin characters (ç, ã, é etc ...) become corrupted when the presentation is compiled. I tried both with slidify and with Rpre, same problem. Does anyone know how to solve it? Editing: If it is within the same s...
asked by 17.09.2014 / 03:03
1
answer

Replace values of specific columns in an array (R)

In the array ( ret_matrix ) IBOV PETR4 VALE5 ITUB4 BBDC4 PETR3 [1,] -0.040630825 -0.027795652 -0.052643733 -0.053488685 -0.048455772 -0.061668282 [2,] -0.030463489 -0.031010237 0 -0.04022...
asked by 10.06.2014 / 22:07
1
answer

Subtract rows from one group in a data frame by another group

Assuming the following example: set.seed(1234) df=data.frame(grupo=rep(c("A1","A1.2","C","D"), 3), ano=c(rep(2007,4),rep(2008,4),rep(2009,4)), valor1=sample.int(100,12), valor2=sample(20,12), stringsAsFactors = F...
asked by 20.11.2018 / 19:38
1
answer

Extracting data from a data frame in R

I have a date frame in R and the table has row sets with the same attribute (name of an instance) and with different columns with data about each instance. INSTÂNCIA VALOR 1 VALOR 2 Instancia 1 10 20 Instância 1 34...
asked by 03.12.2018 / 16:00
1
answer

Recode function (dplyr) does not accept numeric ranges

Consider the vector: x<-runif(30,20,100) I would like to categorize this vector with the recode function of the package dplyr . The intervals can be arbitrary. For example: from 20 to 50 = 1 from 51 to 75 = 2 from...
asked by 08.12.2018 / 07:12
1
answer

How to transfer a table from the clipboard to a data.frame of R

Motivation In many language questions R I see people putting the contents of a table instead of showing the steps to reproduce the data they are analyzing. Requests to supply the result of the dput command are simply ignored....
asked by 29.03.2018 / 19:46
3
answers

Is it possible to pair values from two dataframes with different numbers of observations?

I have two data frames: Sexo <- rep(1:2 , length.out = 51) Estudo <- rep(1: 17, length.out = 51) Salário <- c(runif(51, min=900, max=3000)) data1 <- data.frame(Sexo, Estudo, Salário) data2 <- data.frame(TaxaHomens = c(seq(0.1...
asked by 16.03.2018 / 01:44
1
answer

Functions R - Strange Character

I created a function in R and detected a strange character appearing on the function return. Can you explain? Here is the function: funcao_categorica <- function(xx){ rr <- prop.table(table(xx))*100 return(rr) } When used, x...
asked by 19.12.2017 / 17:28
2
answers

Emit the discriminant function constant - linear discriminant analysis [R]

How to emit the constant of the discriminant function (or constants, if multiple discriminant analysis)? It follows the dput to aid in the response. structure(list(REAÇÃO = structure(c(0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1,...
asked by 16.08.2018 / 03:58
1
answer

Lapply to remove ADF test results in R

Here's my list: mylist=dput(mylist) list(list(c(30, 50, 35, 25, 45), c(40, 35, 35, 50, 45), c(40, 20, 40, 50, 25), c(35, 45, 45, 45, 40), c(20, 30, 50, 45, 20), c(40, 40, 50, 30, 40)), list(c(50, 50, 25, 40, 45, 40, 35, 40, 45, 20), c(4...
asked by 28.08.2018 / 00:00