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

Image may be NSFW.
Clik here to view.

How can I use the `td` command from the `tempdisagg` package to disaggregate...

I have a monthly frequency data which I am trying to disaggregate into a daily frequency data. So I use the td command from the tempdisagg package in R using the code below: dat=ts(data[,2])...

View Article


Recenter Covariate in Train Function

In short, I want to do what was asked in the below:Possible to force logistic regression or other classifier through specific probability?I'm running a logistic regression using the train function but...

View Article


Add leading zeros with R to a SQL database

To add leading zeros to a string in R I'll use the formatC() function:x <- c(1, 10, 100, 10000, 100000, 1000000) formatC(x, width = 8, format = "d", flag = "0") #> [1]...

View Article

How to specify a column name in ddply via character variable?

I have a tibble/dataframe with sample_id condition state --------------------------------- sample1 case val1 sample1 case val2 sample1 case val3 sample2 control val1 sample2 control val2 sample2...

View Article

spatial network plot using ggplot

I would like to reproduce plot of spatial dependency of regions in ggplot2 rather then using basic plot in RI provided reproduceble example in code below:I followed example: Plotting neighborhoods...

View Article


R markdown with Latex on R studio cloud server

I am trying to use Rmarkdown on our department's RStudio server. I am using the tinytex package to install TinyTex, for the Rmarkdown files. It was working before, then I was trying to get a custom...

View Article

Warning: getSymbols, tq_get, getSymbols.yahoo does not return prices for to date

This is really more of a warning, but I do ask and answer a question. When the to date parameter is specified in getSymbols, tq_get, getSymbols, the function returns prices for the dates up to but not...

View Article

How to pipe SQL into R's dplyr?

I can use the following code in R to select distinct rows in any generic SQL database. I'd use dplyr::distinct() but it's not supported in SQL syntax. Anyways, this does indeed...

View Article


Regular Expression R: Select the above or below lines of a regexp selection...

I am working with a text document similar to the examples below.File <- c("Location Name Code and Label Frequency Percentage", " During the past 30 days, on how many days did you carry a weapon",...

View Article


is it faster to fill a matrix by row or to transpose a matrix filled by columns?

I was reading that R uses column-major storage in matrices, which means that elements in nearby columns are stored in contiguous blocks or something of that sort. This made me wonder: Is it faster to...

View Article

How to get line number of a function call in R?

For debug purposes, I want to print a line number (and function name) of the place the current function was called from. How do I get this in R?I've seen a solution of getting the source file name But...

View Article

Is there a way to mutate and create many new variables with one line of code?

I have something like:df<-data.frame(group=c(1, 1, 1, 1,1,2, 2, 2, 2), date=c("2000-01-01 11:00:00", "2000-01-03 11:00:00", "2000-01-04 11:20:00", "2000-01-04 14:20:00", "2000-01-05 11:40:00",...

View Article

How to plot factored variable in R

I have my dataframe like this:ind.heights <- structure(list(names = structure(c(3L, 4L, 5L, 1L, 2L), .Label = c("bagmati", "bardiya", "Jumla", "kalikot", "ramechap"), class = "factor"), heights =...

View Article


Why my simple code doesn't store the variable in global environment

I have a strange issue that the value of the function is supposed to be stored in the global environment. instead, it returns an error for a line that shouldn't be executed!DEV.OneCancerStrings <-...

View Article

Find the overlap of two datasets

I have two different datasets as I've shown below: df_A and df_B. df_A <- tribble( ~book_name, ~sales_id, "A", 1, "B", 2, "C", 3, "D", 4, "E", 5, "F", 3, "G", 8, "H", 6, "I", 7, "J", 7, ) df_B <-...

View Article


about ggsave in superheat package

I would like to know how to use ggsave in superheat package. ggsave does not work...... # install devtools install.packages("devtools") # use devtools to install superheat...

View Article

R: creating variable conditionally based off two shift statements

I have a data set like the following:id age mod 1 1 1 1 5 0 1 6 1 1 7 1 1 9 1 2 3 0 2 4 1 And I'd like to create the variable first and give it a value of true only for the first occurrence of each...

View Article


Understand what's happening in this R web scraping code

Could anyone please explain the below R web scraping code?I found the below code on Stack Overflow to scrape in Apple financial information from Yahoo Finance. Specifically: step 2, how to find the...

View Article

Image may be NSFW.
Clik here to view.

Why aren't any points showing up in the qqcomp function when using...

I want to compare the fit of different distributions to my data in a single plot. The qqcomp function from the fitdistrplus package pretty much does exactly what I want to do. The only problem I have...

View Article

Image may be NSFW.
Clik here to view.

Need help getting the correct time for a time series in R

I have a dataset that I am passing through a time series. While the time series is working, I can not figure out how to add dates to my graph. Any help would be greatly appreciated! Plasterdo<-...

View Article
Browsing all 205372 articles
Browse latest View live


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