Is it possible to import and display a plotly graph saved as an html file...
I am new to programming, so forgive the question if it seems simple. I am attempting to import an interactive graph I plotted using the plotly graphing library and display it in the Jupyter notebook....
View ArticleGetting observations until and including first different value (groups with...
I have a slightly convoluted way to slice a data frame by group from the first row (it always starts with the same value) till (and including) the first different value. I though about using...
View ArticleGgplot with a separate geom_vline for each group
I have around 160 countries (output$ccname), log GDP (output$lnrgdpch), output$endyear as year variable and a binary variable for when a leader died (1= died) output$natural2. I am trying to create...
View ArticleSet same y-lim for multi panel plot using plot_model()
I have created a multi-panel plot using plot_model(). However, the scale limits on the y_axis came different for each panel. I first run a model fm then plot the predicted values:p <- plot_model(...
View ArticleWhy isn't my random walk simulation working correctly?
I have written the following code to simulate an unbiased random walk on Z^2. With probability 1/4, the "destination" is supposed to move one unit up, left, right, or down. So I made "destination" a...
View Articlewhat does the R shorcut `[[` mean?
I'm adapting the sapply function from someone else's script to pull in multiple spreadsheets and apply the site number to each item in the list (e.g. 124001B_calibrated.csv should become 124001B). My...
View Articlewhat if data to big for 1 reducer (RHadoop)?
i'm new to big data and hadoop thing. I try to find median with mapreduce. From what i know, mapper pass data to 1 reducer then 1 reducer sort and find the middle value using median() function. R...
View Articleskipping NULL output in apply
When using apply in R, is there some way to have it skip over vector elements that are NULL, such that when f(x2,y2) is undefined apply(x,1,f,y) returns c(f(x1,y1),f(x1,y2),f(x2,y2)) rather...
View Articlesummary.manova error exact singularity in 'qr.coef'
R code: summary(manova(y~x),test="Wilks", tol=0) Error: Error in qr.coef(rss.qr, D %% ss[[i]] %% D) : exact singularity in 'qr.coef'For MANOVA, we need to calculate the inverse of (E+H) matrix. But in...
View ArticleChoropleth Map in R with TIGER polygon data - blank spaces
I am trying to create a choropleth map in R using zipcode polygon data from TIGER database (using a response posted previously). The issue I am running into are large areas of the map that are blank. I...
View ArticleUsing for loop to creat multiple ggplots
p[[2]]<-ggplot(data = icadata, aes(x = icadata[[2]])) + geom_histogram() p[[3]]<-ggplot(data = icadata, aes(x = icadata[[3]])) + geom_histogram() p[[4]]<-ggplot(data = icadata, aes(x =...
View ArticleGenerate a list of tibble from a tibble by using map and select
I want to generate list of tibble fron one tibble in the following codes.tbl = tibble(id=1:10, a = rnorm(10), b = rnorm(10)) tbl_list = c("a", "b") %>% map(~ tbl %>% select(c("id", .))) The...
View ArticleR- delete the tail word
Can someone teach me how to delete tail word ,thanks.from 1 North Africa 2 Algeria 3 Canary Islands (Spain)[153] 4 Ceuta (Spain)[154] to 1 North Africa 2 Algeria 3 Canary Islands 4 Ceuta I'm sad with...
View ArticleChange pageType in DT pagination in R-Shiny module
Currently, I am designing an R-Shiny module that produces a DT table that includes paging. By default, DT default paging type is "simple_numbers". My goal is to change the default paging type to...
View Articlehow to sum based on three different condition in R
mydata is as follow:gcode code year P Q 1 101 2000 1 3 1 101 2001 2 4 1 102 2000 1 1 1 102 2001 4 5 1 102 2002 2 6 1 102 2003 6 5 1 103 1999 6 1 1 103 2000 4 2 1 103 2001 2 1 2 104 2000 1 3 2 104 2001...
View ArticleDT datatable transparent in Rmarkdown html reports
I need a watermark on my html output Rmarkdown but it is masked by the datatables.There might be a simple answer but i don't know Javascript yet. Any tip?I have tried using formatStyle but it doesn't...
View ArticleChrome adds unwanted margins to xaringan rmarkdown output
I am trying to print a PDF of a xaringan markdown that I have created. When I open up the html created by the R markdown, it renders perfectly fine in my browser. However, when I go to print it as a...
View ArticleReversed Stacked bar chart in R leads to weird positioning
I am trying to create a stacked bar plot in R, and to reverse the order.df <- structure(list(HouseholdEarnings = structure(c(2L, 2L, 3L, 3L, 3L, 2L, 2L, 1L, 4L, 2L, 3L, 6L, 5L, 4L, 2L, 1L, 2L, 3L,...
View ArticleHow do I plot error bars from a second dataframe of summary stats onto my...
I've got my plot how I like it as far as the raw data is concerned. Basically I want something like a bar chart but instead of a filled in bar you can see the raw data points and their confidence...
View ArticleRemove first columns of every tibble in list in R
I have a list with several tibbles comprising several columns; and I want to remove the first 2 columns in each tibble (not using for loop). #Example data with tibble and list w <- c(1, 2, 3, 4, 5)...
View Article