"'X' and 'Y' lenghts differ" Error in RStudio
I have a dataset of 503 numbers ranging from -0.8 to 2.7 down one Excel column. I'm looking to sample the normal distribution by using dnorm through the following:plot(x=seq(from=-1,to=3,by=0.01),...
View ArticleBar Chart in R - I can do this in Python and Tableau but having trouble in R
Trying to build a simple bar chart in R. This is the link to the data (https://data.world/makeovermonday/2020w3-is-it-time-to-treat-sugar-like-smoking) I need to build a simple bar chart that shows...
View ArticleR Shiny - Coding for regular API JSON update
I am attempting to code a Shiny application that hits a JSON API as its main data source. The app would hit the API once per minute to retrieve updated data in JSON format, then use jsonlite package to...
View ArticleNeed to separate strings into multiple variables based on numeric versus...
I have a data frame with one variable. It looks something like this:df <- data.frame(c("25 Edgemont 52 Sioux County", "57 Burke 88 Papillion-LaVista South")) To provide more context, each...
View ArticleHow to set a code to automatically add today's date to a filename?
Every day I have to change a date "YYMMDD" manually then run a code. I would like to find a way to make this change automatically. So I can just run the code without having to manually enter today's...
View ArticleAdd an indication arrow inside DT cell which will show trend for each time...
I created a shiny app which uses the dataframe below to summarize by Dealer showing previous day count of name and last 3 days count of name based on the fact that we are in the most recent date...
View ArticleExcluding sheets in readxl
I have data that comes in Excel spreadsheets, with a varying number of sheets. Rather than reading all the sheets, as has been explained elsewhere, I would like to exclude the first sheet when...
View ArticleHow to show labels in geom_text that is proportional to geom_bar group variable
I have been trying to output in ggplot a graph that shows labels in percentage value and in proportion to the grouping factor defined in geom_bar. Instead of % values proportionate to the overall...
View ArticleR Forecasting in Excel using the BERT console
Does anyone know how I can use the "forecast" function from R in Excel through the BERT console? I tried writing the following function:Forecast.sea <- function(x,h){ ts.data <- predict(x,h)...
View ArticleMatch and replace string using REGEX in Sqlite?
I have a table called personal_websessions that contains data in the following format: id_no | website_link 1 | google.com 2 | stackoverflow.com 3 | msn.com You can create this table using the...
View ArticleHow to make a data frame selecting shiny app in R?
I have a data frame with three columns:x = data.frame(group=c("group1", "group2", "group3","group1","group3", "group4", "group2"), user=c("user1", "user3", "user5", "user9", "user14", "user18",...
View ArticleAdd arrow indicator in the 1st row of a dataframe instead of the second
I have the shiny app below which compares the values of the 1st row with the values of the 2nd and then displays arrows in the 2nd row. How can I apply this in the 1st row instead of the 2nd? I used...
View ArticleR: Combining dataset and lookup-table to extract value to new colume
I want to combine to dataframes, df1 with 15.000 obs and df2 consisting of 2.3 mill. I'm trying to match values, if df1$col1 == df2$c1, AND df1$col2 == df2$c2, then insert value from df2$dummy, to...
View Articlefunction importance for randomForest package
I wanted to use the Random Forest to find the most important features for a classification problem (I have two classes: 0 and 1). I created the model:rf = randomForest(y ~ ., data = df,...
View ArticlePlotting different rows as different lines in R with matplot
I would like to plot different rows as different lines in the same plot to illustrate the movements of the average development of 3 groups: All, Men and Women. However, I'm not getting one of the lines...
View ArticleFlow duration curve using facet_wrap of ggplot in R?
I am using fdc of hydroTSM package. I have three data.frame and i would like to construct Flow duration curves (FDC) of the data.frame using facet_wrap functionality of ggplot to have the plots in...
View ArticleError when trying to fit data to gamma distribution
Here is my code:data("airquality") head(airquality) Solar <- airquality$Solar.R library(fitdistrplus) fit.solar <- fitdist(Solar, distr = "gamma", method = "mle") Any thoughts? Thank you!
View ArticleIn R, can you write data from SentimentR to a csv file?
I'm currently using the following scriptlibrary(sentimentr) decpir <- read.csv("decpir.csv", header = TRUE, stringsAsFactors = FALSE) results <- sentiment(decpir$Text) I'd like to write the...
View ArticleReplace substring if contained in larger string in R
I have a data frame with a column that contains SQL queries. I have a second data frame that has Old Variables to search for in the SQL query and two possible New Variables to replace with. If the Old...
View ArticleR httr::GET - Browser out of date
I have a problem when I try to get a page using the package httr. I'm try to get this page with the follows command:r <- GET("https://www.reclameaqui.com.br/empresa/madeiramadeira/",...
View Article