Quantcast
Browsing all 206152 articles
Browse latest View live

R: Unusual error plotting multipolygons with ggplot, geom_sf, and openstreetmap

I am trying to plot Lake Geneva/Lac Leman using {ggplot2}, {osmdata} and {sf}. I am getting an error whenever I try to plot the lake multipolygons (of which there are 5). I can't find any mention of...

View Article


Why is rle in R returning incorrect lengths?

I am using the function 'rle' to calculate how many consecutive values there are in my vector. The first part of my vector is: 16992 32 96 8 48 144 8 8 8 8 8 8 8 8 8 8 8but rle returns lengths of '1 1...

View Article


Simulation in R and find the min values

everyone here. Here is the question:(a)For a sample size of n = 1, generate N = 1000 data sets from an exp(1) distribution. (b) For each data set, find the min value (for a sample of size 1 that will...

View Article

Move columns from a data frame below other columns in R

I have a data frame with 4 columns and 20 rows. I would like to move the last two columns to be below the other two, resulting in 2 columns and 40 rows. Is there any function in R so that I can select...

View Article

R Group Data, determine duplicates, update column on the earliest instance

I'm needing some help to determine if a 'title' has ever been 'registered' and if so, update a separate column with the earliest date in for that title with text - "InsinuatedRegistered". I've tried a...

View Article


exponential equation ^ and exp give different answers

I have an equation that I found online that I want to use on my data Y = 0.9x0.6The 0.6 is superscript after the xI tried two methods that yielded very different resultsy = (0.9 * (x ^ 0.6)) andy =...

View Article

Using the NOAA API Token to pull in data

I am trying to pull weather data from NOAA's API I've downloaded rnoaa, httrm and jsonlite packages.I want to run this piece of code ncdc_stations(datasetid='GHCND', locationid='FIPS:12017',...

View Article

Image may be NSFW.
Clik here to view.

How do I add text in the legend section of a waffle plot in R?

I am trying to create a waffle plot. My data and waffle plot looked like this-parts=c("Extraction"=397, "Operculectomy"=11, "Medication"=3)waffle(parts, row=12, colors=c("#CC0000", "#006600",...

View Article


Inconsistent style Rd usage section

The new version of the roxygen2 package has resulted in substantial changes to my package's documentation files. For example, the "Usage" section for four functions combined in one .Rd file comes out...

View Article


How to fix an HTTP 403 error when webscrapping in R?

I'm trying to gather statistical data on 3,600 + Wikipedia pages for work. I am trying to automate it using web scrapping in R. I have an issue extracting the HTML code directly in R....

View Article

Image may be NSFW.
Clik here to view.

Order of weekdays in a bar chart using lubridate and ggplot

When creating a bar plot where the x-axis is Weekdays (using lubridate and ggplot), the order of my weekdays does't follow the chronological "mon, tues, wed... "I've tried to replicate the problem but...

View Article

How can I create a linnet object starting from an sf object with LINESTRING...

At the moment I'm working on a project with point pattern events on a linear network (car crashes) and I'm reading chapter 17 of spatstat book: "Spatial Point Patterns: Methodology and Applications...

View Article

Error using the MICE package's "with()" command to perform computation on...

I am working on a project where I used LASSO for variable selection across a dataset in which I needed to do multiple imputation to account for missingness in several variables. Combining LASSO results...

View Article


Conditions within ggplot2

I am new to R and I (probably) have a simple question, but I am unable to get my head around it. Even though I have been trying it in multiple ways:I want to make a plot from a subgroup of a certain...

View Article

Image may be NSFW.
Clik here to view.

intEff function R returns weird errors

I have the following probit model with an interaction effect between i and a:probit5 <- glm(y ~ a + b + c + d + e + f + g + h + i + j + k + l + i*a, family = binomial(link = "probit"), data = data)...

View Article


How to make Contour plot of the joint posterior distribution - R

I'm working on this problem. We consider model data set collected by Gilchrist (1984), in which a series of 33 insect traps were set across sand dunes and the numbers of di↵erent insects caught over a...

View Article

Dominance in Data Envelopment analysis in R

I need to formalise in R the following rule, called dominance: (x1,y1) dominates (x2,y2) if and only if x1<=x2(1) and y1>=y2(2) and (x1,y1) different from (x2,y2)(3). x and y are vectors...

View Article


Right truncation in survival analysis

Im trying to censored in the right and it is not working. My code is the following:km_fit <- survfit(Surv(mes, mes_2, estado, type = 'interval2') ~ 1,data = survival_clientes) However, if I try with...

View Article

R - plot_brmap ( state border )

I made a map of Brazilian cities using plot_brmap() and I want to show the state border.But I don't know how to do it. I have been trying to fill the mapa2_data (state map) with transparent color and...

View Article

eclust: redefine k for h-cluster?

Hi is there a way to redefine k without having to rerun the hclust? Examplelibrary (factoextra) data("USArrests") df <- scale(USArrests) ik=4 res.hk <- eclust(df , "hclust", k = ik, hc_metric...

View Article
Browsing all 206152 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>