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
-
0
votes1
answer103
viewsError in class(x) <- setdiff(class(x), "pseries") :
I’m running multiple linear regressions on R. Initially I circled with the "pooled" effect and it worked fine. When I try to do the same with the effect "Within" and "Random" shows the following…
-
0
votes1
answer129
viewsError in notamf(mf) : p object not found
The code below is for my first college program. What do I call the given of one function within another??? I need these 3 functions for the delivery of the program, but error appears ""Error in…
-
0
votes1
answer67
viewsHow to organize dates in ggplot2
I have a chart made with ggplot2, but when it comes to exporting it, the dates on the X-axis are totally unreadable, as in this example: How can I fix them? Code I’m using:…
-
0
votes1
answer152
viewsProblem with key in ggplot, using double axis y + geom_line()+geom_point() x geom_bar()
Hello, I have another problem regarding the presentation of legend, in this case, using axis y double (ggplot::scale_y_continuous::sec_axis), and geom_line()+geom_point() x geom_bar(), as shown in…
-
0
votes1
answer41
viewsWhy when creating a zoo series object the columns change from Numeric or integer to Character?
Good evening!!! I am confused enough. I will explain the pass-by-step until I get to the doubts that I finally could not solve: My goal is to create a file where tickers quotes are stored where each…
-
0
votes1
answer56
viewsGraph with ggplot2 using wrong data
I have a bar and line chart made with ggplot2, the red line is a moving average of 7 days, but when plotted on the chart, it shows a drop at the end of each that does not match the values. Graph:…
-
0
votes1
answer593
viewsHow to edit the variables name in a ggplot without having to change the table data?
I plotted my chart but would like to change the name of my variables of the x and y axis (not the name of the axis) for better visualization of the information without having to change everything in…
rasked 4 years, 5 months ago Francielle Oliveira 71 -
0
votes0
answers49
viewsData manipulation with R
Hi, I have a school data frame and I need to calculate the evasion number. The program would be more or less that, only this way it takes a long time to finish executing. Does anyone know how I can…
rasked 4 years, 5 months ago Renato Lopo 63 -
0
votes1
answer53
viewsWrong return when grouping rows from a data frame
I am working with a dataframe and I aim to group the lines that have the same content in the first column (Course, which are factors). Therefore the following commands: library(dplyr) data.test2…
-
0
votes1
answer62
viewsCount occurrence of events traversing columns of a dataframe through a for loop in R
Hello, I am using the table() function of R to count the repeated notes in each semester column (sem1, sem2,sem3...) of my file. It’s working properly, but I’d like to do it through a loop for and…
-
0
votes0
answers68
viewsA I am trying to fill a table through a loop loop, but it is taking too long. How can I improve loop performance?
the columns and table values will be filled in as the cycle runs. Briefly, I have a table with customer data (BD) and another table with expected future values by age (ESP). And what the cycle does…
-
0
votes1
answer31
viewsHow to group identifiers that are related across rows and columns in R
Hello. I’m working with base linkage and have now 2 columns of paired Ids (id_a and id_b). Each pair represents the same individual located on different bases: id_a <-…
-
0
votes2
answers172
viewsHow to remove NA from a dataframe in R?
I have a DF that has some NA, as I will use it to assemble a table, I needed to exchange the NA by " ", to only show the empty space in the table. I am using a mutate_if to leave the numbers to only…
-
0
votes2
answers99
viewsRemove NA from a csv in R
Good morning, folks! I’m trying to pull out NA but the code is returning null. Follow my code below: Note: In case I need to leave only the columns Population and Area (sq. mi.). rm(list=ls())…
-
0
votes1
answer39
viewsStoring data from a for in a dataframe
I have airport codes and needed to store the data access link of these airports in a DF, I tried to do through a for, but is returning error. Code I used: aeroportos <- c("bsb", "cgh", "gru",…
-
0
votes1
answer116
viewsHow to use summarise?
I have a DF with energy data and would like to group the data by activity (because they are divided by state and I want to do the aggregate for Brazil) and add these data for each date. I was trying…
-
0
votes0
answers52
viewsNonlinear regression with dummie variables
I am creating several models, to then make the selection based on Aicc. Among these models that I am creating, I have a categorical predictive variable (fire) that I need to include in the nonlinear…
-
0
votes1
answer40
viewsHow to identify if one observation is in the same group as another?
I have a date.frame with the columns: cnpj_root, id_m_f, municipio and Uf I need to check the amount of cnpj_root that exists in each municipality and check if the matrix (1) is in the same…
-
0
votes0
answers571
viewsI can’t install any package on Rstudio!
When I open the option Packages, in the console appears that phrase: Aviso: unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/3.1* Even trying to install by clicking…
-
0
votes2
answers428
viewsHow to return only repeated values in R?
suppose the following dataframe: ref<-data.frame(autores=c("AZEVEDO, L. S.; NASCIMENTO, E. F.; CANDEIAS, A. L. B.", "BERGER, R.; SILVA, J. A. A.; FERREIRA, R. L. C.; CANDEIAS, A. L. B.; RUBILAR,…
-
0
votes0
answers201
viewsInner Join - Allocate vector to R
I am trying to make an inner_join between two tables by a common "state code" column. However, it is giving an error of "allocate vector of size 1.4 Gb". Code: arquivo_antigo_filtrado<-…
-
0
votes1
answer200
viewsWrite.csv and write.xlsx problems
I use windows 64 bits, I have java installed and set the working directory in R. But, when running a simple code such as: teste <- data.frame(a=c(2,2),b=c(3,3)) write.csv2(teste,file =…
-
0
votes1
answer305
viewsAutomate script execution R
There is a script in the R link that works perfectly in Rstudio. To automate it, it runs every Tuesday at 15:00, I decided to create a file. bat and schedule its execution by the task scheduler,…
-
0
votes1
answer91
viewstransform named list to dataframe
I’d like to turn a nominated list into a data.frame (or Tibble) where the name of the object in the list becomes an observation in the data.frame The example list I have is this: mylist <-…
-
0
votes1
answer349
viewsAverage and median boxplot legend in ggplot2 function
I am trying to add a caption identifying that the "ball" is the mean and the "line" is the median of the boxplot chart as follows: mediasCon1 = tapply(dados$FS, dados$Trat, mean) boxplot(dados$FS ~…
-
0
votes0
answers43
viewsPull a list with multiple search names with Rselenium
Good evening, I’m trying to pull data from google scholar with Rselenium but I’m having a hard time getting the information from the magazines I’m looking for. Playing the code below: #Primeiro…
-
0
votes1
answer63
viewsGraphics in ggplot2, I want to add a loop to create graphics
I have a question in ggplot, I want to compare two tables and create graphs for each Gene in R: Table 1 Table 2 below I used as reference in the index for the loop: "gene_data" is variable for Table…
-
0
votes0
answers41
viewsHow do I make the legend of each curve appear in the graphic print area?
grafico <- read.csv("Pasta1.csv", header = F, sep = ";") library(ggplot2) Experimental <- ggplot(grafico)+ geom_line(size=1.2, aes(x=V1, y=V2))+ scale_fill_manual(values = c("Experimental" =…
-
0
votes1
answer94
viewsHow to make boxplots monthly, quarterly, biannual, annual and every 10 years for a period of 30 years?
I need to create several boxplots with different data intervals. I have a data-frame composed of precipitations of the city of Alagoas and need to compare with other data-frame with precipitation…
-
0
votes1
answer62
viewsMake a graph in R (ggplot) similar to Excel bar charts
How can I make a chart in R (ggplot) similar to this excel chart? I have a table in form csv with this data. I got up to the R this table, but now I don’t know how to make this graph using the R.…
-
0
votes2
answers38
viewshow to identify and delete columns with characters and factor in R
I have a data.frame with several columns with different data, integers, numbers, character and factor. I need to perform a correlation matrix with this data, but R can only perform the correlation…
rasked 3 years, 10 months ago wesleysc352 113 -
0
votes1
answer39
viewshow to delete a column of the "list" class in R
I have a data.frame in which I need to perform a correlation matrix. I’ve already sorted the numerical data by the command select_if(is.numeric) as suggested by the colleague at link. However, in my…
rasked 3 years, 10 months ago wesleysc352 113 -
0
votes1
answer54
viewsPlot of the CL50 Curve in R using ggplot2 with estimates obtained in Stan
I am trying to make the following graph below in ggplot2. Note that I am adjusting a logistic regression model under the Bayesian approach using the Stan package. dice:…
-
0
votes0
answers30
viewsProblems with battery overflow using ifelse function
Hello, all right? I’m having trouble generating a function based on ifelse(), because there is a battery burst above 49 conditions. I tend to calculate averages every 5 me. for this I need to use…
rasked 3 years, 10 months ago Jean Karlos 646 -
0
votes0
answers20
viewsUnable to use Graphviz in R
I elaborated an analysis of structural equations with the semPLS package, according to the following code. fit.inicial <- plsm(data = data, strucmod = sm, measuremod = mm) fit.semPLS<-…
-
0
votes1
answer22
viewsHow to turn part of a column into another with data.table?
I have a data.table with a column that has the code of the municipalities (6 first characters) and the name of the municipalities (other characters). I would like to separate them, using data.table.…
-
0
votes1
answer82
viewsWith inserting texts into a scatter chart (with ggplot)?
Hello, I have a scatter chart in which I combined 6 variables in the same graphic, now I’m trying to identify each variable in the graph with geom_text, but I can put the text referring to only one…
-
0
votes0
answers33
viewsMap rendering problem using Leaflet and Flexdashboard packages
Expensive, I’m not able to render a small map in a Dashboard I’m building using Flexdashboard. I am receiving the following message: Error: Method not applicable for 'Maxtar' applied to a class…
-
0
votes1
answer84
viewsAdjusted line of the binomial regression model made in ggplot2
I am trying to adjust the line of the binomial model in the graph of observations, however, one observes a problem in the code. The data is below:…
-
0
votes0
answers34
viewsEditing y axes in ggplot2
How do I edit the y axes according to the value scale of each column? The y-axis on the right is with a range of values well above, and the bars do not appear: Reproductive example…
-
0
votes1
answer48
viewsTransformation of a dataframe column into date returns NA
I’ve encountered very similar problems, but none of them got where I am. I’m trying to read a CSV file and turn it into Time Series.…
rasked 3 years, 8 months ago Alexandre Nahuz 17 -
0
votes1
answer69
viewsPlot half-normal chart for mixed models adjusted with nlme package
I’m trying to realize the Plot half-normal chart for a mixed effects model adjusted through function lme package nlme. Dice:…
-
0
votes1
answer129
viewsR - Accumulated inflation
Hello, I would like a help in the following mission, based on the IPCA-monthly table (historical series), add a field with annual accumulated inflation, where the process resumes each year. For the…
-
0
votes1
answer52
viewsHow to change the layout of a Plot radar to Circumplex (Polar Bar) Charts on R
I’m trying to change the layout of a radar Plot. I can’t get the chart to look like below. All attempts generated blank graphics. The code I’m trying to modify: # Libraries library(fmsb) # Create…
rasked 3 years, 8 months ago Clarice Cabral 31 -
0
votes1
answer41
viewsHow to position geom_text above geom_errorbar?
I would like help to position the label of geom_text (which in case would be a test of averages) exactly above each error bar, as I did the error bars by treatment, they were of different sizes, so…
-
0
votes1
answer60
viewsHow to change the legend, leaving it with the same strokes that are represented in the graph?
I generated a graph that has three types of line; dotted, dashed and continuous. The problem is that subtitles are displayed as if all lines were equal. How can I fix this? ggplot(dados,aes(x =…
-
0
votes1
answer43
viewsContinuous time data in R
I’ve put together a dataset of covid-19 cases per monthly death, but I can’t plot the results. Does anyone know a more elegant or correct way to do this? I processed the database, and at the end…
-
0
votes1
answer34
viewsFor loop in R is repeating answers more times than desired
I need help for this loop that is returning more answers than desired. I made a table from the public dataset palmerpenguins and my goal is to get an estimate of the penguins' gender with missing…
-
0
votes1
answer35
viewsProblems adjusting a mixed effects model using the gamlss package
I’m trying to adjust a mixed effects model considering the package gamlss. The data is here: https://drive.google.com/file/d/1q4XuSPnZXx7TsrT3JVoucFyxeOSegWFz/view?usp=sharing The model I’m…
-
0
votes1
answer32
viewsHow to change the position of bars/columns and how to place caption
ggplot(data = dados, aes(x = Meses,y = T.max, width = 777600))+ geom_bar(aes(y = T.max), fill="red", stat = "identity",position = "dodge" ) + geom_bar(aes(y = T.med), fill="blue", stat =…