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
votes2
answers4318
viewsHow to save or reserve a list of objects? (R)
In R, I’m wanting to "keep a list of matrices". In fact, I’m wanting to reserve a list of 10 objects, where each object will turn into an array, after using a for() Something like that: Data <-…
-
2
votes1
answer250
viewsApplying Loop to Elements of a Matrix (R)
Be the matrix below created from the Command simu_matrix <- matrix(runif(25,0,1),nrow=5,ncol=5) V1 V2 V3 V4 V5 1 0.07357303 0.45524021 0.9352829 0.60466424 0.4725541 2 0.51018615 0.46044203…
-
2
votes1
answer102
viewsReturn a Matrix that has all possible column multiplications of another Matrix (R)
Be a Matrix : bb=replicate(3, rnorm(3)) [,1] [,2] [,3] [1,] 0.5556358 1.6611142 0.2374830 [2,] -0.6672456 -0.5038430 0.9814712 [3,] -0.1391022 -1.2072500 -0.6219965 How can I return a second matrix…
-
2
votes1
answer108
viewsWhat are the advantages of working directly with stdin, stdout and stderr?
Is there some advantage in terms of speed or some other aspect? Shows the connections: showConnections(all = TRUE) Individual examples: stdin() stdout() stderr()…
-
2
votes2
answers138
viewsUse "NA" for logical operation on R
I’m with the situation: a = c(1,2,3, NA, 5, 6, NA) b = 99 for(i in 1: 7){ if(a[i] == "NA"){ a[i] = b } } The problem is that R does not make the logical comparison using "NA" or NA.…
rasked 10 years, 2 months ago Wagner Jorge 1,377 -
2
votes1
answer5140
viewsLoading Rdata files from the file directory itself . R
How to load Rdata files that are in the same directory as the file . R, in Rstudio? Here, for example, is the line: load('teste.RData') When loaded, it returns... Erro em readChar(con, 5L, useBytes…
-
2
votes1
answer2792
viewsError in Package Installation?
I am trying to install this next map generation package but is giving the following error install.Packages("maptools",Dep=TRUE) Installing package into C:/Users/rafael/Documents/R/win-library/3.0'…
rasked 10 years, 2 months ago Rafael Araujo 157 -
2
votes2
answers139
viewsHow to use the svymean() function if I have missings in the observations?
I’m using the function svymean() package Survey but when the data have missings ("Als"), the mean is not calculated. Please, someone knows how to fix this?…
rasked 10 years, 1 month ago Henrique Pizarro 659 -
2
votes2
answers144
viewsMatlabfunction() similar to MATLAB in R
There is a function similar to matlabFunction() MATLAB? Or how to do this in R? The function in MATLAB. syms x dados = inputdlg({'P(x): ', 'Q(x): ', 'R(x): ', 'N: '},'Dados'); P =…
-
2
votes1
answer125
viewsMean Difference Hypothesis Test in R Survey Package
Please, using the Survey package, how to make a hypothesis test of mean difference? i.e. if the sample mean of 2003 is the same in 2008 for a certain variable. I’m working with PNAD data
rasked 10 years ago Henrique Pizarro 659 -
2
votes2
answers239
viewsHow to save an error message to a string in R?
I wonder if there is a function that stores the error message of an expression in a string. For example I would like to get the result below: erro <- pegaErro(runif("a")) erro Error in runif("a")…
rasked 10 years ago Daniel Falbel 12,504 -
2
votes2
answers296
viewsWhat does the "Design has only one Primary sampling Unit" error mean?
I am using the R Survey package and, while performing some svymean(), what returns is the Warning: Design has only one Primary sampling Unit.…
rasked 10 years ago Henrique Pizarro 659 -
2
votes1
answer64
viewsHow to use xmlSApply with separator?
I used the xmlSApply and would like to get the result with a separator but did not know how to apply. Below is an example for you to reproduce: library(XML) fileUrl <-…
-
2
votes1
answer2526
viewsConvert qualitative numeric variables into factors in R
I have the following code already READY, which my advisor passed to me fatores=c("Year","Month","DayofWeek","DayofMonth") dadosFatores=apply(dados[,fatores],2,XXXX) dados[,XXXX]=dadosFatores In…
-
2
votes3
answers192
viewsCalculate average distance travelled with single tapply
I have my database from the package hflights of the R, which shows a number of flights in the US. I need to calculate the average distance travelled (Distance) for each day of the week (variable…
-
2
votes1
answer197
viewsin R, Dec="," does not work in read.csv2
Good afternoon to you... I’m trying to import csv where decimals are separated by dots... or something like 2.5 I want when it’s time to import it to show up with a comma, something like that, 2.5…
-
2
votes1
answer435
viewsData.frame for ts daily data in R
I’m not managing to turn the daily exchange rate to ts. dados <- read.table("C:/Econometria/Cambio/cambio.txt", header=T, dec=",") ts(dados), start=c(1994,01,01), freq=1) # Quando faço isso ele…
-
2
votes1
answer161
viewsSize of a predefined range within a vector
I wonder how I can calculate the amount of elements I have in a predefined range, within a vector. For example: Let’s say I have a size 10 vector. My intention for example is to want to know how…
-
2
votes1
answer330
viewsEven using "na.rm = TRUE" the error message of Missing values appears
When I use the complex sample average command, a warning appears that there are Missing values in Weights, but I am using the option na.rm = TRUE. Does anyone know what happens? Follow the passage:…
rasked 9 years, 10 months ago Henrique Pizarro 659 -
2
votes0
answers144
viewsReturn of the original scale in a prediction function
I created a simple function to perform prediction of tree heights through regression models built for this purpose (symmetric relation models). The function predicts the heights, and inserts them in…
-
2
votes1
answer222
viewsIs it possible to modify a value of an array with assign() in R?
Suppose we have x <- "teste" You can assign another string to test using assign: assign(x, 1:5) Thus: test [1] 1 2 3 4 5 Would it be possible for me to modify some of the values of the vector…
rasked 9 years, 10 months ago Guilherme Duarte 918 -
2
votes1
answer1427
viewsHow to change x-axis values (not the axis title) in "seasonplot"?
In function seasonplot package forecast, how do I change the names of the "x axis"? I used the "xlab" argument, but it just names the axis, I need to change the axis scales. Ex: There appears the…
rasked 9 years, 10 months ago Rafael Araujo 157 -
2
votes1
answer164
viewsEdit nls or nlsLM function for waste calculation
I need to adjust a non-linear function through routines nls or nlsLM, However, my data generates heterocedastic waste when calculated with these routines, which does not allow me to adjust directly…
rasked 9 years, 9 months ago José Ricardo 193 -
2
votes1
answer656
viewsError non-numeric argument to Mathematical Function
Good afternoon, I have the following code in R funcao<-function(delta) {delta} Intensity2AccumulationFactor<-function(delta,s,t){ int<-function(s,t) {integrate(funcao,s,t)} p=int(s,t)…
rasked 9 years, 8 months ago Andreia Silva 21 -
2
votes0
answers159
viewsHow to convert the tags of a . ris file into table variables?
I have a file . ris with data from researchers and would like to convert the labels of this files into labels of columns excel variables.
-
2
votes0
answers127
viewsAssociation between variables: database
I have the following database: id Acidente id_Vitima Sexo_Vitima Faixa_etaria Gravidade_acidente 1 1 1 7 2 2 1 1 6 1 2 2 2 8 1 3 1 2 6 3 3 1 2 2 3 3 1 2 7 3 3 1 2 7 3 I intend to perform an…
-
2
votes0
answers113
viewsHow to make an MLP in the R whose output is a posteriori and the test set classified?
I used the "neuralnet" function of the package of the same name, but I could not run. Yes, I want to sort, so I have labels.
-
2
votes1
answer596
viewsUnify column the dataset and place this content below a table
I have table I have a column that is a data set I need to separate this data and unify the "standard columns". I’ve managed to separate the contents of the column by staying this way: nrow temp area…
rasked 9 years, 6 months ago Joyce Maia 387 -
2
votes1
answer85
viewsOperation with large matrix
Staff would like to know how I can make the Euclidean distance squared between the octadimensional vectors of b and those who are not in a in a super matrix like this of the example. I thought so…
-
2
votes2
answers379
viewsRepeating structure of a function
Hello! I am having trouble finding my error in the program below. I want to generate allele values from a level vector, however I want my function to return an array of generated values. My program…
-
2
votes1
answer59
viewsMajority vote step by step
I would like to know how I can calculate the majority vote step by step, for example by comparing column 1 with 2, per line, then 1,2 and 3, per line, then 1, 2,3 and 4, per line and so on.…
rasked 9 years, 2 months ago Wagner Jorge 1,377 -
2
votes2
answers13721
viewsChange the X-axis scale
Hello, I’m trying to make a chart of thinning the trunk of a tree, where the y axis is the height (meters) and the x axis is the diameter (cm). So far no problem, but I would like to change the…
-
2
votes1
answer119
viewsError with factor analysis command
The command factanal() factor analysis shows a meaningless error message. I have to perform the factor analysis, I want to compare the scores obtained when using the solutions by the variance matrix…
rasked 9 years, 2 months ago Henrique Pizarro 659 -
2
votes2
answers43
viewsDoubts when using the "rle" function
I’m using the rle function. x = rnorm(10,0,1) l = 1 teste = rle(x > l) evento = teste$lengths[teste$values=="TRUE"] I’m having trouble extracting what are the values of my vector x, which has…
-
2
votes2
answers1112
viewsReading Archives in ASCII Census 2010
Does anyone know where to download ASCII (.sas) files for reading the IBGE 2010 Demographic Census microdata ? I know that the Anthony Damico keeps only a few files on his website (see below how to…
-
2
votes1
answer369
viewsR package to convert numbers to full-text number
I am looking for an R package that converts a number to the number written in full. The functionality would be, for example, "134" = "cento e trinta e quatro". Does anyone know?…
-
2
votes1
answer191
viewsRedeem time period in r
Hello, I have a large series of temporal data. I have over 100 years to work. I need to rescue (abstract) only the summers of each of the years, and do not know how to do in R. For example, I need…
-
2
votes0
answers61
viewsHow does the apply family work?
would like to know how the functions of the apply family work and if possible with examples. In what contexts best apply? Thanks since then!
-
2
votes1
answer95
viewsHow to install the plotKML package?
I want to install the following package in R http://cran.at.r-project.org/web/packages/plotKML/index.html the following message appears: Error in loadNamespace(j <- i[[1L]], c(lib.Loc,…
-
2
votes2
answers66
viewsHow can I find out which packages/libraries belong to the functions of a routine written in R?
I have stopped using several routines because programmers do not tell what packages/libraries the functions that are in these routines use. I know that many of these functions are authored by the…
-
2
votes1
answer57
viewsbayesQR package Error message
I am trying to replicate the following example of this package "bayesQR": bayesQR set.seed(66) n <- 200 X <- runif(n=n,min=0,max=10) X <- X y <- 1 + 2*X + rnorm(n=n, mean=0, sd=.6*X) #…
-
2
votes0
answers1281
viewsError while initializing Rstudio
By initializing Rstudio I come across the following "ERROR", package-related "manipulate" and "rstudio": Error installing package: * installing *source* package 'rstudio' ... Aviso em file(file,…
-
2
votes1
answer44
viewsBertin Matrix installation problem
I’m trying to download a package from R which is called the Bertin matrix. The address I have is http://bertin.r-forge.r-project.org/. The problem that when I try to download comes a message that…
-
2
votes1
answer432
viewsMarginal Effect for GLM (Logit) with categorical variables.
I have the following regression: Call: glm(formula = IN_FIN_REEMB_FIES ~ CO_CATEGORIA_ADMINISTRATIVA + CO_COR_RACA_ALUNO + IN_RESERVA_VAGAS + IN_RESERVA_ENSINO_PUBLICO + CO_TURNO_ALUNO +…
rasked 8 years, 10 months ago Rafael Camargos 31 -
2
votes0
answers50
viewsHow to remove accents in R?
How to efficiently remove accents and tilde in the R? What I want to do is to do it in a more practical way than to specify the substitution letter by letter. estados=c("São…
-
2
votes1
answer665
viewsData load error in R
I’m learning to play R, and I was writing a script and all of a sudden I typed read.csv2.ffdf(file="DM_ALUNO.csv",sep="|",first.rows=100000) pressed Ctrl+r and appeared the error below Error in…
-
2
votes1
answer78
viewsHow to test multiple data.frames and set a maximum test score for a certain position? #R
Considering the following date.frames: library(zoo) A<-data.frame(x1=(0:9),x2=rep(0:1,5),x3=rep(0:4,2)) B<-apply(A, 2, function(x) rollapply(x, width = 2, FUN = sum, fill = NA, align = 'r',…
-
2
votes2
answers669
viewsBasic SAS ProcMeans for R
Hello, I am a basic SAS user and I need to create a table in R, but I am very lost in R. The command given in SAS is DATA MEDIAS; SET TEMP; PROC MEANS N MEAN MIN MAX STD; VAR a1 a2 b1 b2 c1 c2 T R…
-
2
votes1
answer507
viewsSegmented Return in R
I was studying a little bit about regressão segmentada and some examples executed in R and I’m having doubts about the workings of segmented. I need to always define where the breaking points should…
-
2
votes1
answer445
viewsHow to create a dynamic progress bar in R?
To follow the processing status in my routines I use the progress bars of the package pbapply, but I couldn’t find a dynamic way to follow more than one process. To illustrate the problem I…