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
answers126
viewsLoop to calculate maximum value
I need to calculate the maximum consumption value based on the previous values each time I loop the consumption data. For example on day 4, the maximum consumption would be calculated from day 1 to…
rasked 7 years, 1 month ago Luciano Hauschild 431 -
0
votes2
answers273
viewsPlay ggplot2 graph using multiple facets
I built the chart below using the command grid.arrange package gridExtra, I would like to leave you with the look of the graphics made with multiple facets, using the sample size as facet, is…
-
0
votes1
answer400
viewsIn R: How to group the results of a loop into a rbind function?
Whereas I have a dataframe called page whose number of lines varies regularly, I wrote this code so that it fits the number of lines that my page$id owns and wrote this while so that he manages a…
-
0
votes1
answer125
viewsR generate time series with initial and final dates for service execution periods
I’m starting to study time series analysis. I have some data sets that are composed as follows: each line consists of one customer service, having the start date (lowest date 2012-01-01), the end…
-
0
votes2
answers170
viewsHow to convert Matlab functions to Rstudio?
tempo=Seq; conc=NCelTotais; coef_ini = [MaxCT 1 2]; coef=[]; OPTIONS = optimset('MaxIter',1000,'TolFun',0.001,'TolX',0.01); coef = fminsearch(@funcaoerro_sigmoide,coef_ini,OPTIONS); A=coef(1);…
-
0
votes1
answer806
viewshow to calculate the average of only one part of a Rstudio column
I have separated only a part of a column, I cannot work with this data, I can only visualize it separately. Someone can help me?!…
-
0
votes0
answers66
viewsGraphical interface for R
Hello! I need to create a graphical interface capable of running R scripts already ready and look for suggestions of what tools I can use. The scripts are complex and serve basically to process…
-
0
votes0
answers97
viewsHow do I solve this problem in seasplot?
Making that code: library(BETS) library(TStools) selic <- BETS.get(4189, from = '2000/01/01', to= '2016/02/01',freq=12) seasplot(selic,outplot = 3,trend = F) Gives this result Error in if…
rasked 6 years, 9 months ago André Takano 21 -
0
votes1
answer658
viewsHow to count repeated arguments in R
I have a spreadsheet, I have to do some operations in the data, so I exported to R and can select the important arguments, now I need to know how many repeated elements there are in a column: for…
-
0
votes0
answers293
viewsHow to apply Pettitt test on R?
Good night, you guys. I am trying to apply the Pettitt test to a series of data. I am using the package trend in the R. Only that the result found is not what I’m looking for, which is what follows…
rasked 7 years, 2 months ago Leonardo Barbieri 23 -
0
votes1
answer1718
viewsObject not found
I made the following commands on R: setwd:(###) data1<-read.table("scatter1.txt",header=T) head(data1) tail(data1) summary(data1) str(data1) names(data1) plot(xv,ys,col="red") And the message…
-
0
votes0
answers22
viewsAnova R table to compare data
I have the following problem: Different percentages of cotton (15,20,25,30 and 35%) in an outfit to check if the higher the amount of cotton present, the higher the fiber resistance. And that’s the…
-
0
votes1
answer888
viewsBox Plot with standard deviation
I need to make a standard deviation boxplot chart, but I don’t know how it does it in R. I want to do for biomass capture and number of individuals in separate graphs, if you can give me an example.…
rasked 6 years, 8 months ago Thayná Machado Biehl 1 -
0
votes0
answers39
viewsHow to do an automated search on the Web of Science using R?
So I own several search strings with which I wish to search Web of Science (those search strings are organized in an Excel spreadsheet, where each line corresponds to a search string); my goal is to…
-
0
votes0
answers40
viewsHow to turn pdf table into a data frame with R?
I’m looking to turn a table from a. pdf document into a data frame in R. What would be the proper way to do this? The table is ordered by author’s name and has 5 columns (Title, Call Number, Series,…
-
0
votes0
answers34
viewsError to generate a Seasplot chart
generating this code: inflacao <- ts(read.csv2('inflacao.csv',header = T,sep = ';',dec = ','), start = c(1980,01),freq=12)[,-1] then the Seasplot: seasplot(inflacao, outplot = 4) Makes this…
-
0
votes2
answers131
viewsWhat does the expression !(...) mean?
I couldn’t figure out what the expression means !(...) Example: if (!(book %in% books)) stop("Unknown book")
-
0
votes1
answer48
viewsReplace double for with double lapply
Personal I am trying to replace my code that has double for by one with double lapply in order to optimize the program since the r works matrix, this functional in this way: k<-1 for(i in…
-
0
votes1
answer483
viewsProblems loading the Rcmdr
Good night when after installing the Rcmdr package, I cannot load it to use. Does this message appear? Can anyone tell me what I can do pfv? local({pkg <- select.list(Sort(.…
-
0
votes2
answers1913
viewsR - Search lines in a data frame conditioned on the part of a string
I have a data frame with several lines, in these lines I have a sentence that contains by default the word "Ad", I want to generate a new data frame that contains only the lines that in the sentence…
-
0
votes1
answer211
viewsUsing the lm function of R to solve the autocorrelation problem
I’m working with the function. lm(y~x) simple regression, due to tests I checked autocorrelation, so the blibliography indicates a transformation. Something like: Y=B1*(1-p)+B2(X-(p*X[-1])) That…
-
0
votes1
answer107
viewsHow to calculate the difference between two dates in a column and group by category to generate a new database in R software
Following the example of the original database and the new:…
-
0
votes1
answer312
viewsplot time series graph where on x-axis show every year
When plotting the normal time series Plot(serie), some years are understood to exist, but do not appear. It would have a way of showing every year of the time series horizontally on the x axis ?…
-
0
votes1
answer152
viewsR - Econometrics - Wald test and autocorrelation
Good afternoon, I would like to know how to perform the Wald Test (for heterocedasticity) and the test proposed by Wooldridge for autocorrelation. I am using panel data (unbalanced), with Pooled…
-
0
votes0
answers26
viewsConvert duration time value
I need to convert the values of an attribute that is in the duration time format hh:mm:ss to a value where I can correlate with another attribute in a boxplot. The data are as follows::…
rasked 7 years ago Fábio Junio Alves Sousa 283 -
0
votes1
answer883
viewsCreate a data sequence from 1 to 30 only with odd numbers. Use the seq() function
I am trying to solve this question given in a manual but I cannot make the sequence of odd numbers
rasked 6 years, 6 months ago bony duque 31 -
0
votes0
answers53
viewsHow can I make a function that "calls" pre-existing spreadsheets in the R program?
Good morning, I’m new to using the R program, so I have a basic question. I want to do a function that uses an existing spreadsheet to pull some data that will be important for the calculation I…
-
0
votes1
answer671
viewsR in Jupyter Notebook
I use Python Jupyter Notebook. I want to use R also on the same platform. I know it’s possible, but I couldn’t figure out how. Could someone give a hint?
-
0
votes1
answer373
viewsConvert monetary values "R$" to double type
Hello, I have several CSV files, in which were stored in some columns monetary values in real ex: "R$ 1.986,00". However, I intend to pass all CSV to Sqlite and then analyze the data in Power BI.…
-
0
votes0
answers68
viewsAggregate function in R
Good afternoon. I am using the function aggregate to group some data. However, I am only using one variable to add up. I would like to use more than one variable. Is this possible? I am using the…
-
0
votes1
answer649
viewsTo transform a spreadsheet of presence and absence of species into columns
I have a basic question about spreadsheets but that is catching my work. I have a table of presence and absence of species with 714 sites and 4406 species. I need to transform this spreadsheet into…
-
0
votes0
answers102
viewsTurning a double variable into a factor
Hello, I’m trying to convert a variable of the type double in factor ppar$abor <- as.factor(ppar$abor) But I’m getting the following error: Error in `$<-.data.frame`(`*tmp*`, abor, value =…
-
0
votes1
answer840
viewsTransform the database into R - A kind of dynamic table
I have a database as follows: CNPJ SIGLA chave CENTRAL 3333 CREDSUL CACHOEIRODIM-ES CECOOPES 4444 COOPSEFES VITORIA-ES CECOOPES 55555 CREDI VITORIA-ES CECOOPES 66666 CREDEXTRA SERRA-ES CECOOPES…
-
0
votes1
answer1927
viewsA: How to turn date only year (four digits) into a data frame?
I have a date frame with the column below. I would like to turn the years (with 4 digits) into dates (as.Date). The idea would be to keep only the years even. I tried some solutions I’ve seen…
-
0
votes1
answer3974
viewsDoubt about concatenation in the R language
I want to use these variables that I’m importing from a table in my function,gecode. The geocode function behaves like this: geocode("Av. Paulista, 1578 - Bela Vista, Sao Paulo, Brazil") I wanted to…
rasked 6 years, 10 months ago Lucas Oliveira 21 -
0
votes1
answer48
viewsSearching for specific names within lines
I have a database about parties and on one line I have a series of acronym like: PT/PSDC/PCB/PMDB. How do I select only the PMDB within those lines?
rasked 6 years, 3 months ago Décio Vieira da Rocha 73 -
0
votes1
answer372
viewsHow do I make an NMDS chart?
I’d like to show the species on the NMDS chart. I can only show the points of the communities in each group, but I would like to show the species. My chart is like this:…
-
0
votes1
answer49
viewsComplete Separation in Hurdle Model
In a Hurdle Model analysis, how can one work with one of the variables of the model that presents complete (or almost complete) separation in the binomial model?
-
0
votes1
answer45
viewsUnique numbering in data frame
I have a database that contains information of consumption per animal and per day. However, the animals entered the experiment on different days. Initially I need to get all animals to start…
rasked 6 years, 9 months ago Luciano Hauschild 431 -
0
votes1
answer60
viewsFunction to go to a particular part of the code
There is some function in the R so that the given condition it jumps to a certain part of the code. I am implementing an audit model, but at certain points it needs external files that are sent only…
rasked 6 years, 2 months ago Flavio Silva 1,108 -
0
votes2
answers2585
viewsHow to calculate the percentage of NA in a data frame in R?
Hello, I’m working with a large data frame - 1000 variables and 60,000 lines - and I need to calculate the percentage of NA and whitespace for each of the variables separately. What’s the best way…
-
0
votes1
answer96
viewsFind the minimum value with greater distance between them
I have the following dataframe TrechoFim. Whereas TrechoFim$Dist is the distance from position X, Y to the track axis. And each record (line) is separated every 1 meter away. X Y Dist 2185 2009.418…
rasked 6 years, 8 months ago Aurenice Figueira 83 -
0
votes0
answers100
viewsDownloading data from the Internet site Bovespabmf by R
I need the data of this site here Bovespa: http://www.b3.com.br/pt_br/market-data-e-indices/servicos-de-dados/market-data/historico/mercado-a-vista/series-historicas/ The data I want is from the…
-
0
votes2
answers589
viewsLatex and Python or R integration
Hi, I have a project that involves reporting automation. Currently all reports are done through word and graphics in excel, now I’m trying to implententar an application that generates graphics…
-
0
votes1
answer161
viewsBoxplot of ggplot2 giving error (does not make the boxes, only a few points with some scratches), how to fix? OBS: I made other graphics and it worked, only the one stuck
boxef <- ggplot (effectsize, aes(subordemfam, varbiom.efs, colour = classe2)) boxef + geom_point() + geom_boxplot() + xlab("Táxon") + ylab("Effect Size na Variação de Biomassa") + theme_bw() +…
-
0
votes1
answer442
viewsCreate column in R
I have a column with three types of information: numerical, percentage and character. I would like to create two new columns from this, one with only the information in character getting the other…
rasked 6 years, 8 months ago Júlio Azambuja 1 -
0
votes0
answers160
viewsProblem downloading data from rbcb Central Bank in R
You could help me? I’m trying to download inflation expectations data for a month by package rbcb https://github.com/wilsonfreitas/rbcb#market-expectations I installed and did the step by step to…
-
0
votes1
answer146
viewsManipulation of CSV in R
I have several files with the extension . csv, I need to read them all, however I have a problem where I have the following variety of file. df1 -> Cabeçalho numérico antes do cabeçalho atual 1 2…
-
0
votes1
answer50
viewsHow to plot/map spatial random effects (Spatial Random Effects) in R?
I am working with visceral leishmaniasis data in census tracts of a Brazilian municipality. I ran a Baysian space model (CAR conditional autoregressible model) BYM from the Carbayes package in the R…
-
0
votes0
answers507
viewsHow to insert lines in specific locations in a data frame?
I need to insert rows in the "Feb" column on days 30 and 31 that are filled in with "NA" so that the data contained in the rows is moved downwards. I tried to fev$novaLin <- with(fev,…
rasked 6 years, 7 months ago Andreia Almeida 183