Error loading tidyverse in R Studio - No broom package

I'm getting numerous errors when trying to install packages, namely tidyverse and ggplot. The error is of the form are always in the form: > library(tidyverse) Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called ‘broom’ Error: package or namespace load failed for ‘tidyverse’ I have already tried installing the package broom independently with dependecies = TRUE per the below Having trouble installing and loading tidyverse- No DIB package I've also tried restart …
Topic: rstudio r
Category: Data Science

Converting data format

I'm trying to use the recent COVID-19 data from the site of Italian Civil Protection, but they use a rather complicated time format that I'm finding troublesome as a novice to plot as data in a graph. This is how the data is presented: [1] 2020-02-24T18:00:00 2020-02-25T18:00:00 2020-02-26T18:00:00 2020-02-27T18:00:00 2020-02-28T18:00:00 2020-02-29T18:00:00 and I would like to use the format as DD-MM, without the time and the year. How can I do it?
Category: Data Science

How can I overlay a contour map over a picture of a country?

So for context, I have a massive dataset of over 2.7 million rows of average download/upload speeds of individuals in Canada, with province/city columns. I would like to plot a contour map of average down/up speed over a picture of the country Canada, kind of like this: https://www.floodmap.net/Elevation/ElevationMap/CountryMaps/?cz=US_1 But unfortunately I have no clue on how to make something like that. I would really appreciate it if someone could point me to the right direction.
Category: Data Science

Many regression lines in a plot

How do you plot many regression lines in a plot? This concerns the textbook question from "Forecasting: Principles and Practice". A dataset concerns winning times of Olympic running events. Categories include year, length (distance), sex (gender). The question askes to make a regression line for each plot to see the average rate of change for each event. I could brute force this question but I want to find an efficient way to make multiple regression lines in a single plot. …
Category: Data Science

install_tensorflow() keeps overwriting virtualenv, making it impossible to install tensorflow and keras

I would like to use the Keras & Tensorflow package for R in RStudio. Everytime I use the command install_keras() or install_tensorflow(), I get the following error: Collecting keras Could not fetch URL https://pypi.python.org/simple/keras/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping Could not find a version that satisfies the requirement keras (from versions: ) No matching distribution found for keras I discovered that every time I tried to install Keras …
Category: Data Science

How are the confidence intervals of a model interpreted?

I am doing some work with R and after obtaining the confusion matrix I have obtained the following metrics corresponding to a logistic regression: Accuracy : 0.7763 95% CI : (0.6662, 0.864) No Information Rate : 0.5395 P-Value [Acc > NIR] : 1.629e-05 And it is not clear to me how CI would be interpreted. Maybe it would be that the Accuracy can take values between 0.666 and 0.864? What does it mean that the CI are so large? If …
Category: Data Science

Difficulties in create a confusion matrix in R for Yes or No

I am new to regression and confusion matrix and trying to create a confusion matrix from logistic binary regression model. I am trying to create a confusion matrix from Yes or No values from the column, Survived. I am using a default dataset, Titanic. I received an error when trying to perform Confusion Matrix The dataset, Titanic content is found here. Titanic Content Here is the R code below. example$Class<- as.factor(example$Class) example$Sex<- as.factor(example$Sex) example$Age<- as.factor(example$Age) example$Survived<- as.factor(example$Survived) trainRowNum <- createDataPartition(example$Survived, …
Category: Data Science

How to observe dependencies using ROC curves?

I am dealing with a database in which I am recording the scores that each race has to obtain a credit. I have made the following graphs: [enter image description here]2 Where you can see the relative benefit of each breed with respect to a threshold of their scores and the ROC curve of each breed. My question is: By means of these graphs, can you find dependencies between each of the races? Thank you and best regards.
Category: Data Science

What does it mean when roc curves intersect at a point?

I am working with a data set and I have obtained the following roc curve: As you can see, black and Asian ethnicity cross at one point (green and purple lines). Does this have any significance? Could any conclusion be drawn from this? Note that I am dealing with the following datasets: -transrisk_performance_by_race_ssa -transrisk_cdf_by_race_ssa.csv -totals.csv In order to observe whether fairness affects profits.
Category: Data Science

How to plot a table with multiple columns as a box plot

I am trying to plot a box plot with the Trinucleotide as the x axis (so 64 trinucleotides on the x axis) and the frequency of each trinucleotide in each of 6 samples then color code the plot according to the sample. This is a snippet of the table and the code I have so far as well as the type of graph I want. ibrary(tidyverse) library(readxl) marte <- read_xlsx("TrinucleotideFrequency06182021.xlsx") marte <- gather (marte, "xzl.mmu.C57.testis.wt.adult.40S_crosslink.rep1+rept1.RPF.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.40S.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6", "xzl.mmu.C57.testis.wt.adult.40S_crosslink.rep2+rept2.RPF.R1.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.40S.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6", "xzl.mmu.C57.testis.wt.adult.40S_crosslink.rep3+rept3.RPF.R1.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.40S.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6", "xzl.mmu.C57.testis.wt.adult.80S_crosslink.rep1+rept1.RPF.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.RPF.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6", "xzl.mmu.C57.testis.wt.adult.80S_crosslink.rep2+rept2.RPF.R1.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.RPF.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6", "xzl.mmu.C57.testis.wt.adult.80S_crosslink.rep3+rept3.RPF.R1.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.RPF.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6",key="gene", …
Topic: ggplot2 rstudio r
Category: Data Science

How to get a output of a hidden layer of a single-layer LSTM

How can get the hidden layer outputs in a simple one-layer lstm? cat("Building Model\n") model <- keras_model_sequential() %>% layer_lstm(units = 64, dropout = 0.2, input_shape = c(seqlength, length(chars))) %>% layer_dense(units = length(chars), activation = "softmax") %>% compile(loss = 'categorical_crossentropy', optimizer = optimizer_sgd(lr = 0.001, decay = 1e-6, momentum = 0.9, nesterov = T), metrics = c('accuracy')) summary(model) cat("Training \n") history <- model %>% fit(train, trainLabels, epochs = 6, batch_size = 16, validation_split = 0.2) I found this guid but I …
Category: Data Science

RStudio: Stretched time series cross validation and using exponential smoothing models

I've been have trouble with a question for an assignment. I'm trying to apply an ETS model onto a stretch_tsibble in a time series cross validation. Running this either takes a long time to do or crashes my RStudio session. This is with one ETS model, my assignment requires three. I think there's a better solution to this and really need help with this. My assignment involves using an ETS model on a training and test set then comparing it …
Category: Data Science

How to output my uploaded text in Shiny in R at the position of the screenshot?

I would like to position a long text on the right side of this Shiny app, as shown on the screenshot below. library(quanteda) library(shiny) library(tm) library(tidytext) library(tidyverse) library(shinydashboard) library(shinythemes) war <- readLines("war.txt") war_corpus <- corpus(war) sentences <- tokens(war_corpus,what="sentence") make_sentences <- function(word) { grep(word,sentences,value=TRUE)} make_sentences("prince") ui<- shinyUI(fluidPage( # Application title mainPanel( img(src='image.jpg', align = "right"), #titlePanel(title=div(img(src="image.jpg"))), fluidRow(HTML("<strong> Search Bar")), #fluidRow(HTML(" <strong>Date: 06-29-2020</strong>") ), fluidRow( br(), p("User Name : ")), br(), br(), fluidRow(HTML("<strong>Enter a word.Click \"Next words\" after</strong>") ), fluidRow( p("\n") ), …
Topic: rstudio r
Category: Data Science

Binary Logistic Regression in R on the dataset, Titanic

I am new to R and Model Learning Algorithm. I am trying to perform Binary Logistic Regression on the training set using the Titanic dataset which is provided by default from R. I am running the algorithm on the set with the variable, Survived as the outcome variable. The variable, Survived contains Yes and No values. I am splitting the dataset into two set, training(40) and test(60). The data look like this below, Titanic Data #Binary Logistic Regression #Import dataset, …
Category: Data Science

How to assess a trend during time?

I wanted to know which analysis method would you suggest for assessing a trend during years. Let us say we have data on antibiotic resistance in a particular bacteria from 2010 until 2021. How can we determine that this resistance was increased or decreased and how much it is changed during this decade? Which method would you suggest?
Category: Data Science

IDE alternatives for R programming (RStudio, IntelliJ IDEA, Eclipse, Visual Studio)

I use RStudio for R programming. I remember about solid IDE-s from other technology stacks, like Visual Studio or Eclipse. I have two questions: What other IDE-s than RStudio are used (please consider providing some brief description on them). Does any of them have noticeable advantages over RStudio? I mostly mean debug/build/deploy features, besides coding itself (so text editors are probably not a solution).
Category: Data Science

sum of distances from N-points to set of other M-points in R

Imagine two related problems: I have one 2-dim data point and a set of $M$ 2-dim other data points. How to calculate sum of all distances between one point and those $M$ points? Result is one number. Now I have $N$ 2-dim points and same set of $M$ 2-dim data points as above. How to calculate sums of all distances between $N$ points and those $M$ points? It should be equivalent to looping through $N$ points and getting those sums. …
Category: Data Science

Segmented function in R?

Could someone please explain what psi and npsi are? segmented(obj, seg.Z, psi, npsi, fixed.psi=NULL, control = seg.control(), model = TRUE, keep.class=FALSE, ...) If obj is the linear model seg.z is ~X what is psi and npsi? Also, if we only include: obj, seg.z and npsi. Would that be sufficient to estimate the breakpoints?
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.