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
votes2
answers220
viewsInteraction graph using ggplot2
all right? I am trying to make a graph of interaction between the subjects (Variable S) being these subjects colored in 5 colors (which are the groups (variable G), but is giving the following…
-
0
votes0
answers20
viewsIdentify language using Franc package
I can’t write the code for that package franc identify the language of the worksheet data. This is the package repository: https://github.com/MangoTheCat/franc The following code does not give me…
rasked 3 years, 7 months ago Leonardo Marçal 1 -
0
votes0
answers46
viewsReplace data in text
I am working with a text taken from the Gutemberg project. It is a book. I need to mark the beginning of each chapter on a regular basis. In the current format, they are identified only with…
rasked 5 years, 6 months ago user135517 -
0
votes1
answer39
viewsImport data with spaces within fields from a txt to R
Good afternoon I would like to import a file, and I will post an example to be helped It consists of names with space and number separations To help me with the solution, please copy this…
-
0
votes1
answer29
viewsSort values without repeating them, in R
I created a new column in a Tibble, to use as a second column identifier. However, there are repeated values, and I would like these repeated values to have the same identifier. prec_med_novo <-…
rasked 3 years, 6 months ago Leonardo Gonçalves da Fonseca 13 -
0
votes1
answer276
viewsHow to save an Excel spreadsheet from R without blank lines?
I’m working with a large database and it has a few lines with blank Ids. And I want to save only lines without blank ID in an Excel file. Whereas the Ids are in the first column of my matrix, here’s…
-
0
votes1
answer73
viewsIs there a package that does stepwise and multicollinearity analysis simultaneously?
I’m developing a model and I wonder if anyone knows any packages that do stepwise and already measure the correlation between dependent variables, seeking the best model without high collinearity.…
rasked 5 years, 5 months ago Paulo Pasquale 13 -
0
votes2
answers40
viewsI want to group 3 columns into one, separated by a comma in the R
My dataset is like this: x y z A 1.1 1.2 1.3 B 2.1 2.2 2.3 Using R, I want to group the 3 columns into one, separated by a comma. I want you to stay like this: x A 1.1, 1.2, 1.3 B 2.1, 2.2, 2.3 Dice…
-
0
votes2
answers39
viewsCreate a table in R from a date frame grouping the values per month
I have a dataframe df with two columns: Number and Date. df = data.frame(numero = c("10", "20", "30", "40", "50"), data = c("2021-10-01", "2021-10-02", "2021-09-01", "2021-09-01", "2021-08-01")) I…
rasked 3 years, 5 months ago Alain dos Santos 11 -
0
votes1
answer34
viewsHow to separate data that is in the same column in Rstudio?
Good evening, I have a table that I imported from excel to Rstudio and I want to work with the "Date" column. I need to separate the date from the hours and so far have not succeeded through the…
-
0
votes3
answers82
viewsMerge two dataframes of the same name keeping all columns
I have two data frames with the same name in the columns, example: df1 <- read.table(text = "Nom1 Nom2 15.1 20.3 45.5 40.1 32.1 50.2", header = T) df2 <- read.table(text = "Nom1 Nom2 10.1 90.3…
-
0
votes1
answer30
viewsHow to compare values of the same variable and generate another variable that has the result of this comparison in R
I have to reproduce this formula I made in Excel =SE(C2=C1;1+D1;1) to R, but I don’t know how. I have a basis where one of the variables is the position of employees, and I need to create a variable…
rasked 3 years, 4 months ago Tamires Oliveira 3 -
0
votes1
answer72
viewsCreate filter to select data without duplicity, from rules applied to variables
I have constantly uploaded a data frame with more than 6 million records and 40 variables (columns). From these records, I need to select only one record per patient and that this record is as…
rasked 5 years, 5 months ago Ronaldo Jesus 1 -
0
votes1
answer31
viewsloop to replicate a dataframe in R
I have the following dataframe: df <- data.frame(x1 = 1:7,x2 = 8:14, x3 = 15:21, x4 = 23:29, x5 = 30:36) I need to replicate the value of each row 150, 100, 60, 43 times and for each column. I…
-
0
votes1
answer25
viewsHow to resolve an Error in Plot.new() : figure margins Too large, in R
Hello I’m trying to do this command: tsdiag(m1,gof.lag=20) Which was to hold 3 forks this way: but the following error appears: Error in Plot.new() figure margins Too large How could I solve?…
-
0
votes2
answers60
viewsR Regression by condition using apply or for
I have the following sample: x <- structure(list(POP = structure(c(1L, 12L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 13L, 14L), .Label = c("pop1", "pop10",…
-
0
votes1
answer70
viewsError installing "summarytools" package in R
I tried to download the summarytools package and report this error: library("summarytools") Error: package or namespace load failed for ?summarytools': .onload failed loadNamespace() for 'Magick',…
rasked 3 years, 3 months ago user252953 1 -
0
votes2
answers76
viewsDetect outliers in grouped data
I am working with dashboard data and needed to identify potential outliers in each group, example: df <- data.frame( ID_group = c("1","1","2","1","3","2","2","3"), Case =…
rasked 3 years, 3 months ago user250908 77 -
0
votes2
answers299
viewsR how to extract the first value from a date list.
I have this list of data:: base_list <- list(structure(list(POP_84 = 17.7, POP_92 = 18.8, POP_99 = 19.7, POP_02 = 20.5, POP_04 = 21.2, POP_09 = 23, POP_11 = 24.5), row.names = 149L, class =…
-
0
votes0
answers14
viewsHow to take advantage of objects created in a Rmarkdown file in another Rmarkdow file
I’m working on a report in Rmarkdown and I need to do another report which is actually a summary of the first. As it is a synthesis of the first, I need to rescue some objects from the original…
-
0
votes0
answers19
viewsIdentification of extreme values in reduced samples
I am running an analysis where I need to find a reference value for small groups of observations (between 3 and 10). As some samples present at least a very discrepant value I will try to identify…
rasked 3 years, 2 months ago user250908 77 -
0
votes1
answer47
viewsBEKK Multivariate Garch Error in R
I’m trying to run the package mgarchBEKK the following data: > head(Log_retorno) DLog_B3a DLog_JCa DLog_Basea DLog_CBOTa [1,] 0.090393077 0.08588355 0.129032018 0.09774478 [2,] 0.017924523…
rasked 5 years, 5 months ago Everton Toledo 113 -
0
votes0
answers30
viewsReduce Sample
I want to train a neural network. RNA should have inputs of equal size in the input layer. I have plot data, but each with different sizes of information. I wonder if you have a way to reduce the…
rasked 5 years, 5 months ago Gustavo Mourao 19 -
0
votes1
answer33
viewsProblems to transform variable data timeSeries in R
I have the following data and would like to create 4 dataframe: > head(Log_retorno) TS.1.1 TS.1.2 TS.1.3 TS.1.4 2008-01-11 0.090393077 0.08588355 0.129032018 0.09774478 2008-01-18 0.017924523…
rasked 5 years, 5 months ago Everton Toledo 113 -
0
votes1
answer101
viewsDeseasonalize PIM data with R
I’ll start by saying that I’m almost illiterate in programming so have a little patience. I am trying to deseasolize the historical series of PIM by r according to the IBGE instructions, for this I…
-
0
votes1
answer78
viewsError fitdist "should not have NA or Nan values"
I have been trying to adjust the distributions and lognormal in the data and have been facing the following error: --should not have NA or Nan values--. Dice:…
-
0
votes2
answers144
viewsError when manually adjusting the axis with ggplot2
Hello, everybody! I am working with IPEA IVS data, which can be accessed here. So far, I have two problems: I can’t read the axis and I can’t color by the pattern I want. About the first problem, it…
rasked 5 years, 3 months ago Matheus Pasche 5 -
0
votes3
answers119
viewsProblems with installing the SSOAP package on R
I’m trying to install the package SSOAP in the software R and receive as return the following error message: ERROR: dependency 'Xmlschema' is not available for package 'SSOAP' * removing '…
rasked 5 years, 3 months ago Letícia Marrara 95 -
0
votes1
answer892
viewsHow to save a ggplot chart without losing quality to Word and Power Point?
I’m having trouble saving the graphics in a way that: they either lose quality or change their dimensions in relation to the background of the sheet that receives it. Attempt.1 <- A figure with…
-
0
votes1
answer52
viewsError in program something related to the lines
energia <- data.frame("curso" = 1:15,"enem"=1:5) energia$curso <- c("Eng Aeroespacial", "Eng Ambiental", "Eng de Controle e Automação", "Eng de Minas", "Eng de Produção", "Eng de…
-
0
votes1
answer81
viewsDoubt in exercise of R
I’m having trouble doing the following exercise, someone with R knowledge could help in this case In a long jump competition each athlete is entitled to five jumps. The result of the athlete will be…
rasked 5 years, 2 months ago Murilo Albeest 93 -
0
votes0
answers114
viewsOpen a Flexdashboard in another browser tab with "Runtime:Shiny" through an Actionbutton in a Shiny app
I have a Shiny application of the following structure, where the following code is named app.R library(shiny) ui <- fluidPage( theme = shinytheme("darkly"), navbarPage(title = "Teste ",…
-
0
votes0
answers96
viewsNonlinear regression with R
I have the following data sets: x1 <- c(0.00113, 0.00123, 0.00125, 0.0013, 0.00136, 0.0014, 0.00146, 0.00151,0.00158,0.00163,0.00166) x2 <- c(0.99887, 0.899, 0.79823, 0.6942, 0.59889, 0.49958,…
-
0
votes2
answers81
viewsDifference between dates located in different rows and columns
In R, I have the following data: entrada saida id ordem 2013-01-15 2013-05-20 1 1 2015-03-13 2015-09-12 1 2 2016-01-12 2016-04-11 1 3 I want to add a column with the difference (days) between the…
-
0
votes3
answers5543
viewsChange axes X and Y graphs ggplot in R
I would like to leave the graph in the ggplot so that the y-axis scale, is in millions of tons, so that the values become smaller, and also in the x-axis, appears every month and year. I used this…
rasked 5 years, 1 month ago Letícia Marrara 95 -
0
votes2
answers118
viewsChange line style in autoplot
I’m not sure how to change the style of a single line in a graph that contains two lines in autoplot in r. I can change the style using the ts.linetype command, but it changes the style of the two…
rasked 5 years, 1 month ago Letícia Marrara 95 -
0
votes1
answer39
viewsProblem while uploading and converting.txt files
Every time I try to do the operation below I get a mistake: setwd('C:\\Users\\MatheuS\\Documents\\file') library(readr) fns = list.files(patt="\\.txt") sapply(fns, function(x){…
-
0
votes1
answer46
viewsRemoval of lines with non-repeating levels in R
Guys, I have the following df: df <- data.frame(X =c("a","b","c","a","b","c","a","b","c","d","a","b","c","d","e"), Y = c("w","w","w", "K","K","K", "L","L","L","L","Z","Z","Z","Z","Z")) Note that…
rasked 5 years, 1 month ago Antonio Carlos Porto 3 -
0
votes1
answer37
viewsnloptr optimization - "objective in x0 Returns NA" error
I’m having trouble using the function nloptr of R. I need the optimal value to be used in the function. The optimization will be iterative, using another value that is also being optimized at each…
rasked 5 years, 1 month ago user164705 23 -
0
votes1
answer50
viewsWord combination identification in R
I have hundreds of sentences like these below. And I would like to identify the phrases that contain the words Phone and delete. But these two words must have only one term between them, in this…
-
0
votes1
answer38
viewsHow to enter the suffix of the name of an output in the input function$.... _rows_selected?
I am building a function in R Shiny and in this function I want to take the suffix of the name of a output$sufixo and incorporate it into a function of the DT input$sufix_rows_selected. Does anyone…
-
0
votes3
answers518
viewsConditional Sum on each R line?
I’m trying to create a function that takes the fixed value of a row df[1.3] and subtracts it by the value of another row of a dataframe df[,1] and the result of that subtraction is also subtracted…
rasked 5 years ago Vinicius Soares 31 -
0
votes1
answer146
viewsTranspose column to row with condition in r
I have a file with a column and I would like to transfer it with one condition: the first number that appears and the subsequent lines should be in a row df <- data.frame(Coluna = c(1, "ALDO…
-
0
votes1
answer108
viewsTransform XML into Dataframe
I have an XML and I’m trying to turn it into a DF. My XML: <?xml version="1.0" encoding="ISO-8859-1" ?> <test:TASS xmlns="http://www.vvv.com/schemas"…
-
0
votes1
answer422
viewsGroup and sum columns - r
Dice: P<-c("Alemanha", "USA", "Alemanha", "USA", "USA", "França") Citacoes<-c(1,5,8,0,9,20) df<-data.frame(P,Citacoes) Each P (country) represents 1 document and each document has an amount…
-
0
votes1
answer57
viewsUse of Loops for Dataframe Editing [R]
I used the package wbstats to download a World Bank Governance Quality database for Latin American countries. The code below reproduces the process: LATAM <-…
rasked 4 years, 9 months ago Guilherme Marques 89 -
0
votes1
answer107
viewsError generating bar graph: 'height' must be a vector or a Matrix
Hello! When building a bar chart on R Language using the RStudio I came across the following mistake: Error in barplot.default(database$results, main = "EvasionChart", xlab = rotulo[1], : 'height'…
-
0
votes1
answer97
viewsmutate - case_when - Rstudio
I need to adjust one column to another. I have a column of hostpitais "HP" and a column of cities "City". I need to adjust the city according to the Hospital. Bwn is my database I’m making: BWn =…
rasked 4 years, 8 months ago Gisele Santos 27 -
0
votes1
answer38
viewsOrganizing multiples p-value in R (Kruskal.test)
Using the code below, I created a data.frame() with 5 variables. This way, I can get the value of p using the variable 'table' and Kruskal.test(). > sample1 <- c(3, 3, 3, 2, 3) > sample2…
rasked 4 years, 7 months ago Anderson N. Barbosa 1 -
0
votes1
answer542
viewsTo change the order of the legend without changing the colors of the chart in ggplot2
I am mounting this graphic using the ggplot2 package and prefer it with more neutral colors as in the first image (without vibrant colors), but when I modify the order of the caption the colors of…