Questions tagged as 'r'

1
answer

How to create a factor variable from other factors?

I would like to create a nominal variable X (factor) in my data.frame from two other already-existing nominal variables Renda and Escolaridade : Renda Escolaridade X baixa fund. incomp Sim inter super...
asked by 16.05.2017 / 13:00
1
answer

Error with interactive menu function when block code runs

I have a line of code that asks the user for a number like this: menu(c('1','2','3'), title='Escolha um número:') But that is part of a program that uses this number requested in functions later. When I run the line of code separately it...
asked by 16.05.2017 / 21:10
3
answers

Add string in R

I have the following base: cidade a b c AGRONOMICA CRESO NA NA AGRONOMICA NA SICOOB NA ALFREDO CREDIVERTENTES NA NA ALMIRANTE SICOPER NA NA AL...
asked by 08.01.2018 / 21:29
1
answer

Integrating columns of a Matrix using R (Error)

This is my matrix: funcao=structure(c(-14.7690673280818, -14.5543581356252, -12.1406211639974, -10.7200919648493, -9.55507848352318, -9.20790894914246, -8.74647670464071, -8.26548763467919, -7.3962484443768, -6.94590909664862, -6.63903257406...
asked by 02.11.2016 / 20:16
2
answers

use of ifelse with matrix

I need to find the gradient of a function, for this, I'm using the final line of the code below, where it reads: gr2 <- ifelse(y>0,df1bi+df2bi+df3bi+df4bi,dFTbi) , note that when compiling the first entry of this code ( df1bi+df2b...
asked by 15.11.2016 / 16:47
2
answers

R - match and replace string

I have this vector: n <- c("alberto queiroz souza (alberto, q-s.)", "alberto queiroz souza (alberto, queiroz souza)", "alberto queiroz souza (alberto, q. s.)", "alberto queiroz souza (alberto, q c)", "bernard...
asked by 16.08.2016 / 17:24
1
answer

Plot the mean in the R [closed]

How can I plot the average using R Studio and can display the same with my dataset also presented in dimensional space? The mean is represented by this line and the data represented by dots. The code you are using is just for averaging .. wanted...
asked by 23.11.2016 / 14:34
1
answer

How to replace values by NA using element encoding (and not position)?

I am having difficulty replacing values in a vector by NA, but using the treatment coding (not the position). A simple and hypothetical example of my problem is (my dataset is very large and I have several sets, so I can not do manual): filhos...
asked by 10.08.2016 / 16:32
1
answer

Step by step majority vote

I would like to know how I can calculate the majority vote step by step, for example, comparing column 1 with 2, per line , then 1,2 and 3, per line , then 1, 2, 3 and 4, per line , and so on. set.seed(1) a = matrix(sample(1:6, 30, replace...
asked by 12.09.2015 / 16:29
2
answers

Proc stands for basic SAS for R

Hello, I am a basic user of SAS and need to create a table in R, but I am well lost in R. The command given in SAS is DATA MEDIAS; SET TEMP; PROC MEANS N MEAN MIN MAX STD; VAR a1 a2 b1 b2 c1 c2 T R E; RUN; In sas it frees me this t...
asked by 02.02.2016 / 23:48