knitr to PDF not wrapping comments
When trying to knit my Rmarkdown files to PDF, knitr doesn't seem to wrap the comments and the text just goes outside of the pdf margins.I have tried specifying several parameters but nothing seems to...
View ArticleGet nodes from a html webpage to crawl URLs using R
https://i.stack.imgur.com/xeczg.pngI am trying to get the URLs under the node '.2lines' from the webpage 'https://www.sgcarmart.com/main/index.php'library(rvest) url <-...
View Articleno non-missing arguments to min; returning Inf
I'm assuming this question pops up quite often and most are related to ggmap-related issues.However, when I was browsing an example data (Advertising data from Gareth James et al.'s ISLR), which does...
View ArticleData frame output not matching expected output
I have a function which takes a data frame and gives basic summary statistics. My problem is, the function output is not matching the expected output.# create my data frame x = c(55.3846, 54.5385,...
View ArticleHow to adjust transparency of inactive series in highcharter with R
I am using the R package {highcharter} to make a plot similar to this highchart steamgraph.So far, no major issues. However, I cannot replicate the nice fade animation which occurs with hovering the...
View ArticleWhy doesn't kmeans find the 3 clusters?
I run a kmeans on a 3 dimensional dataset and get the following result: Code as followed:library(tidyr) setwd('C:/temp/rwd') getwd() df <- read.table('data-1581352459203.csv', header = TRUE, sep =...
View ArticleFilter and group by with data.table
I have the following data.table:DT <- data.table(name = c('ana', 'ana', 'ana', 'ana', 'justin', 'justin', 'justin', 'justin'), age = c(12, 26, 24, 14, 28, 36, 17, 8)) I want to be able to group by...
View ArticleCreate timestamp columns based on multiple filtering conditions (R, dplyr)
I have a dataset, df Read Box ID Time Subject T out 10/1/2019 9:00:01 AM T out 10/1/2019 9:00:02 AM Re: T out 10/1/2019 9:00:03 AM Re: T out 10/1/2019 9:02:59 AM Re: T out 10/1/2019 9:03:00 AM F...
View Articleis there a way to search specific word in a twitter timeline over a period of...
I am doing some twitter analysis in R, right now im getting the tweets from an account, but i want to search for 1 or more specific words inside those tweets and then do a plot that shows how much has...
View ArticleR - split string confidentiality to columns
my dataframe looks like sort of this df <- data.frame( id = seq(1, 5, 1), acc = c(NA_character_, "115-7981987/7121", "48415875/4874", "8740-454648484/100", "18715/7811") ) I'd like to crate 3 new...
View ArticleHow to replace a value in a binary file in R?
I have to work with a (custom) binary file format. The data are too big for my RAM and I just need to import a small part of them, do some calculations and overwrite/replace this part with the new...
View ArticleJoin tables by ID and adding its to new column in dplyr
I have four differnet data frame by years (2015-2019), with variables: ID_patient(maybe duplicate), Treatment, date of start treatmen and date of end treatment and etc. (acctually it's 7 variables)...
View Article0 rows when merging data.frame in R
Basically every time I try to merge the two data frame I get back a merged data.frame with 0 rows.The two data frames have different number of rows (one 122 the other 112), different numbers of columns...
View ArticleHow to get the array with condition in R? [duplicate]
I have a data set something like this: ~product_name, ~id, ~clicks, "A", 1, 1, "A", 4, 1, "A", 3, 1, "B", 4, 2, "B", 6, 2, "C", 3, 3, "C", 5, 3, "D", 6, 4, "D", 4, 4, "D", 3, 4, ) Now, I want to...
View ArticleGeostatistics dataset: finding the closest ten observations at a new coordinate
I have a geostatistics dataset Y(x,y) where x and y are the coordinates and I want to find the 10 nearest observations to the new location (x* ,y*). Is there any available package in R that gives me...
View ArticleHow to rename all column names in tibble by passing a character vector?
I have a tibble named X of multiple columns (over 500) which are named in format of "X"+integer. The tibble looks like this.# A tibble: 7,352 x 561 X1 X2 X3 X4 X5 X6 <dbl> <dbl> <dbl>...
View ArticleLinking valueBox title to different tabPanel
Suppose you have a basic shinydashboard app with two tabPanels within a tabBox:library(shiny) library(shinydashboard) ui <- dashboardPage( dashboardHeader(title = "Basic dashboard"),...
View ArticleProblem with a column of XLSX in R script. It reports NA or other error. Exam
I Need a really big help, I have a problem with a dataset in xlsx that I have to analyze for an exam at university. Below I have pasted the link of the dataset and the R script that I wrote for the...
View ArticlePIT plot for multilevel models
I realized a poisson multilevel analysis with randon effects, using the package glmmtmb, and now I'd like to check the adjustment with PIT histogramIs there any function that plot the Probability...
View ArticleBinning data in R with the same output as in spreadsheet
I have this sample data:set.seed(25) xx <- data.table( year = 2015, values = iris$Sepal.Length, score = sample(1:8, nrow(iris), replace = TRUE)) The actual data contains many years and rows. I...
View Article