Questions tagged as 'r'

1
answer

How to plot the estimated logistic regression model

Suppose I have the data below, apply a logistic regression on them and want to see the estimated function that returns the probability. #Simula os dados nobs<-100 beta0=-10 beta1=0.006 saldo=runif(nobs,1300,2300) p_x <- exp(beta0 + beta1...
asked by 19.02.2014 / 13:29
3
answers

How to select all data.frame variables at once for a regression?

Suppose the following data.frame : set.seed(1) dados <- data.frame(y=rnorm(100), x1=rnorm(100), x2=rnorm(100), x3=rnorm(100), x4=rnorm(100)) If I want to run a regression of y against x1 ... xn , I can do it as fol...
asked by 19.02.2014 / 14:37
3
answers

How to know the amount of NA in each variable?

Suppose I'm working with the following database: df=data.frame(v=c(1,2,NA,4,NA,6,7,8,9,10),v2=c(11,NA,NA,14,NA,16,NA,NA,19,NA), v3=c(21,22,23,24,25,26,27,28,29,30), v4=c("a","b","c", NA, NA,NA,"g","h", NA,NA)) I need to...
asked by 27.02.2014 / 11:14
1
answer

How to put legend in distributions graphs in ggplot

I have the following graph of the exponential distribution, I want to put a caption showing the parameter of my exponential. ggplot(data.frame(x=c(0,5)),aes(x))+ stat_function(fun=dexp,colour='red',size=1.4)+ stat_function(fun=dexp,args=li...
asked by 23.11.2014 / 01:29
1
answer

Problem creating a data.frame

I want to export multiple results to excel and for that I need to first leave them in the ideal format, however I am facing problems because I want them to be stacked in a single column. This is an example to show what I want done. x=c(1,2,3)...
asked by 07.11.2018 / 16:57
1
answer

What function in R to reorder a data.frame that contains missing data (NA)?

I have the following data.frame : Linha Data Total Med.2 DP.2 Med.3 DP.3 Med.4 DP.4 1 2009 1.4749 NA NA NA NA NA NA 2 2010 2.9945 2.2347 1.0746 NA NA N...
asked by 01.11.2015 / 04:44
1
answer

In R, a function that reads only a few columns of a dataframe in Rda format

I have 27 txt files. Each file represents a state of Brazil. In fact, every file is dataframe about job market. The 27 files can add up to 20 gigs. The first thing I did to reduce this was to save each file in Rda format. With this, for example,...
asked by 16.11.2017 / 15:33
1
answer

Doubt how to measure the number of words between two specific words in a string in R

Hello, People! I'm working on a function in R that measures the amount of words between two specific words, I'm calling the function worDistance , it works as follows, you insert two arguments, given a string t, for example, palavra...
asked by 01.11.2018 / 13:34
1
answer

how to increase the ifelse limit in R?

I need to calculate the years of study from the PNAD questionnaire. I made a programming similar to this below, but I have many ifelse within the other (121 to be exact), because I have a larger chain of questions, but R does not calculate be...
asked by 05.12.2016 / 00:55
1
answer

Value comparison within date frame

Hello, I have a database, with about 50000 observation, as follows, just figurative values: nome<-c("joão","pedro", "joãoo") identificador<-c(123456,124578,123456) valor<-c(2145,350,23) dados=data.frame(nome,identificador,valor) I...
asked by 14.03.2017 / 20:38