Quantcast
Channel: Active questions tagged r - Stack Overflow
Browsing all 206180 articles
Browse latest View live
↧

loading file with quotes (with and without escape character) within quoted...

When loading a CSV file using fread() the value (bouth "Hendr\"ix" and "Hendr"ix") in one of the columns causes the warning "Found and resolved improper quoting out-of-sample. First healed line...

View Article


How do I turn a series of IDs into corresponding URLs?

So I have a list of 1350 IDs from the RePEc database that look like this:repec_id <- c("RePEc:bep:uomlwp:umichlwps-1003", "RePEc:hal:wpaper:hal-02187883", "RePEc:hal:journl:hal-02184200")Each ID...

View Article


Warning in the Matchit package ("Glm.fit: fitted probabilities numerically 0...

I'm running a code with around 200.000 observations, where 10.000 were treated and the remaining I'm trying to match using the package MatchIt. Because of one of these variables, there is a warning...

View Article

Rearrange GIS data of Origina Destinations to one row each point

I start with a "wide" data set of GIS data of Origin Destinations (OD), that I want to rearange into a longer data set of one row for each point. I already managed to melt and then dcast to rearange...

View Article

Remove a specific html node from a set of nodes

I want to scrape the reports from https://paidabribe.com/reports/paid in R. Everything works quit good with my following code besides some reports contain an embedded element under the report which is...

View Article


Image may be NSFW.
Clik here to view.

How do I adapt the number of required colors for a geom_bar plot automatically?

I would like to make a bar chart for a column with differently colored bars using ggplot.library(ggplot2) set.seed(123) df_a <- data.frame(A1 = sample(c(0, 1, 2, 3, 4), 10, replace = TRUE))...

View Article

how to open grib file in r software

In r, I've been accessing netcdf files and just wish to check the equivalent data which is provided also within a grib file (i.e. ERA5 data) - what is the best means to do so? Thanks Trisha

View Article

shift in dates using complete on data.table

Why is the complete function shifting index by 1 hour?library(xts) library(tidyr) x = seq.Date(from = as.Date('2012-03-10'), to = as.Date('2012-03-25'), by = 'week') x = xts::xts(1:length(x), order.by...

View Article


Handling java.lang.OutOfMemoryError when writing to Excel from R

The xlsx package can be used to read and write Excel spreadsheets from R. Unfortunately, even for moderately large spreadsheets, java.lang.OutOfMemoryError can occur. In particular,Error in...

View Article


Writing S4 method based on base R concatenation function c(). Use of...

I am trying to write a method for concatenation of two S4 classes that I have defined:setClass("My_item", representation(contents = "vector")) setClass("My_group", representation(members = "list")) The...

View Article

How can we extract London weather in 2000 via Darksky API?

#install.packages("darksky") library(darksky) library(tidyverse) # current verison packageVersion("darksky") Sys.setenv("DARKSKY_API_KEY" = # Secret API Key ) Sys.getenv("DARKSKY_API_KEY") #This...

View Article

RGui loads outdated .Rprofile due to .RData in working directory

I recently adapted my .Rprofile and was puzzled when RGui did not load the new .Rprofile (RStudio did load it) but instead held on to the old version. After some trial and error I figured out that the...

View Article

R for loop results

I need to store the results of my loop in a data frame but i can't figure it out. I got the loop working as shown below. Pasta_pesto <- list(ingredienten =...

View Article


R: How to carry the last observed value forward, within the same unit of...

I have a little problem with R and the tidyverse that I unfortunately can't seem to solve. Say we have quarterly observations of three shops (in the minimum working example the values really don't...

View Article

Image may be NSFW.
Clik here to view.

plotly::ggplotly legend titles not centering for a faceted ggplot

I'm trying to turn a ggplot plot into an interactive plotly for an R Markdown HTML presentation.If 'a' is my ggplot, the important bit of code looks like:x <- list(title = "Title 1") y <-...

View Article


Pasting cell entries into one cell and deleting empty cells

I have the following problem: I have a table with many empty cells. But the first column does not contain empty cells. Like this:structure(list(variable = c("variable", "Mean (M)", "Standard",...

View Article

How to create a dataframe from using data from another dataframe?

I'm not sure if this is possible in R, but I have a dataframe original_data with one row and columns as follows:A Ar A1 A1r B Br B1 B1r C Cr C1 C1r...... 0 0.1 0.5 0.1 0.1 0.6 0.7 1.2 1.4 1.2 1.5...

View Article


Quadratic Programming Setting up Constraint

I am trying to set up a simple OLS model with constraints on the coefficients in R. The code below is working. However, this demonstratesy = c + a1x1 + a2x2 + a3x3 with constraint a1+a2 = 1 I would...

View Article

R Combine Two Data Frames, Remove Unique Patient IDs

I have two data sets: OriginalPTs and RetestPTs. Each has three columns, PID, Speed, and Group. Group is either "original" or "retest" depending on which data frame. All values for RetestPTs$PID are in...

View Article

Why r shows an error when using dplyr and ifelse together?

I am trying to use the "ifelse" function in R grouping but it doesn't work. My data is something like this:Breed Animal NOR 1 NOR 1 SWE 1 HOL 2 NOR 2 NOR 3 NOR 3 So I want to create a new variable,...

View Article
Browsing all 206180 articles
Browse latest View live


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