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
answer245
viewsHow to separate text answers in R?
I’m sure my doubt should be super simple to be solved so far I have not had any positive results in any of the tutorials I downloaded. I am working on a df in R that there is a column that the…
rasked 6 years, 1 month ago Priscila Costa Santos 1 -
0
votes1
answer221
viewsFill cells with AN by an annual logical sequence in R
I have a dataframe with 25 people and their respective ages from 2012 to 2015, but in a few years the ages were not filled. id<-c(1:25) idade_2012<-c(21, 18, 19, 25, 20, 12, 12, 13, 14, 29,…
-
0
votes1
answer75
viewsR - Graphs with information from different columns
Hello, I have the following problem: I need to create a table and a chart with information on educational level for different positions of the firm for different years and regions. I have 4 levels…
-
0
votes1
answer187
viewsSimulation of Monte Carlo
Good morning, I came across the following terms: Simulation of Monte Carlo first order and second order. I’ve been working with MMC for a while but I’m not familiar with these terms and I couldn’t…
-
0
votes1
answer155
viewsProblems with dates in R
I am again having date problems in R. I have the dataset below and would like to calculate the difference of dates between revisions. It happens that I am not succeeding, sometimes returns some…
-
0
votes1
answer73
viewsHow to plot a graph using a Function curve
I need to resolve a matter of an R course. But I don’t know if I did it correctly. Could you please help me? The question is this:: Question 2. Create a vector with the Cosine of Numbers between -10…
-
0
votes0
answers114
viewsDoubt logistic regression analysis in R
Analysis R, possible logistic analysis, I have difficulties in analyzing a data where several species of toads vocalize, during the data collection the vocalization had presence or absence between…
-
0
votes1
answer143
viewsSelecting different ranges on a giant dataframe in Rstudio
I have a CSV much large with multiple stock dates and their closing prices, impossible to use Excel. The action name is in the same date column and only appears at the beginning of the series, as…
-
0
votes0
answers32
views"Error in Optim" using Hurdle Model
I have a data set, where the response variable of my study has many zeros; therefore, I decided to understand the influence of predictive variables using a "Hurdle model". Look at my code: fórmula…
-
0
votes1
answer466
viewsR histogram with all apparent breaks, hist() function
I have a database with over 8000 lines and would like to create a histogram, but it does not show the bar in all lower frequency classes, in the case of the last classes (Image). I understand that…
-
0
votes1
answer476
viewsTake a sample without repetition taking into account 2 variables in the R
I have two bases. One with the lines I would like to take the sample and the other with the sample size with the dates. The first one that is the database of fact that I need to make the sample, is…
-
0
votes1
answer145
viewsHow to convert hexadecimal to binary in a matrix in r?
I have a matrix with hexadecimal number, so: [,1] [,2] [,3] [1,] "FA" "F8" "D0" [2,] "CE" "17" "6A" [3,] "0E" "D6" "22" If I try to convert into binary, with hex2bin(matriz) (biblioteca BMS), is…
-
0
votes1
answer118
viewsRstem package installation on R
Hello, good afternoon! I am trying to install the Rstem package on R, through a tar.gz file, since the package was discontinued from CRAN. I am using the following routine, but error installation,…
rasked 5 years, 8 months ago Ingled M Cardoso 159 -
0
votes1
answer59
viewsFind metrics by R
I cannot find in R the same metrics that are presented by the graphical interface (see below). Of all the metrics, only the accuracy (CA) I was able to find. Is there any step by step or place where…
-
0
votes1
answer51
viewsHow to add or eliminate scatter points on a graph mechanically?
Hello, good morning! I would like to know a routine to add or eliminate scatter points on a graph in a "mechanical" way with the mouse click on the graph! I intend to work with some maps, to mark…
-
0
votes1
answer177
viewsPlot of points Axis X ggplot2 space between numbers
I made a graph of points and lines, as shown below. Only the spaces between the data on the X axis was 20 by 20. I wanted to put 10 by 10. How can I do that?…
-
0
votes1
answer323
viewsSVM model - regularisation and cost factors
In the SVM model (kernel: linear, regularisation factor: 0.1, cross validation k=10). Would the regularization factor and cost factor be the same? No help of R informs only the argument cost.…
-
0
votes0
answers61
viewsPackage: sp error starting Rstudio
When starting Rstudio the following message appears: Loading required package: sp. I try to install the package sp and the message appears: Warning in install.packages : package ‘sp’ is in use and…
-
0
votes0
answers42
viewsHow to multiply the number of votes in the R?
This piece of code is inside a function I’m writing. In the last two lines is my problem. firm1 = quote(q0_1 + c1 * q1 + c1_2 * q1) ## firm 1's cost curve firm2 = quote(q0_2 + c2 * q2 + c2_2 * q2)…
rasked 6 years, 2 months ago Pedro Cavalcante 151 -
0
votes2
answers550
viewsHow to count sequence numbers in R?
I have a spreadsheet with the amount of rain for each day of the month. If there are at least 5 consecutive days with the cell value equal to 0, the counter gets 1. The next sequence with 5 or more…
-
0
votes1
answer278
viewsIn R, how to find out if two vertices are adjacent from an adjacency matrix
This is the adjacency matrix, how to find out (implement an algorithm) if the vertices 2 and 3 are adjacent using R?…
-
0
votes0
answers177
viewsHow to ignore the NA values in a dataframe running auto.
I have the code to run the auto.It runs on a small dataframe, but in some columns I have several 'NA' values (from 1990 to 2003, for example). How to establish in my code that such values are…
-
0
votes1
answer611
viewsSIZE OF A DATAFRAME
Good afternoon! I would like to know what size capacity of a data frame in R, I have a case in which used the R Sidrar package connection direct to the IBGE API for data capture, I had the following…
rasked 5 years, 6 months ago Ingled M Cardoso 159 -
0
votes1
answer145
viewsdplyr filter() problems
Hi, guys. Well, I went to try to replicate a code I made on the work computer on my notebook. At some point, I do a data filtering with the dplyr using the signals "<" and ">". When I made the…
-
0
votes1
answer278
viewsView Table in Access Through R
My machine is 64 bit, I would like to know how to connect R to a table in Access (2016). As an example to facilitate, suppose the table in Access is called MAT and the Access file is in a folder in…
-
0
votes0
answers80
viewsCreate a mobile ranking based on a 252-day window
I have a time series of implied volatility index (retivol) in daily data. Sample of 9 years. I want to create a 20-percentile mobile ranking based on a 252-day mobile window t and compare the date t…
-
0
votes1
answer33
viewsError importing. csv files
I get the following error message: Cannot change Working driectory? This message is always appearing when I try to insert in my console the file csv. diretorio <-"C:/Users/Leonardo…
rasked 5 years, 6 months ago Leonardo Bergamo 1 -
0
votes1
answer60
viewsAnalyze emails with R
I would like to know if there is any package in R that does Mining text for outlook emails, so that it can filter emails by keywords, or by some kind of argument, extracting relevant information and…
rasked 5 years, 5 months ago Henrique Faria de Oliveira 725 -
0
votes1
answer55
viewsCreate a data frame by separating terms from a string into columns
How do I create a data.frame separating each term bound by _ in columns "WZ_311205_20131007_20131008113131_RUA_RAMAL_FARIA_TEMP_DATA_ _AVENIDA_DADOS_PORTO_9.xml"…
rasked 5 years, 5 months ago Henrique Faria de Oliveira 725 -
0
votes0
answers54
viewsDoubt in the use of data.table
Good morning! Guys, I need some help. I worked out the routine below to update a data.table (dt). The execution was very slow so I suppressed the innermost loop and associated the Resul variable…
rasked 6 years, 1 month ago Valmir Sobral 9 -
0
votes0
answers56
viewsR coxph() In fitter(....) Loglik converged before variable 1 ; beta may be Infinite
I’m using the Cox regression model, for a very large data series (I let it run overnight). And when it’s over, this message comes Mensagens de aviso perdidas: In fitter(X, Y, strats, offset, init,…
-
0
votes0
answers78
viewsProblem with Encoding
I’m doing a job in college that I had to do an opinion poll, and for that I used Google Forms to do this job. After collecting the answers I imported the file using the read_xlsx and had an…
rasked 6 years ago Gabriel Mizuno 167 -
0
votes0
answers176
viewscausality test of Granger cajorls R
I would like to do the Granger causality test on vec in data R: library(urca) data(finland) sjf <- finland sjf.vecm <- ca.jo(sjf, ecdet = "none", type = "eigen", K = 2, spec = "longrun",…
rasked 5 years, 3 months ago Everton Toledo 113 -
0
votes1
answer73
viewscode in R language
Can anyone explain to me what the code below performs? cluster <- ml_kmeans(variaveis_clusters_tratado, CODCLI ~ ., k = 5) clusters <- ml_predict(cluster, variaveis_clusters_tratado)…
-
0
votes1
answer71
viewsHow to not generate BEKK11 directly on the screen
The function BEKK11 of package MTS generates directly on screen because of the functions: cat("Initial estimates: ", par, "\n") cat("Lower limits: ", c1, "\n") cat("Upper limits: ", c2, "\n")…
rasked 5 years, 3 months ago Everton Toledo 113 -
0
votes2
answers942
viewsLoop R to find the highest value in a column
I would like a help in the code below. I have in the object df_ar a column called litros_cerveja, with the consumption of the drink in the countries of South America in the year 2010. I would like…
-
0
votes1
answer61
viewsHow to fix error in auto model.Rhyme using Time Series in R?
My goal is to make a prediction using Time Series and for that I need to create a model using the auto.arima, but after several attempts the following error message is displayed: Error in…
rasked 5 years, 3 months ago Izak Mandrak 1,059 -
0
votes1
answer83
viewsPause loop of a gif
Hello! Guys, I have a problem stopping a GIF generated with the Animate function. As it will serve for a PPT presentation, I would like the GIF to be stopped on the last die so that comments can be…
-
0
votes0
answers956
viewsx error must be numeric
I’m learning to work with the R yet. I’m trying to build a dendrogram from correlation tests, between isotopic and meteorological data. I did the following: RC <- read.csv("RCmatrix.csv")…
rasked 5 years, 3 months ago user158758 1 -
0
votes1
answer103
viewsHow to build Tukey test tables in R
I have several analyses of Tukey’s test done in R and I would like to transform the obtained tables into tables with the aspect that can be seen in the image. Is there any more or less automatic way…
-
0
votes1
answer45
viewsPlot the PCA result in three dimensions
I made a PCA using stats::prcomp and would like to plot the result in three dimensions. It is possible?
-
0
votes0
answers57
viewsDoubts about calling multiple objects, one by one in iterations of an R looping
I imported some objects as follows, in this example I put only two, but I intend to work with many, so I need to automate some processes: library(quantmod) #escolhendo a data que deseja start <-…
rasked 5 years, 11 months ago Henrique Faria de Oliveira 725 -
0
votes1
answer302
viewsAdd two different scales in ggplot
I would like to know how to put two different scales on the geom_line Plot on R. I plotted two lines on the same graph, but their scales are different, how do I leave two scales on the y axis? One…
rasked 5 years, 2 months ago Letícia Marrara 95 -
0
votes1
answer495
viewsHow to filter lines in R?
Good afternoon! I have the following data: 1. Animal1 128kg 2. Animal1 150kg 3. Animal1 80kg 4. Animal2 169kg 5. Animal2 113kg How do I filter for each animal the weight closer to 120kg and erase…
-
0
votes2
answers50
viewsRmysql - My querys return a list
Hi, I’m working with a database that I usually access with Workbench. To start importing directly into R, I am using the Rmysql library. I can make the connection and find my tables, but when it…
-
0
votes1
answer21
viewsDomain. com Rstudio Website
all right? Could you give me a hand? I want to guarantee a domain . com to build my site with Shiny/markdown. But I am still studying Shiny/html/css so I will still produce my site. Nesa situation…
-
0
votes1
answer145
viewsImport table in R without names (skip line did not work)
I’m trying to import some data into R, but no matter what I do, there’s always a row with column names (row information I want to skip). This is the table: However, in R, even skipping the first…
-
0
votes0
answers49
viewsR - find a specific value in the matrix
I’m having trouble finding a specific value in a matrix. The problem is that my matrix is too big to put here [360,181], so I’ll have to solve with an example. x<- matrix(1:50, ncol=5) I need…
-
0
votes1
answer73
viewsCreate column names with spaces
I’m trying to create a DF with columns that contain spaces in their names, but an error is appearing. This is the DF I’m trying to create: MUNICIPIO <- c('BELO HORIZONTE','BRASILIA','JUIZ DE…
rasked 5 years, 1 month ago Bruno Avila 867 -
0
votes0
answers133
viewsR - How to convert all columns of a data.table encoding?
Hello ! I’ve been through the documentation data.table() , but I still can’t fully understand. How would this function, for a dt ? for(i in 1:ncol(df1)) { df1[,i] <- df1[,i] %>% iconv(from =…