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
-
-1
votes1
answer22
viewsHow to keep the encoded file name (UTF-8) when unzipping in R?
I’m having trouble accessing files from a compressed folder. The filenames contain accents, but when unzipping the names are changed according to the configuration of each computer that opens and…
-
-1
votes1
answer80
viewsCombination of different values
Considering a dataframe with 2 columns is intended, for each distinct value of the source column: select the corresponding values present in the destination column form combinations 2 to 2 of…
-
-1
votes2
answers29
viewsError compiling R 4.1 package on Debian-based linux
I am trying to install/compile R-project software, I haven’t been succeeding. Debian-based linux distro. Follow the steps I’ve taken: 1- I downloaded the package R-4.1.1.tar. gz on the link:…
-
-1
votes2
answers31
viewsEdges with incorrect values
When running the code below, I do not get the expected graphic representation. Although A is connected to C with a value of 90.16 on Plot the link A - C is 80. Someone can help? library(igraph) df1…
-
-1
votes0
answers28
viewsI would like to join 5 databases that contain the same columns. However I would like to create a new column with data that are equal in 2 or more columns
I have 5 contacts reports that opened my company’s email shoots. The reports contain the same columns. I would like to join these 5 reports in 1 by just analyzing which client is in 1, 2, 3, 4 or 5…
rasked 3 years, 3 months ago Lucas Dias 1 -
-2
votes1
answer1068
viewsR code for likelihood testing
I have a data set to do a logistic regression for the dependent variable "parturition" which is binary qualitative. With the command below I get the univariate logistic model: GLM.1 <- glm(parto…
-
-2
votes2
answers144
viewsseparate columns and remove the letter t
data<-read.table("identified species.txt",header=T,Sep=",") dice Species........................ ... .com..... without 1 C. maculata t 1 T3 2 C. sanguinea t 26 t39 3 E. connexa t 20 T14 4 H.…
-
-2
votes1
answer131
viewsGenerate splitter list of a given number n
guru = function (n){ if (n>0){ x = (n%%(1:n) == 0) cat(x) } } So I need to create a vector that contains all the splitters of n, but when I test, with some value of n, it tells me logically if…
-
-2
votes2
answers144
viewsCreate an object that contains four words. Use the sample function to sample 1000 values of that object
...continue-Find out how to use the table function to know how many times each word was drawn. I created the four words that are "hi" "hi" "hey" and "hi" but when I tried according to an example I…
-
-2
votes1
answer66
viewsSame data set, two lines, two equations, on the same graph?
My data fits easily by a straight line, but even better by 2, dividing the data. I need to divide the data into 2 parts, thus: concentrations (x) up to 700 ppm and concentrations > or = 700 ppm.…
-
-2
votes2
answers96
viewsHow to determine a covariable in the ANOVA model (r)
I have the following model: modelo = aov(y ~ tratamento + idade, data = dt) How do I determine that the idade is a specific command, or the model understands the levels of the variable in question.…
-
-2
votes1
answer811
viewsHow to make loops in R
I’m working on climate data and I need to do a boundary analysis for every element of my database. I need to make loops because my database is too big, but I don’t know where to start. One part of…
-
-2
votes2
answers82
viewsWhat books do you recommend to study on data analysis in R?
I would like to study more on data analysis in the R and would like to book tips,.
-
-2
votes1
answer41
viewsRegression with part of the base
I have a base whose one column has three characteristics (strong, weak and moderate. How do I restrict regression so that the model considers only one of the dimensions?
rasked 5 years, 6 months ago Luiz Claudio Louzada 1 -
-2
votes1
answer48
viewsPreprocess function error not found
I installed the Caret package to perform the preprocess function, but it shows an error that it was not located. which may be?
rasked 5 years, 6 months ago Cintia Santiago de Moura 3 -
-2
votes1
answer297
viewsFilter with 2 variable conditions
I have two databases, the first one has about 30,000 lines the second 571. I need to filter the first with two conditions from the second bank. Condition A: fctr be == Condition B: date <= I…
-
-2
votes1
answer194
viewsSearch by API / JSON - Latam and Gol (Power BI)
Good Morning! Guys, I’m riding a Dashboard on Power BI, and I need to link it to the Gollog and Latam load tracking site. I already have the link to search the web service, but I do not know how to…
-
-2
votes1
answer187
viewsDownload API data that returns JSON format within XML
I am accessing a website that provides an API that returns the data in JSON format, but the data is returned inside an XML code in the format below: <string…
-
-2
votes1
answer385
viewsHow to create a categorical variable in R?
I have a base with columns: USUARIO, MÊS, ANO and compra_mês. I would like to create variables dummy based on compras_mês for USUARIO, every month of the year. USUARIO MÊS ANO compras_mês…
rasked 5 years, 9 months ago Izak Mandrak 1,059 -
-2
votes1
answer226
viewsHow to break caption text in R
I need to plot a legend that has a very large text. But the problem is that when I export the R figure, part of the text is outside the Plot area. I wonder if there is a way I break the text of the…
-
-2
votes1
answer63
viewsHow to obtain the R² and plot curve equation from the object created by the Mostest function
In the R, I surrounded the function Mostest of vegan package to verify whether the relationship between two variables had a hump shape. So far all right, I checked that in fact the curve had this…
-
-2
votes1
answer47
viewsSuccessfully recorded bank warning - R
Hello! I am currently recording/updating my tables in the database with the R language: dbWriteTable(con, "tabela",tabela, row.names=FALSE, overwrite = TRUE) This my script that updates the tables…
-
-2
votes1
answer69
viewsHow to turn all values of a data.frame into numeric?
I imported a database into R and when executing t() function to transpose rows and columns, all values that should be numerical were transformed into factor! How could I turn all the values of all…
rasked 4 years ago Lucca Nielsen 55 -
-2
votes2
answers81
viewsformat data from a column in a data.frame in R
How to put zeros on the left in a column of a data.frame. In this case, I would like to format the data so that it has 4 characters. That is, values of 24 would be left 0024.…
-
-2
votes1
answer28
viewsSum of 2 date.frame columns
I need to add two columns of a date frame.. Example: Preiso add all rows of the columns rural and urban. I tried the apply and rowsum codes and all gave error. Error apply: apply(educa[, 3:4], 2,…
-
-2
votes3
answers952
viewsHow to filter a range of values?
Hello, I have the following vector cvfm_multr =c(-0.332674874454252, -0.571035468021242, -0.676476547114675, -0.205905929370678, -1.21249714617946, 0.121238932104978, 0.310664697843136,…
rasked 5 years, 6 months ago Mariane Campos 141 -
-2
votes0
answers19
viewsloadWorkbook - R
Good afternoon, I am developing a code that performs the update of a spreadsheet called BD of a file . xlsx This file has several tabs, each with its specific formatting. I am having trouble keeping…
-
-2
votes1
answer47
viewsGenerate BEKK latex PDF and diagnoseBEKK of the 'mgarchBEKK' package
I want to generate in PDF latex the functions BEKK and diagnoseBEKK of the mgarchBEKK package, only that it comes out all disfigured. It follows from the data: > head(LOG1) [,1] [,2] [1,]…
rasked 5 years, 3 months ago Everton Toledo 113 -
-2
votes2
answers225
viewsLogic test inside the Python array
In the R I can have this structure var1 <-TRUE var2 <-FALSE paste0("ANO_544, SEMANA", if(var1 == TRUE){", COD_NEGOCIO"}, if(var2 == TRUE){", CATEGORIA"}, ", MODULADO") And I got an answer:…
-
-2
votes1
answer65
viewsWhat’s wrong with my K-Earest Neighbor code on R?
Good afternoon, Why does my KNN code in R produce "predictions" that are equal to the Test Base responses themselves? That is, if we change the responses of the test base the "forecast" changes…
-
-2
votes1
answer39
viewsHow to delete values in a text column from a csv file in R?
I am learning R and need help with CSV files. I can read the file but need to perform operations with a few columns: The file is like this: 1 {date:2018-08-01 state:RN store_id:3162633…
-
-2
votes3
answers339
viewsHow to convert the number of hours into date format in r
I have a column in this format and I can’t convert it to date. At this time it is in hours. Example: 8.5 is actually 08:30:00 and so on... Any idea how to do it? (see image) start_date <-…
-
-2
votes2
answers49
viewsCorrelation test on categorical data with low number of counts
I ran a correlation test on R and p-value was NA. Can someone explain this to me? It was correlating schooling with labor occupation of the person. Some labor occupation data are missing (NA in the…
-
-2
votes2
answers132
viewsHow to stratify (group) observations within a specific variable by more than one category in the R?
I am working with a table of bank branches by address in Brazil that has 20,580 observations and 15 variables. My goal is to create a new variable with the groups of the regions from the…
-
-2
votes1
answer50
viewsLoop to fill data returns only the last values
I need to create a program with functions, but I could not fix the repetition commands. Program: Read the number of students in the classroom. For each of the n students you must do the following:…
-
-2
votes1
answer38
viewsI would like to leave the data.frame without repeated elements used this code:
f<- c("Juca", "Sam", "Ze", "Anta", "Buddy", "Irma") f<- sample(f, 3, FALSE) a<- c("Juca", "Silas", "Ze", "Ziraldo", "bar", "Ramister", "Luizinho") a<- sample(a, 3,…
-
-2
votes2
answers22
viewsHow to save content from data sets to files dynamically?
I have an array with the name of my datasets and want to store the contents of them in files .csv individual dynamically. With the code below, the files are created, but instead of the content of…
rasked 3 years, 9 months ago Orson Galvão 3 -
-2
votes1
answer43
viewsHow to eliminate Labels and x-axis on an inverted bar chart?
I’d like to know how to delete Labels and the X axis line from the following inverted bar graph. . Because I think you have redundant information. dice Hi Lucas, thanks for the reply. Follow the…
-
-2
votes1
answer46
viewsHide part of a chart caption
I have a chart made with ggplot2, in the legend is appearing a size and I’d like to remove it, but I don’t know how. My code: updates %>% mutate(mortalidade = deaths / confirmed) %>%…
-
-2
votes1
answer55
viewsHow to plot Pcoa/MDS?
I’m trying to plot Pcoa, but the chart is coming out pretty slick. Before the Pcoa I did PERMANOVA using data of importance of 10 species of coastal vegetation as a function of 5 different…
-
-2
votes1
answer43
viewsWeb Scraping with Rvest - Problem with data scraping (links mainly)
I am trying to make a Web Scraping of the Web Site Of Science, but esstou facing problems with scraping links from the site. My intention is to scrape titles from the articles, links that direct to…
-
-2
votes1
answer35
viewsRepeat loop does not leave first position
The exercise is: Using the function repeat, gere 1000 samples of normal distribution, each of equal sample size n and mean and standard deviation parameters equal to µ and σ, respectively. Choose…
-
-3
votes1
answer72
viewsWhat does the following line on R do?
I’m having second thoughts about the following line: amostra = sample(2,40,replace = T,prob=c(0.7,0.3))? In particular the argument 2, the argument 40 and the replace.…
rasked 6 years, 6 months ago André Gusmão 7 -
-3
votes1
answer160
viewsConvert number to minute and subtract those minutes from a column containing date and time R
Good morning, I have a column (minutes1) that has data of the amount of min (105,90,80) I need to turn those minutes into hours (HH:MM), after which subtract these created hours from another start…
rasked 6 years, 1 month ago Luis Henrique 1 -
-3
votes1
answer102
viewsA - Adding values with one condition
Good morning ! I have the DF below, I need to add the values of the accounts (columns with numbers) SEMESTER 1 with the 2 (if you have), by CNPJ and YEAR. Thus, I will have the total values of the…
-
-3
votes1
answer37
viewsNumeric type, I can’t do a range
Good afternoon. I’m doing a simple range, and returns me NA. Any hints? is.numeric(df_1$VLR_FTRMTO) #[1] TRUE range(df_1$VLR_FTRMTO) #[1] NA NA head(df_1$VLR_FTRMTO) #[1] 36627192 13165967 63455580…
rasked 4 years, 4 months ago Angelo Buso 53 -
-3
votes2
answers67
viewsHow to group by text [R]
I have a column in the dataset that has several variants of 5 options. I wanted to group based on what you have written in common. For example: coluna1 lapis vermelho grande lapis azul grande lapis…
-
-3
votes1
answer39
viewsHow do I interact specific values of a dataframe with a function?
Idade AT.49M AT.83M AT.2000M 0 0.00404 0.00269 0.00231 1 0.00158 0.00105 0.00091 2 0.00089 0.00059 0.00050 3 0.00072 0.00048 0.00041 4 0.00063 0.00042 0.00036 Having this dataframe run the function…
-
-3
votes1
answer26
viewsHow to consist of a data frame against a valid value array?
I have an array of all possible values that appear in a set of columns of a data frame. The number of components in the vector is different from the number of observations of the data frame. My goal…
-
-3
votes1
answer69
viewsI need to attend the Anvisa Gui 10 that asks for a specific weighting
Guide 10 of the National Health Surveillance Agency recommends that if the residual variances are heterocedastic we must use the following weighting factor: wi=((1/Si^2)/((Somatório de 1/Si^2)/n) My…
rasked 4 years, 1 month ago Guilherme Portilho Carrara 13