Posts by Izak Mandrak • 1,059 points
38 posts
-
2
votes1
answer77
viewsQ: How does it work and how to use the Reprex function of R?
In researches right here in Sopt I saw suggestions of reproducible examples. One of them was the function reprex(), I researched about and saw that its use is specific for HTML, Github and here in…
-
3
votes1
answer138
viewsQ: How to avoid displacement of a forecast using ARIMA?
I created a prediction model on R using ARIMA with a 2-year daily historical basis (2018-2019). In this model I use Multivariate Analysis to create predictions. dados = dados_dput QTD_PED_TS =…
-
12
votes1
answer572
viewsQ: Why should we scale/standardize values of variables and how to reverse this transformation?
When working with multivariable prediction algorithms I came across the function scale of the R, whose objective is to scale/standardize the values of the variables. I have no difficulty in using…
rasked Izak Mandrak 1,059 -
4
votes1
answer150
viewsQ: How to transform an English standard date into a Brazilian standard date in R?
Suppose I have a date in the standard English format year-month-day (ymd): data = Sys.Date() print(data) [1] "2019-12-03" But I really need this date to be in the Brazilian standard day/month/year…
-
4
votes2
answers826
viewsQ: How to define the number of clusters in the Kmeans algorithm in R?
I’m studying the grouping algorithm Kmeans, and as a database for my study, I’m using the iris. base = iris The algorithm itself I managed to use without problems: base2 = base[3:4] kmeans =…
-
3
votes3
answers309
viewsQ: How to replace variables with NEGATIVE values with their ABSOLUTE VALUE within a date.frame in R?
First of all, what is an Absolute Value? We can say that the Absolute Value or Module is the same as the distance from a real number to zero, because the module of a real number arose from the need…
-
3
votes2
answers909
viewsQ: How to replace variables with NEGATIVE values with ZERO within a date.frame in R?
Let’s say I have a 6x5 data.frame, for example: print(Dados) Linha A B C D E L1 4 3 -1 2 4 L2 1 -2 1 -5 1 L3 -1 -1 2 3 4 L4 2 4 5 -7 9 But I want to replace the Negative values of the data.frame…
rasked Izak Mandrak 1,059 -
4
votes1
answer417
viewsQ: How to use auto.Rima to predict 24 periods or more in R?
I made a prediction using the auto.arima where my database is monthly values from Jan/2018 to Sep/2019. My training base is from Jan/2018 to Jun/2019: VL_TR_treino_5S = window(VL_TR_TS_5S,…
rasked Izak Mandrak 1,059 -
1
votes1
answer558
viewsQ: How to load an Oracle database into R?
I have access to an Oracle database, but have always used this data in the R using the PL/SQL to extract the data in csv. But now I would like to connect my Oracle database on itself RStudio. After…
-
3
votes1
answer732
viewsQ: How to convert million units into dozens unit in R?
Suppose I have the number 80 million. Numero = 80000000 print(Numero) [1] 8e+07 Because it is a large number the R already shows me in Scientific Number, but I would like to convert that number that…
-
-1
votes1
answer397
viewsQ: How to create charts using time series showing every month on the x-axis in R?
Suppose I have the following time series: PREVISAO_VL_TR = ts(PREVISAO_VL_TR, start = c(2019,1), end = c(2019,12), frequency = 12 ) And that now I would like to create a chart of this time series:…
-
0
votes1
answer61
viewsQ: How 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 Izak Mandrak 1,059 -
1
votes1
answer399
viewsQ: How to perform a prediction using Multivariate Linear Regression model in R?
I am studying solutions to perform a prediction of a product that depends on other variables. In this my study I am using as my database Seatbelts, a Time Series that is already native to R. Which…
rasked Izak Mandrak 1,059 -
1
votes3
answers1493
viewsQ: How to number lines of a data.frame in R?
Assuming I have the following date.: print(DADOS) letra N1 N2 N3 N4 A 2 3 4 4 A 1 2 3 4 A 2 2 1 3 B 0 1 2 0 C 4 4 3 2 C 2 2 2 2 D 4 3 2 1 D 1 0 1 4 E 4 4 4 4 How can I number the lines of my…
rasked Izak Mandrak 1,059 -
4
votes3
answers2072
viewsQ: How to join two data.frames of different sizes per column in R?
Suppose I have two different date frames.: print(DADOS_1) linha coluna1 coluna2 1 1 3 2 3 4 3 1 1 4 2 2 print(DADOS_2) linha coluna3 coluna4 1 3 1 2 2 2 3 5 0 4 2 4 5 1 3 6 3 1 I need to unite…
rasked Izak Mandrak 1,059 -
2
votes1
answer140
viewsQ: How to turn my data.frame variable values into columns in R?
Suppose I have the following date.: print(DADOS) CODIGO QTDE MÊS 001 4 1 001 1 1 001 3 2 001 2 3 001 3 3 001 4 3 001 2 4 001 2 4 001 1 5 001 5 6 001 2 6 But I need to turn the values of the variable…
rasked Izak Mandrak 1,059 -
1
votes4
answers1763
viewsQ: How to know which is the largest variable of a vector in R?
Suppose I have the following variables: x = 2 y = 3 z = 5 And turn them into a vector: vetor = c(x,y,z) I thought I’d use the function max: max(vetor) [1] 5 But if I use the function max returns a…
-
2
votes1
answer1112
viewsQ: How to calculate MODA with bimodal value in a date.frame in R?
I need to calculate the MODA of online values in a data.frame. As in R there is no function already set for FASHION, I used a custom function: moda = function(x) { z = table(as.vector(x)) names(z)[z…
-
2
votes2
answers373
viewsQ: How to calculate the average excluding zeroes in R?
I averaged the following values: MÉDIA = mean(c(12,20,15,0,7,0)) print(MÉDIA) [1] "9" But I need the average that doesn’t consider zeroes: MÉDIA_Sem Zeros = mean(c(12,20,15,7)) print(MÉDIA_Sem…
-
3
votes3
answers5381
viewsQ: How to replace variables with NA values with ZERO within a date.frame in R?
Let’s say I have a 6x5 data.frame, for example: print(Dados) Linha A B C D E L1 4 3 NA 2 4 L2 1 NA 1 NA 1 L3 NA NA 2 3 4 L4 2 4 5 NA 9 But I want to replace the "NA" values of the data.frame with…
rasked Izak Mandrak 1,059 -
1
votes2
answers153
viewsQ: How to delete and then create all variable names in a data.frame in R?
Let’s say I have a data.frame 6x5, for example: print(Dados) Linha A B C D E L1 4 3 2 2 4 L2 1 11 1 1 1 L3 0 1 2 3 4 L4 2 0 0 8 0 But I want to exclude the "head" of data.frame, i.e., exclude the…
rasked Izak Mandrak 1,059 -
1
votes1
answer1547
viewsQ: How to change the date format from "year/month/day" to "year/month" in R?
Suppose I have a date in the standard English format "ymd", example: Sys.Date() "2019-04-11" Since for my analysis I do not need this date to have the days and I decide to remove them, so that it…
-
1
votes1
answer826
viewsQ: How to filter data in a data.frame using a certain amount of time in R?
Suppose I have one data.frame four-column: print(Dados) CLIENTE QTDE VALOR$ DATA_COMPRA 1234 2 50 2019-02-04 4586 1 70 2019-01-17 6535 3 25 2018-12-28 9562 1 150 2018-12-25 3478 7 12 2018-10-12 2684…
-
2
votes1
answer207
viewsQ: How to select the last 3 columns in a data frame in R?
I have a database that is updated monthly, which has 7 columns: USUÁRIO, and the last 6 months of the year with the amount of purchases for each month. Following example: print(DADOS) USUÁRIO JAN…
rasked Izak Mandrak 1,059 -
1
votes1
answer160
viewsQ: How to decompose a time series using a frequency of 6 months?
I have a sample of data with the period of one year. I Gero the time series without problems with the frequency = 12, but when will I use the decompose it shows the following error message: Error in…
rasked Izak Mandrak 1,059 -
6
votes7
answers1523
viewsQ: How to calculate the median of a line in a date.frame in R?
I have a database and my goal is to perform some behavior analysis of classes per line. Example: print(DADOS) Linha A B C D E L1 4 3 2 2 4 L2 1 11 1 1 1 L3 0 1 2 3 4 L4 2 0 0 8 0 Using the example…
-
4
votes1
answer704
viewsQ: How to extract the week number of the month in R?
I’m having trouble extracting the week number of the month from a specific date. Example: hoje = Sys.Date() print(hoje) [1] "2019-02-11" In the example of the date above, hoje would be the 2nd week…
-
2
votes1
answer254
viewsQ: How to make the difference between two data.frames in R?
I created two data.frames: the first data.frame that comes from an original basis and the second data.frame which originates from the first, but with the application of a filter. Example:…
rasked Izak Mandrak 1,059 -
1
votes2
answers812
viewsQ: How to count the number of frequencies for each column in a date.frame in R?
I need to count the number of frequencies in each month, where each month is represented by a column: USUARIO jan fev mar abr mai jun jul ago set out nov dez 1160 0 1 1 1 1 1 1 1 1 1 1 1 2505 1 1 1…
rasked Izak Mandrak 1,059 -
-2
votes1
answer385
viewsQ: How 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 Izak Mandrak 1,059 -
3
votes3
answers2296
viewsQ: How to format a "date" column inside of a data.frame in R?
I’m having trouble formatting a column with dates in my database. Example: 01/08/2018 06:02:44 I would like to format the column by removing the team and in another column indicate the corresponding…
-
2
votes6
answers31940
viewsA: How to remove a data.frame column in R?
Hello. I usually use the command select: install.packages("dplyr") library(dplyr) dados = dados %>% select(x, y, z) Using your example, I use the select to select only the columns that interest…
ranswered Izak Mandrak 1,059 -
5
votes2
answers661
viewsQ: How to transform the class of a "factor" column into "date" within a data.frame?
I have a base extracted in csv (dados_base), with the period from Dec/2017 to Jan/2019, which has three columns: USUARIO, DT_PAGTO and VL_PED_PG, where the first field represents users with the…
-
2
votes2
answers689
viewsQ: How to create Time Series using Start and End in R?
I’m trying to do a time series with a six-month data sample doing the following: compras = ts(dados_dia$QTDE_COMPRAS, start = c(2018,7), end = c(2019,1), frequency = 90) But by making a…
-
0
votes2
answers86
viewsA: How do I search to find which files have a particular word?
Hello! I don’t know if it’s exactly what you need, but you can use the Ctrl + L to search for a keyword or part of it. Select Ctrl + L and type função abc(), will show the exact location of the…
-
0
votes2
answers930
viewsA: Error "invalid input '.. 'in utf8towcs" with "read.csv"
Hello! I use the file.choose() for myself to select the file. install.packages("dplyr") library(dplyr) dados = read.csv2(file.choose(), header = T) print(dados) The read.csv2 already separates csv…
-
2
votes1
answer842
viewsQ: How to summarize data in R?
I have a sample of shopping data and would like to know how many purchases had per user in total. dput to assist response: structure(list(USUARIO = c(931053L, 276977L, 354508L, 909717L, 69758L,…
-
1
votes1
answer896
viewsQ: How to generate and decompose a Time Series in R?
I’m having trouble generating and decomposing a Time Series. In this case, I was able to create a time series ts, but when I went to decompose the series decompose, indicates that there is an error…