Most voted "r" questions
R is an open-source environment and programming language for statistical computing, bioinformatics, and graphics. It is advisable to supplement your question with a minimum reproducible example.
Learn more…2,359 questions
Sort by count of
-
2
votes1
answer389
viewsChanging the row name of a list in R using lapply from a list variable
I have a list called dataList and I would like the name of the lines to be equal to a variable called CNPJ that is within that list. For that, I first applied: dadosLista<-lapply(dadosLista,…
-
2
votes2
answers3195
viewsError importing data . csv to Rstudio
When I will import and create a file my data to the R it error... I tried the following way: melipona <- paste(system.file(package="dismo"), "/ex/Melipona.csv", sep=";")…
-
2
votes1
answer531
viewsPOST request with httr not complete (Fipe table site)
I’m trying to get the price data from the FIPE table automatically. Structurally, the information stays at this location: library(httr) library(rvest) url <- "http://veiculos.fipe.org.br/"…
-
2
votes0
answers598
viewsCalculate Weibull distribution parameters from a histogram of wind speeds using Rstudio
I can calculate the shape and scale parameters of the Weibull distribution, where I enter the wind speeds and using the fitdistr() function of the fitdistrplus package I get the shape and scale…
-
2
votes1
answer223
viewsIs there an R function that helps me locate the fashions of a multimodal dataset?
Something like Encontramoda(Dataset, N_maiores_modas)? I am working with the following integers: c(1,2,3,4,5,6,7,7,7,8,8,8,9,9,9,9) That is, the example is trimodal and has a bigger fashion than the…
-
2
votes2
answers69
viewsHow to create function where I need to pass the parameter inside a text block in R
I need the cnpj variable that is estre the tags <Parameter> be called as a function parameter. But note that it is within a text block that I use to consume a web service. It is possible…
-
2
votes2
answers1901
viewsIn R, How to calculate the average of a column based on criterion in another column?
I have two columns (A and B) I want to calculate the average of column A for the corresponding elements only for those that in column B are greater than 10 for example.
-
2
votes1
answer1011
viewsHow to remove caption in Plot?
How can I remove the caption that is automatically generated in the function plot package drc? plot(curva5r, ylab= "Dose (%)", xlab = "Dose (g.e.a. de glyphosate ha-1)") Note that the caption is on…
-
2
votes1
answer1063
viewsHow to add margins and text to the chart (Plot)?
I would like to know how to remove lines from the chart’s margins on the chart itself R (ex: image 1) and add the correlation value of the modelled curve with the coefficient of determination (R²).…
-
2
votes1
answer1312
viewsGraphic text position using ggplot2
I need to adjust the position of a text in the bar graph so that it is above the bar. Below the code used base.total %>% group_by(SEXO, REGIME.JURIDICO.FINAL)%>% count() %>% ggplot(.,…
-
2
votes1
answer78
viewshow to define the input array for RNA training in the rnn package?
In the package rnn there is an example of how to proceed to perform network training, which is described in this link (example 1). In the approach of this package the entries are given in the format…
-
2
votes1
answer602
viewsMultiple Linear Regression in R in different groups
I have a data set, with 4 columns: Product - Site Price 1 - Concurrent Site Price - Quantities Sold Where Product is a specific product (Refrigerator 1, Refrigerator 2, etc); Price Website 1 is the…
-
2
votes2
answers1047
viewsPresentation of disproportionate rmarkdown chart
Hello, I have the following problem: when I print the chart in Rmarkdown it gets the numbers one over the other, in addition to indicating the month/year in the coordinates also get the wrong view..…
-
2
votes3
answers94
viewsFind exponent of the data-fit equation, R
I would like to know how to adjust this equation/model below to my observed data (which are simple) so find the exponent p of this model y~x^(-p) My data is:…
rasked 7 years, 3 months ago david clarck 333 -
2
votes1
answer243
viewsLinetype and Shape in ggplot2 on R
I am using the following code to plot 3 functions: ggplot(data.frame(x = c(0, 2)), aes(x)) + stat_function(fun = exp, geom = "line")+ stat_function(fun = dnorm ,geom = "line")+ stat_function(fun =…
-
2
votes1
answer83
viewsExcel DISTF equivalent in R
I wonder if there is in the software R a function similar to the function of the software Excel, DISTF? The excel DISTF function returns the probability distribution F (right-tail) (diversity level)…
-
2
votes1
answer198
viewsselect data according to dates
Hello ! How do I select a line data.frame according to some dates ? ex: select the data from coluna 2 for the dates 2016/12/15, 2016/12/25, 2017/01/08, 2018/01/01.…
-
2
votes1
answer71
viewsMonitoring with the R
I have a monitoring script and would like to run it every five minutes, there is some function that does this? for example: função (meu_script, repetir= 5 minutos) tried some functions with…
-
2
votes1
answer763
viewsCreate a ROC curve in R
I need to plot a ROC curve in R, but I don’t know how to fix it. cctrl2 <- trainControl(method = "cv", number = 10, classProbs = TRUE, savePredictions = TRUE) modelNb <- train(Treino[, -5],…
rasked 7 years, 2 months ago PaulDaigle 31 -
2
votes1
answer44
viewsReverse transformation in R to var continues with max = Inf
I have the following var continuous: > summary(banco1$rac) Min. 1st Qu. Median Mean 3rd Qu. Max. NA's 0.000 5.077 6.694 17.380 8.728 4917.000 465 This var does not have normal distribution and so…
-
2
votes2
answers60
viewsChanging variable value
Good evening colleagues: I have a numeric variable: cv1[1:10] [1] 0 0 108919 4152 317 334403 0 35092 12762 NA I want to create the variable cv2, replacing the absolute values of zero (0) with "NA".…
rasked 6 years, 8 months ago Cássia C.P. Mendicino 21 -
2
votes1
answer58
viewsDegree of class grouping
I have several classes and each of these classes is composed of dozens of students, and each year these students change classes. So I would like to calculate the degree of grouping that a class…
-
2
votes0
answers83
viewsProblems loading the Swirl package
I was able to install the Swirl package, but when I give the library(Swirl) command, the following error appears: Error: package or namespace load failed for ‘swirl’ in loadNamespace(j <-…
rasked 7 years, 2 months ago T. Menezes 21 -
2
votes1
answer98
viewsAccess a data frame object, within a function in R - Census 2010
I would like to upload the 2010 Census files. First I am loading the households, through a function, using the command read_fwf, package readr. However, the data frames created, stay within the…
rasked 7 years, 2 months ago Thiago Marques 77 -
2
votes1
answer127
viewsHow to calculate monthly Cvar in R?
I downloaded the daily Ibovespa quotations from 01-01-2012 to 31-12-2017 in the R. I need to calculate the monthly Cvar of these quotations. I downloaded the Performaceanalytics package, but when I…
rasked 6 years, 7 months ago Ana Carolina Caetano 21 -
2
votes2
answers109
viewsHow to add a column
train <- read.csv("train.csv") train$color <- as.numeric(as.factor(train$color)) train.scale <- scale(train[,2:5]) train.scale$color <- train$color ERROR: In Train.Scale$color <-…
rasked 7 years, 2 months ago Pedro Teixeira 63 -
2
votes2
answers416
viewsSort column of a data frame in R
I have a data frame with 89000 lines and in one column appears the degree of kinship with the employee. I need to divide into 4 classes, namely: Class 1 - Spouse/Children Class 2 - Mother/Father…
rasked 7 years, 2 months ago Flavio Silva 1,108 -
2
votes1
answer148
viewsCompare rows from a column
I have a spreadsheet with about 15k lines, my problem is that in one of the most important columns for my analysis, the data are arranged in a very confusing way. The column is about the complaint…
-
2
votes1
answer170
viewsRselenium error - Selenium message:Java heap space
Hello, I’m trying to make a scraping of http://acervo.estadao.com.br/ using Rselenium, because the page only generates the information in html when it is loaded in the browser. Well, when it…
-
2
votes2
answers130
viewsCheck if there are different elements in a list in R
I have a list that each element is one data frame containing various information on a particular pension institution. In the column CLASSE there can only be one type and I need to know who owns more…
-
2
votes1
answer1088
viewsSelect the highest value of a column set of a df and take the column name of that highest value in R
Guys I have a table in the R in which I wanted to look for the highest value in a given set of columns and given this higher value, return in a new column the name of the column in which that higher…
-
2
votes1
answer181
views -
2
votes1
answer46
viewsHow to parallelize a sapply with table
I can perform the sapply smoothly, but I can’t parallel. In the original script I have more than 9,000,000 lines and so it is impossible to continue without parallelization.…
-
2
votes0
answers98
viewsScraping with R - xpathSApply returning a list of 0
I’m learning to read XML data in R. I wanted to extract the information of Brazilian football (championship name, game owner, result, etc.) from this site:…
-
2
votes1
answer885
viewsGroup columns in the R bar graph
I need to generate a bar graph with the following data: structure(c(38792L, 1227L, 23220L, 4177L, 893L, 331L), .Dim = 6L, .Dimnames = structure(list(c("Canvas para Android", "Canvas para iOS",…
-
2
votes1
answer1010
viewssystem is computationally singular: reciprocal number condition
I’m dealing with time series on R. My Data are Homocedastic, have no autocorrelation, no unitary root in lag=0, trend or seasonality. I still run into the problem of this particular error: VAR_S…
rasked 6 years, 6 months ago Felipe Silva 195 -
2
votes1
answer123
viewsIs there any R function that can convert dates?
Good afternoon, I’m new to the R language, and I need a little help. I wonder if there is a function that changes the timestamp date, it was to be time and date, only the database made available to…
rasked 6 years, 6 months ago Graziele Pires 21 -
2
votes1
answer577
viewsError in package installation
I started work using the R, and during the installation of some packages such as Devtools, appears the following message specifying the error: * installing *source* package 'devtools' ... ** package…
-
2
votes1
answer25
viewsproblems with Cycle for
I’m with a rather simple doubt, but I haven’t figured out the solution yet. I have this df: High Low Middle current 0.51 0.43 0.22 former 0.92 0.28 0.21 never 0.78 0.22 0.9 and I wanted the values…
-
2
votes1
answer167
viewsR - gtrends: ISO language code "en" or "en-BR" do not work?
. Guys, I’m using gtrends and would like to get the "related_topics" in English (preferably "en-BR"), but the "hl" argument of the gtrends function is not returning to English. Without the argument,…
-
2
votes1
answer81
viewsSunrise and sunset in R
I’m trying to create a script that shows the sunrise and sunset with the latitudes set, but the time is not compatible. OBS: this latitude corresponds to the time of São Paulo. library(maptools)…
-
2
votes1
answer301
viewsExample of Tidytext utility
Hj in a lecture from my university I saw a package q is called Tidytext...I understood how it works, so q can’t think of any use of it.Could anyone give me an example of how we would take advantage…
rasked 6 years, 6 months ago Gabriel Oliveira Guimarães 61 -
2
votes1
answer119
views -
2
votes1
answer400
viewsCreate boxplot graph of values in classes
I have these values in a dataframe: structure(list(NotaFinal = c(23.95, 25.4, 31.55, 25.4, 27.8, 27.3, 31.85, 20.45, 31.95, 28.55, 20, 24.95, 14.45, 22.55, 25.65, 10.35, 27.95, 21.45, 18.45, 21.1,…
rasked 7 years ago Fábio Junio Alves Sousa 283 -
2
votes1
answer1024
viewsHow to compare two columns of a spreadsheet, and keep the information that is equal?
Hello! I am working with a spreadsheet in Excel that has this structure: Coluna_A Coluna_B A A B B C C C_1 E D E F What I want is to find a way to assemble a third column, which has data present in…
-
2
votes1
answer943
viewsError in [.data.frame`(attr, , Region) : Undefined Columns Selected
I’m willing to use the fortify to plot a graph in R: PaísX <- fortify(BRmap, region = "ID_2") %>% mutate(id = as.integer(id)) %>% full_join(BRmap@data, by =c("id" = "ID_2")) %>%…
rasked 6 years, 5 months ago Jessiane de Holanda 33 -
2
votes1
answer283
viewsData preparation in R for cluster use
I have a database, where in the first column are some basketball teams and the following columns are some variables observed. I would like to make a cluster analysis using such packages:…
rasked 7 years ago brunorguima 33 -
2
votes2
answers233
viewsPlot time series on defined scale
I have a time series record, and I’m having trouble plotting on an appropriate scale. Take this example: #Gerar sinal v1 v1=sin(seq(from=0, to=3*2*pi, length=11060)) #Gerar sinal v2…
-
2
votes3
answers121
viewsHow to create groups of 3 words in a text of random size?
With the code: frase <- data.frame(id = c(1,2), texto = c("palavra1 palavra2 palavra3 palavra4 palavra5", "palavra6 palavra7 palavra8 palavra9 palavra10 palavra11 "), stringsAsFactors = FALSE) Is…
rasked 6 years, 12 months ago Mauro Ricardo da Silva 23 -
2
votes1
answer436
viewsIn R, how to transform Tibble into dataframe
I have a Tibble structure resulting from the following script, using the purrr package: data %>% group_by(REGIAO , V1023) %>% nest() %>% mutate( teste = map(data, ff)) Where ff is a…