Questions tagged as 'r'

1
answer

BayesQR package Error message

I'm trying to replicate the following example of this "bayesQR" package: bayesQR set.seed(66) n <- 200 X <- runif(n=n,min=0,max=10) X <- X y <- 1 + 2*X + rnorm(n=n, mean=0, sd=.6*X) # Estimate series of quantile regressions with...
asked by 27.10.2015 / 14:59
1
answer

How to change the class of a variable inside a table / data frame / tibble?

I have a table called tab01 with the following variables (columns) and their respective classes in parentheses: uf (character), regiao (character), ano (double) and pop (double ). I want, inside the table:...
asked by 27.06.2017 / 21:03
3
answers

Calculate average distance traveled with single tapply

I have my database from the hflights package of R, which shows a number of flights in the US. I need to calculate the average distance traveled ( Distance ) for each day of the week (variable DayofWeek ) between flights with a delay...
asked by 28.11.2014 / 04:49
1
answer

How to ignore an error in R?

I created a function inside, however, if at some point an error occurs, it's not important to me and I want it to go through to the end, ignoring the error. valor<-1 Erro<-function(valor){ valor<-valor+1 print(valor) valor<-v...
asked by 27.10.2018 / 18:25
2
answers

How to load all the functions of a folder?

Suppose in the "D:" folder there are several functions that I use in a project. How do I load all these functions with a script?     
asked by 17.02.2014 / 21:14
1
answer

How to insert caption in ggplot maps?

How do I enter the caption and change the map scale to degrees? library("rgeos") library("maptools") library("ggplot2") library("mapproj") cores1 = c('brown2', 'aquamarine2', 'darkgray','darkolivegreen1', 'floralwhite') ggplot() + geom_polyg...
asked by 27.06.2018 / 01:28
1
answer

Use of the summarySE function to construct a graph in ggplot2

Hello, I'm looking for help to improve a script in R. I've developed it with the help of the ggplot2 package. I have some mistakes and I would like opinions. In the study, I evaluated the effect of intra and interspecific interaction between two...
asked by 09.07.2018 / 07:18
1
answer

How to create a list of constrained values against a stipulated data number

I have the following code n <- 130 pl <- trunc(n/20) p0 <- 20 pp <- 20 + (0:(pl-1))*p0 With the result of pp , being: [1] 20 40 60 80 100 120 . Also, I use the same process to create a pe , according to...
asked by 21.09.2018 / 21:41
1
answer

Preserve 'rownames' after use of family functions apply

I use the apply functions, and I need to have rownames left in the database after executing them. Consider: dataframe=structure(list(Composição100g = structure(c("Valor energético (KJ)", "Proteína", "Glicídios", "Açúcar", "Amido...
asked by 15.09.2018 / 19:57
1
answer

How to change American format dates and / m / d to d / m / y in a dataframe in R?

I have a dataframe where dates are in American format and I would like to know how I can turn this column into the Brazilian day-month-year format. I have tried the lubridate package and the dmy function, but for some reason it...
asked by 27.08.2018 / 20:27