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

How to run Python script from R?

I'm trying a simple example but it fails:system("cmd.exe", input = 'python --version')Microsoft Windows [Wersja 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Wszelkie prawa...

View Article


Control order of result from approx()

Both approx(c(-10, 0), c(-10, 0), n = 3) and approx(c(0, -10), c(0, -10), n = 3) yield the same result, but I feel the second one should return points from (0, 0) to (-10, -10) in that order (i.e. the...

View Article


Problems with foreach() and %dopar% in R

I'm trying to perform a row-concatenating function for data.tables inside foreach().So far my code has worked with small test datasets and subsets (100 x 100, 1000 x 1000) but fails when datasets get...

View Article

MSTS and forecast function

My data is the hourly number of patients that enter the Emergency unit, meaning that I have 24 points of data per day like in the table below.str(data) 'data.frame': 21840 obs. of 2 variables: $ Date:...

View Article

How to calculate daily means, medians, from weather variables data collected...

I have this dataframe, "Data", containing one full year of data collected about every half-hour, but for some days only a few hours of data were collected.Dates are in the format: 31.01.2010 00:30 (all...

View Article


Image may be NSFW.
Clik here to view.

How to add a prediction band to the plot of a mixed effect model?

I have created a plot for my lme model using plot_model():m_lme = lme(Valency ~ logTFI, random = ~1|H, data = data1, method = "ML") plot_model(A_lme) + geom_point(size = 3) It gives me the following...

View Article

How to rotate 3D Scatterplot

Below is a code that works using the scatterplot3d() function to run a 3D scatterplot of height vs weight vs volume where points are a Class value between 1-6. The angle is currently at 45 degrees and...

View Article

Draw circles around points belonging to a factor level in ggplot

A previous post describes how to draw red circles around points which exceed a given value in ggplot. I would like to do the same for anomaly detection results, but instead have the circles drawn...

View Article


Calculating estimated marginal means with multiply imputed data [closed]

How do I calculate estimated marginal means using a multiply imputed dataset?Calculating estimated marginal means with a single dataset using the effects package works fine. However, I don't know how...

View Article


R Multiples plot in a single varible

Hi I have the next code: par(mfrow=c(1,3)) plot(BCxyz[,1], BCxyz[,2], main="Bray-Curtis 1:2", pch=20, cex = 3, col=c("blue", "green", "red", "yellow")[Metadata$SampleType]) plot(BCxyz[,1], BCxyz[,3],...

View Article

Image may be NSFW.
Clik here to view.

Remove unused X axis levels in ggplot2

I would like to have the ggplot only display levels where there is data. So for the first facet S7, S8, S9 should not appear & for the second facet S1, S2, S3 should not appear. Please let me know...

View Article

Calculate centered moving average of dataset, ignoring NAs, output same...

Ultimately I want to create a 15 hour moving average of my dataset. The data I am working with has a date and time for every 15 minutes. I need the window centered (so 30 time steps before/after the...

View Article

Image may be NSFW.
Clik here to view.

script to add links to all images in markdown file

I have a workflow where I'm downloading Google Docs as docx, then processing them to markdown for export to other formats in the R environment.When I convert to markdown with pandoc_convert, I get...

View Article


Watson ibm key credentials

I try to run watson ibmI use this:library(WatsonR) watson.alchemy.test() but I receive this error:[1] "Short Test of Alchemy - Hitting Endpoint; Checking Credentials OK and Transactions Consumed "...

View Article

Python statsmodels GLM: change treatment of classes when applying 0s and 1s

I have a stock market dataset from GitHub:import pandas as pd import numpy as np import statsmodels.api as sm Smarket_url = 'https://raw.githubusercontent.com/selva86/datasets/master/Smarket.csv' #Load...

View Article


Trouble Installing rlang and TidyVerse

5.1 and RStudio 1.2.5. I am trying to load Tidyverse and it gave some error message about "onload failed in loadNameSpace() for 'rlang' so I think maybe I need to load rlang first, but I got the same...

View Article

Image may be NSFW.
Clik here to view.

R: Gaps between specific bars in ggplot

I have this bar graph.I generate the graph with this code:# Speedup Graph p <- ggplot(speedup_df, aes(x= benchmark, y = speedup, fill = factor(technique))) + geom_bar(stat = "identity", position =...

View Article


Why shiny didn't call local function in server session?

Suppose I have a local function:getres<-function(x, y){ x^2-y } Then I have shiny::server:server <- function(input, output) { reslst<-reactive({ getres(input$x, input$y) }) output$result <-...

View Article

Image may be NSFW.
Clik here to view.

R plots: Corrupted/missing characters for devices other than pdf

I am having a problem where some graphics devices print missing glyph boxes instead of characters. Actually, the only device I have tried so far that renders characters is PDF. Since I recently updated...

View Article

Use the geosphere::distm in a more efficient way?

Using location data of stores, I'm trying to find 'competitors' -- which is defined as other stores within a certain distance.I'm using geo sphere::distm and some matrix operations like below. The...

View Article
Browsing all 206180 articles
Browse latest View live


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