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

Loop to export multiple dataframes in r to Excel and Name Each Sheet

I have 2 data frames that I would like to export to Excel, with each dataframe on a different worksheet, and to title each sheet.I have tried the following with write.xlsx .Here is the list of my 2...

View Article


convert a netcdf time variable to an R date object

I have a netcdf file with a timeseries and the time variable has the following typical metadata: double time(time) ; time:standard_name = "time" ; time:bounds = "time_bnds" ; time:units = "days since...

View Article


How to write a function to loop through variables and plot using ggplot

I'm having problems figuring out how to loop through variables in a data frame and plot them using ggplot. An example of my data is below:head(myData,2) x1 x2 yhat x11 x3 yhat1 x12 1 -0.8523122...

View Article

Image may be NSFW.
Clik here to view.

What distribution should I fit to this data [migrated]

I am trying to find a distribution that fits my data (3500+ data points) with satisfying goodness of fit (gof), I use the Kolmogorov-Smirnov test and its p-value as a gof measurement (p-value >...

View Article

R expanding the extent of a raster causes problems with gdal

I have a set of rasters created from geotiff files with code like the followingfileName <- "data/xxx.yyy.tif" rasterOutput <- brick(fileName) Most of the the resulting rasterbricks have an extent...

View Article


Bind r data.frames that contain column(s) of nested data.frames

After importing multiple .json files using jsonlite I was looking for ways to bind the resulting data.frames which contained one or more columns which themselves were nested data.frames. I came across...

View Article

Maximize out-of-sample correlation

Say I have one time-series A of interest, and 10 other time-series B at hand. Then, I pick 3 time-series of the B group, average them, and predict an out-of-sample correlation with time-series A. The...

View Article

Image may be NSFW.
Clik here to view.

How to plot positions along a chromosome graphic

I would like to generate a plot depicting 14 linear chromosomes for the organism I work on, to scale, with coloured bars at specified locations along each chromosome. Ideally I'd like to use R as this...

View Article


Fastest way to check all elements in one data.table column for each value...

What is the fastest way to check a full column in data.table R if each value appears in a different data.table column? Example problem:Create example big data:dt1 <-...

View Article


How do I use a for loop to create a list of data frames, based off two...

I am VERY new to loops. Some of my loops have been successful, others... not so much.I have some observed data (df_obs) that I'd like to test against my model predictions (df_pred). MY CURRENT AIM:...

View Article

Multiple x-axis didn't show variable name

i'm try to plot multiple x-axis with shiny.the problem is i can't get variable name(Cities and Month) to show under the chart. the plot i can doI want to show variable name to under the chart. my...

View Article

Tidyverse - rsample. nested_cv + group_vfold_cv = error. Nested...

I am running on the following error:library(tidymodels) nested_cv(data = iris, outside = group_vfold_cv( data = iris, group = Species, v = 2), inside = bootstraps(times = 5)) %>% rsample2caret()...

View Article

Image may be NSFW.
Clik here to view.

R match date in one table if between two date columns in second table over...

Using base R only, I'm trying to iterate and test if table1$"DATE" is >= table2$"START"& <= table2$"STOP" where table1$"EVENT" == table2$"EVENT". I initially thought to get unique categories...

View Article


Use ifelse and is.null to test for NULL values

I have a data frame: df <- structure(list(gene = structure(1:6, .Label = c("128up", "14-3-3epsilon", "14-3-3zeta", "140up", "18SrRNA-Psi:CR41602", "18SrRNA-Psi:CR45861" ), class = "factor"), fpkm =...

View Article

Is it possible to populate R dataframe with two interdependent columns

I am try to use R to calculate sales as a function of inventory as a function of sales. See below data snapshot. Is there anyway to calculate this?Group, Day and Sell_Thru are independent variablesInv...

View Article


Order a variable and separate by another variable R

I want to order() a variable by the number of characters it has and then separate that variable based on gender, f and m. How can I do that using R?

View Article

Woking with Date in R [duplicate]

This question already has an answer here:Converting year and month (“yyyy-mm” format) to a date? 7 answersI have raw data with the date given as189901 which I want to be 1899-01-01 , 189902 which I...

View Article


create a cumulative count of adjacent repetitions in a column

I want to create a cumulative count of adjacent repetitions in a column. For instance the desired output for repeat_n in the code below should be c(1,2,3,1,2,1,2), but instead I am getting...

View Article

Convert character month name to date time object

I must be missing something simple. I have a data.frame of various date formats and I'm using lubridate which works great with everything except month names by themselves. I can't get the month names...

View Article

Issue with setting up time series correctly in R

I have been trying to do some basic analysis on some timeseries data. However, I keep getting this error on anything I am trying to doError in decompose(data_ts, type = c("additive")) : time series has...

View Article
Browsing all 206180 articles
Browse latest View live


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