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
-
3
votes1
answer321
viewsBest SQL DBMS for with large bases (RAIS > Mem RAM)
I am trying to write a routine to automate the import of RAIS public micro-data and to work with it on a normal computer (RAIS size > RAM) What is the best SQL software (DBMS/protocol) to use?…
-
3
votes2
answers170
viewsIn R, using dplyr, create a new matrix
Suppose I have the following database >data zona candidato votos 1 A 100 1 B 20 2 A 30 2 B 15 I want, using dplry, the following matrix >nova zona votos_zona votosA votosB 1 120 100 20 2 45 30…
-
3
votes1
answer248
viewsHow to insert data for graphing in ggplot
I want to make a line chart with ggplot, but this message appears: Error: Don’t know how to add geom_point to a Plot Follow the pattern I’m doing: a<-c(4.9, 4.4, 4.2, 3.9, 3.7, 3.5, 3.1, 3, 2.9,…
-
3
votes1
answer206
viewsOrder of operations in the R
How does the order of operations in R work? And how can I change them? For example, when I do 1 + 2^2 in the R, he knows that first it is necessary to evaluate the 2^2 and then add the result to the…
rasked 10 years, 1 month ago Daniel Falbel 12,504 -
3
votes1
answer240
viewsHow to make Scrapping in Google Scholar?
Using Mozilla Firefox, could anyone tell you how to make Scrapping in Google Scholar? Where to start?
-
3
votes1
answer98
viewsHow to create Abels in a binary vector without it becoming categorical?
I have a binary variable in a dataframe, want to assign the label "no" for the value 0 and "yes" for the value 1 without the vector becoming categorical (if this occurs, I cannot use the function…
rasked 10 years ago Henrique Pizarro 659 -
3
votes2
answers3637
viewsHow to fix the x-axis boundaries in ggplot?
I have the following data: k <- c(294131, 734127, 817963) ano <- c(1991, 2000, 2010) dados <- data.frame(k, ano) I’m doing it this way: ggplot(dados,aes(x=ano,y=k)) + geom_point() +…
-
3
votes1
answer621
viewsI cannot import data from a CSV to Postgresql with dbWriteTable from R
I am trying to import a CSV into a Postgresql database from R. On the Postgresql server, I created an empty database, called "Data". library(RPostgreSQL) library(sqldf) drv <-…
-
3
votes3
answers21039
viewsHow do I exclude a set of specific lines, listed in a vector, from a data frame in R?
Hello, I have a data.frame with thousands of lines and a vector with the lines I need this data.frame, as I do to select only the lines of the list in a separate object?
rasked 10 years ago Diego Carneiro 31 -
3
votes2
answers513
viewsSurvey and count package
I am working with the IBGE database - PNAD with the help of the Survey package. To count responses (for example, the proportion of people under 15 years of age in the northern region) is it…
rasked 10 years ago Henrique Pizarro 659 -
3
votes1
answer618
viewsDoubt about conditional (if) in function
I have a set of 300 and few worksheets in which we have to create a function with 3 arguments: the directory where the worksheets are, the variable that will be analyzed and the number of files that…
-
3
votes1
answer196
viewsAutomatically check quantitative variables in R
I have a database here and I need to automatically check which quantitative variables are. My advisor says I need to use sapply and the function is.numeric and create a code that returns a vector of…
-
3
votes1
answer503
viewsHow to replace a series of whitespace with just one in a string in R?
How do I replace a series of blank spaces with just one, in R? For example, suppose we have a string: x <- " non non non non" I want to make the content of x: "non non non non non non non non".…
-
3
votes1
answer242
viewsR filter sets
I am taking the first steps in programming and with the R language and I have the following doubt I have an anniversary dataframe with the following format Months | Person Abril Joao Março Ana Abril…
-
3
votes2
answers647
viewsSAS and R run Merge differently
What is the difference between how R and SAS perform merge? The SAS Merge command returns 205546 lines whereas the R command returns 207208 lines. Following example. I am working with the IBGE file…
-
3
votes1
answer271
viewsSpecify Miktex path in Rstudio
I am trying to compile a file . Rmd to pdf using Rstudio’s Knitr. As I am using a computer (Windows 7) with permission restrictions, I had to install Miktex in the Documents folder and Rstudio is…
-
3
votes2
answers3208
viewsAdjust data to exponential model in R
Good night, I have two variables about insect growth: y- head width measurements(0.5,0.8,0.10,0.12,0.16) x- age at which they were measured (1,2,3,4,5) I need to see if this growth fits an…
-
3
votes3
answers1398
viewsin R, create a vector rounding function so that the coordinates vanish 100
I have a vector of percentages, for example, v<- c(32.5 , 43.2 , 24.1) > round(v) [1] 32 43 24 > sum(round(v)) [1] 99 I want a function that manipulates my surroundings so that it adds up…
-
3
votes2
answers145
viewsAccess the data values by the "boot" function
I’m having a problem getting some values given by the function boot in R: My data dados<- c(16483.82, 16463.06, 15649.35, 15615.27, 20034.44, 16254.43, 16946.72) meanFunc <-…
rasked 9 years, 9 months ago david clarck 333 -
3
votes1
answer99
viewsInstallation mgarch Package on R
I want to install the package mgarch. I downloaded it for here. Looks like I need to install the devtools as explained here. I do all this and I can’t. How can I solve this problem? I do the…
-
3
votes2
answers1941
viewsWord cloud in R
I’m using the following program: library("wordcloud") library("tm") library("RColorBrewer") dados=read.csv("C:/teste/dados.csv", sep=";", dec=",",header=TRUE) capa=dados$mensagem corpus <-…
-
3
votes1
answer333
viewsMaximum likelihood estimation using nlm
I am interested in estimating two maximum likelihood parameters using the function nlm. **-------- FUNÇÃO RBETAMIFI -------** rbetamifi <- function(n,mi,fi){ p <- mi*fi q <- (1-mi)*fi…
rasked 9 years, 8 months ago Gabriel Ianhez Pereira 41 -
3
votes1
answer399
viewsIn R, how to define a function with undefined arguments of the same nature
Dear friends, I am defining one function from another. However, I want to define my new function with several arguments of the same nature. For example My basic function is well-defined…
-
3
votes1
answer2746
viewsHow to create a function in R
I am wanting to create a function to control the students' grades. I am trying the following function: note_eng<-read.csv2("note.csv",header=TRUE)…
-
3
votes1
answer3039
viewsHow to remove specific lines from a data frame?
I need to generate a new table only with the hourly rounds. For example, from this table: This data would remain: How best to solve this problem in R?…
rasked 9 years, 7 months ago João dos Reis 33 -
3
votes2
answers1241
viewsHow to do sequence in R?
I need to do this sequence in a repeating structure to use with a larger N, but I’m not getting it done, does anyone have any idea how to do this? n=8 names <- c (seq(1 , n), seq(2,n+1 ), seq…
-
3
votes1
answer558
viewsCreate frequency distribution matrix in R (categorical variable VS numeric)
I have two columns: supply situation (categorical variable) and number of students (numerical variable). I want to create a table that tells how many students are in each modality (class/levels).…
-
3
votes1
answer122
viewsAdding values in existing tables with Rmysql
I had asked earlier a question about Mysql database on using the RODBC library and due to an error in the types,I saw in one of the answers told me about the Rmysql library and decided to try it.…
-
3
votes2
answers1739
viewsIn R, sort a data frame by column and by groups
I want to sort a data frame according to a v2 column and respecting the groups column. For example, suppose I have df as follows df v1 v2 grupo 1 5 1 4 1 1 1 2 1 5 7 2 4 2 2 1 9 2 I want the result…
-
3
votes2
answers182
viewsHow to install the Krisp package in R?
I want to install the following package in R http://user.math.uzh.ch/furrer/software/KriSp/ It is in tar.gz format I used the following command: install.Packages("~/Krisp_0.4.tar. gz", Repos = NULL,…
-
3
votes1
answer1613
viewsHow to convert data.frame to list?
I loaded my data using taxadados<-read.csv2("ComponentesPrincipaisTeste.csv",header=TRUE) TAXA Taxa.1 Taxa.2 Taxa.3 Taxa.4 Taxa.5 Taxa.6 Taxa.7 Taxa.8 09/04/2013 32.7188 8.8350 13.0662 9.0114…
-
3
votes1
answer243
viewsBest value for span/f parameter in lowess/loess function in R
I’m facing a problem with smoothing curves adjusted by functions lowess or loess in R, for the choice of the smoothing parameter f in the lowess or span in the loess I looked for some tips on web…
rasked 9 years, 4 months ago david clarck 333 -
3
votes1
answer305
viewsGLM, Poisson - non-integer count numbers (average)
I’m doing GLM for frequency data of a behavior x. As I have day 1 and day 2 of observations, I averaged the frequencies of that two days, so my counting data is not integer numbers. However, I am…
-
3
votes2
answers63
viewsMajority vote in matrix in R
I want to compare elements of a matrix, for example, in row 1 (fixed) I want to know which object happens with the most frequency and return the same, precise in an automated way, because the number…
-
3
votes1
answer131
viewsProblem with xts Object
Package ːYieldcurve' Guys, I’m using this package and I have a little problem. MatrizCurva<-MatrizUmaLinha20colunas[1,1:20] [1] 0.1164000 0.1264816 0.1265631 0.1366446 0.1467260 0.1568073…
-
3
votes1
answer62
viewsHow to get columns from XLS files in R
Using R tool, I was able to open an XLS file as follows: require(xlsx) coln = function(x) { y = rbind(seq(1, ncol(x))) colnames(y) = colnames(x) rownames(y) = "col.number" return(y) } data =…
-
3
votes3
answers7652
viewsGraphic overlay on R
how can I overlay two or more graphs without the limits of the axes also appear superimposed on the figure? a = rnorm(1000) b = runif(1000) plot(a, type = "l") par(new = T) plot(b, type = "l", col =…
rasked 9 years, 2 months ago Wagner Jorge 1,377 -
3
votes2
answers309
viewsPlotting Graphs ggplot inside loop
I’m wanting to create a for using ggplot: Carteira<-cbind(A, B, C,D,E,F) A, B, C,D,E,F are given in the format "zoo". My code is: for(i in 1:6){ ggplot(Carteira[,i], aes(Carteira[,i])) +…
-
3
votes3
answers656
viewsCommands as. Date and srtptime in R
Suppose the following vector: datas=c("26/12/2014", "27/12/2014", "28/12/2014", "29/12/2014", "30/12/2014", "31/12/2014") When applying the commands as.Date(datas, "%d/%m%y") and strptimes(datas,…
-
3
votes2
answers2625
viewsBar graph text stacked in R
I want to create a stacked bar chart similar to the one below I used the following command barplot(t(dadosAQI), xlab="%", col=colAQI, horiz = TRUE, cex.axis = 0.8, cex.names = 0.8, las=1 ) But I…
-
3
votes2
answers82
viewsComparison of elements of a vector
Staff need a function to check that all vector coordinates are equal. a = rep(1, 5) Let the previous output be TRUE. b = c(rep(1, 4),2) Let the previous output be FALSE.…
rasked 9 years, 1 month ago Wagner Jorge 1,377 -
3
votes1
answer790
viewsPackage Management in R, how to export and import packages?
I use my scripts on several computers and then come across errors regarding the lack of packages and often such computers do not have internet access, which makes it difficult to access the…
-
3
votes1
answer857
viewsHow to get the first non-zero element?
I have the following problem, I have a matrix and I want to go through it and get the first line that has all the elements other than zero. For example: a = matrix(c(rep(0,4), 1:16), ncol = 4, byrow…
rasked 9 years, 1 month ago Wagner Jorge 1,377 -
3
votes2
answers702
viewsHow to add a second Y axis using the matplot function?
I have two sets of data with different scales and would like to plot the two on the same graph, the second is derived from the first. I’m using the code below, but it doesn’t work the way I want,…
-
3
votes1
answer50
viewsWhy does the for-loop convert from Date to integer?
Can anyone explain why in for-loop the objects Date are converted to integer? In the code below I want to iterate on the dates but these are converted to integers. > dates <- Sys.Date() + 1:10…
-
3
votes1
answer164
viewsARIMA model with 1 and 25 lag in R
Please, when applying the ARIMA(p,d,q) modeling in a series, in the partial autocorrelation function a peak appears in lag 1 and another in 25 and no other statistically significant. There is some…
rasked 9 years ago Henrique Pizarro 659 -
3
votes1
answer1608
viewsCreate a blank data.frame to receive results?
Suppose you want to create a blank data frame to receive the results of a grip test. x<-data.frame(Distribuicao=c(NULL),p-value=c(NULL)) After the test is performed a vector with the results:…
-
3
votes0
answers288
viewsImport from txt, change content and download R content
Hi! I am beginner in programming namely R, I have read quite still very confused with libraries and everything and still do not know what its limitations, so I ask you if it is possible with R to do…
-
3
votes1
answer493
viewsHow to turn plot of scatter into density?
I would like to know how to turn a dot dispersion graph into a dot density graph in the region, for example, where there are few dots the color of the region will be clear, where there are many dots…
-
3
votes1
answer1327
viewsHow to change table rows in R by values from the same row only from another column
[,1] [,2] [1,] "NAO INFORMADO" "1" [2,] "2" "3" [3,] "NAO INFORMADO" "5" [4,] "4" "1" [5,] "NAO INFORMADO" "3" [6,] "6" "5" wanted to change all values not informed by the values in column 2 of the…