Scaling 2 types od Ranking in R
I am trying to perform analysis for some data. There are variable that is called University ranking and its range is 1-800 and in addition I have another variable called country ranking and its range...
View Articledata.table linearly interpolating NA values without groups
i wanted to fill some NA values in a data.table without groups. Please consider this extract of data.table representing time and...
View ArticleAdjusting Title & Figsize in R
For this problem I am required to use ggplot2 and ggplot2 only. I have a barplot similar to the one below: I would like to insert a title on the upper left corner but somehow it keeps ending up in the...
View ArticleExporting texts and datatable from shiny to pdf
I am trying to write an app for work to allow some simple advice for patients on certain drugs to be presented in a datatable format, with the option to add some additional text. I've looked around to...
View Articlemodify function to find the maximum length for a consecutive run of a number...
I would like to modify the answer to the question here or have a new solution to include another column which shows the second largest consecutive run of "0". My sample data and code is below, the...
View ArticleHow do I vertically center numbers on an histogram plot in R?
How do I center numbers on columns?bar <- barplot(VADeaths) text(rep(bar,each=nrow(VADeaths)),as.vector(apply(VADeaths,2,cumsum)), labels=as.vector(apply(VADeaths,2,cumsum)), pos=1,cex=1,adj =...
View ArticleR - post select specific columns in an interactive datatable
I have a dataset that let's say has two columns. One column is for score and the other is for the actual value. I would like to colour the actual value column based on the score column, then remove the...
View ArticlePattern matching is failing due to apparent encoding problems with scraped text
I would like to perform topic modeling on a collection of online sermons that I scraped using rvest.I am cleaning and organizing using pattern matching, especially grepl.The problem is that grepl fails...
View ArticleHow to replace values with NA in data frame or list without changing the...
I want to fill the first n objects in my list or the first n columns in my data frame with NA values without changing the class of the objects. The problem is the following: d <-...
View ArticleOnly NaNs in accuracy table in forecasts using fable package
I am trying to run some forecasting models using fable package. The forecasting mable is as follows,> fit1 # A mable: 3 x 4 # Key: series.id [3] series.id arima ets snaive <int> <model>...
View ArticleHow can I do a scatterplot like this?
I need to make a scatterplot like this: I can not find any information about how can I make a scatterplot like this with 2 lines,dots. Any ideas?
View Articleggraph: Vertex position according to attribute
Suppose I have an igraph graph like the following:library(ggraph) library(igraph) vertices <- data.frame(name = LETTERS[1:6], time = c(0, 9, 9, 10, 10, 10)) edges <- data.frame(from = c("A", "B",...
View Articleggforce geom_circle jagged and ugly looking
I'm trying to use ggforce to create a Venn - like plot overlay, but the circles are coming out looking pretty horrible. Is it possible to improve their smoothness? I have tried increasing n (number of...
View ArticleShiny app fails after successful building of reports
I have a shiny app (gists below)failing server.Rfailing ui.Rthat takes input, queries a database, builds an .Rmd file into a beamer presentation, and writes out an .xlsx file of data. All of these...
View ArticleEstimating within-between model specification using plm
Is it possible to include one time-invariant variable in a two-way fixed effects model in plm?Model set up:`m3 <- plm(habi5 ~ habi1 + habi3 + econ1 + gov1 + gov2 + gov3 + gov4 + soci1 + soci3 +...
View ArticleR histogram add label with percentage instead of rough values
I want to use hist() to make a histogram using percentages.However, I also want to place a label at the top of each histogram bar showing the actual percentage.Here is my code and a link to the...
View ArticleHow to include hover in a plotly layout element
I am stuck with the following plotly example which I would like to exploit:library(plotly) p <- plot_ly(economics, x = ~date, y = ~uempmed, name = "unemployment") # add shapes to the layout p <-...
View Articleread_html for vector element and for character
I have vector of URLs, from where I need to get some text.I use rvest and this code:r <- getURL(queries[2]) pages_data <- read_html(r) %>% html_nodes(".bloko-button.HH-Pager-Control") %>%...
View ArticleAccess name of the object that "i" represents when it iterates in a for-loop...
I have:directories (let's say two: A and B) that contain files;two character objects storing the directories (dir_A, dir_B);a function that takes the directory as argument and returns the list of the...
View ArticleTranspose coordinates from pdf map onto satellite raster image
I have a map in a PDF file with boundaries that I want to plot onto a satellite image.I have made a screenshot, saved it as tiff and imported it as a R raster object. Using click I have outlined the...
View Article