r - 'Select All' checkbox for Shiny DT::renderDataTable

I want a checkbox that selects all the rows displayed (displayed is key as this differs between the filters you have applied and the entire data table) in a standard DT::renderDataTable in Shiny.Is there any DT extension that already does this? My coding skills are basic so I cannot write an equivalent Java or HTML code.This is my app so far, any csv file is compatible for the select all purpose. At the moment there is a clunky way of creating another table of all the selected rows (manually selected one by one) - this is difficult when you wan...Read more

r - How to import most recent csv file into RStudio

I'm attempting to import the most recent .csv from my working directory into R. Adamant this method was working previously but appears to no longer be.Each day a .csv file is outputted to my designated folder, from where I import it into RStudio for manipulation. There are 2 files in this folder currently.Please see code and description as follows:1) Following code retrieves names of all csv files in directory.# find filenames of all .csvs in directory filenames <- Sys.glob("*.csv")> filenames[1] "February 26, 2018 at 03:59PM myfile.csv" ...Read more

r - Why does the ngrams() function give distinct bigrams?

I am writing an R script and am using library(ngram).Suppose I have a string,"good qualiti dog food bought sever vital can dog food product found good qualiti product look like stew process meat smell better labrador finicki appreci product better"and want to find bi-grams.The ngram library is giving me bi-grams as follows:"appreci product" "process meat" "food product" "food bought" "qualiti dog" "product found" "product look" "look like" "like stew" "good qualiti" "labrador finicki" "bought sever" "qualiti product" "better labrador""dog food"...Read more

n gram - ngram text to be as separate column in R

I got list of several text got from ngram, and want to add to original datatable as columns.> prep_test prep_test 1: Women Athletic,Athletic Apparel,Apparel Pants,Pants Tights,Tights Leggings 2: Beauty Makeup,Makeup Face 3: Beauty Makeup,Makeup Face 4: Electronics Cell,Cell Phones,Phones Acce...Read more

r - Read characters individually from a list

I have a big list of characters (250*5000), and I need to read 7 at a time. So I want to read 1-7 then 2-8 , 3-9 etc so I can compare those to a vector of mine. My code so far is this library("affy")? ReadAffylist<-seq5000##list<-read.table("C:\\Users\\user\\Desktop\\mike\\seq5000.txt")##lista<-c(list)...Read more

R merge pdf into one pdf

I have a folder which contains around 400 .pdf files, each .pdf file is 2 pages total.All .pdf file names are under the following format: 148-c16631-27-02-2018.pdfWhat I would like is to merge under one pdf file, the pdf files that have a certain code in the file name in R. For instance:148-c16631-27-02-2018.pdf148-c14369-27-02-2018.pdf148-c101593-27-02-2018.pdfThese have the code 148 which is unique, to be merged into 1 pdf file with 8 pages.Thank you in advance for any input....Read more

function - Is it possible to include >=, <= operators when using setkey with data.table in R?

I'm looking at this brief tuto for data.table I get stuck when the author talks about setkey() I will put my example. I work with iris database so it can be easy replicatedmydata <- variable namesmydata <- setnames(mydata, c("Sepal.Length","Sepal.Width", "Petal.Length", "Petal.Width", "Species"), c("sepal_length", "sepal_width", "petal_length", "petal_width", "species"))Now I will use a factor variable and a numeric variable as keys:setkey(myd...Read more

Points in a scatterplot with individual ellipses using ggplot2 in R

My dataset is formed by 4 columns, as shown below:The two columns on the left represent the coordinates XY of a geographical structure, and the two on the left represent the size of "each" geographical unit (diameters North-South and East-West)I would like to graphically represent a scatterplot where to plot all the coordinates and draw over each point an ellipse including the diameters of each geographical unit.Manually, and using only two points, the image should be like this one:How can I do it using ggplot2?You can download the data here...Read more

r - How to silence or suppress gfortran (or clang?) backend in conda?

I have been working on building a very particular conda environment designed for python and R with cross-talk using rpy2. The recipe I came up with that works to install the proper R packages is the following:# install_main_environment.shnow=$(date +"%T")echo "Start Time: $now"## Create Main Environment (OSX-64)conda create -n python3 python=3 --yessource activate python3## Jupyterconda install jupyterlab --yes## Rconda install -c r r --yesconda install -c r r-essentials --yesconda install -c r rstudio --yesconda install gfortran_osx-64 --yesc...Read more

r - Filter rows by a time threshold

I have a dataset organized this way:ID Species DateTimeP1 A 2015-03-16 18:42:00P2 A 2015-03-16 19:34:00P3 A 2015-03-16 19:58:00P4 A 2015-03-16 21:02:00P5 B 2015-03-16 21:18:00P6 A 2015-03-16 21:19:00P7 A 2015-03-16 21:33:00P8 B 2015-03-16 21:35:00P9 B 2015-03-16 23:43:00I want to select independent pictures for each species (that is, pictures separated from each other by 1h), in this dataset with R. In this examp...Read more

r - plot histogram that visualizes each observation whose color is mapped to a second variable

I'm looking for a way to show a histogram of values (time2) with binwidth equal to 1, I think, and have the color of each observation ("count") be mapped to a second variable (diff).df <- data.frame(person=seq(from=1, to=12, by=1), time1=c(9, 9, 9, 8, 8, 8, 8, 7, 7, 6, 6, 5), time2=c(9, 4, 3, 9, 6, 5, 4, 9, 3, 2, 1, 2))df$diff <- df$time2-df$time1I've not come across a plot like this before, and I don't know of a way to implement this is ggplot2. Any ideas? This toy example shows the distribution of values ...Read more