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

Format code chunk output text in markdown

I currently work on a beamer presentation with markdown in RStudio. I have some codechunks which generate output and I want to format the output in certain ways. This is one slide:--- title: "An...

View Article


Change background color and font features in navbarPage elements

I would like to know hot to change the default white background of a navbar Page menu and also the font type and color of all its elements in a shiny dashboard.## app.R ## library(shiny)...

View Article


Reverse Geo Coding in R

I would like to reverse geo code address and pin code in RThese are the columns A B C 15.3859085 74.0314209 7J7P92PJ+9H77QGCCCC I have taken first four rows having columns A B and C...

View Article

Image may be NSFW.
Clik here to view.

Add distance lines to ggplot2

I can't figure out how to add distance lines to the chart image below without it being a manual process. the code to add the points is simple. Any help would be greatly appreciated! The lines to need...

View Article

Count occurences of teams in matrix in R

Have a 1000*16 matrix from a simulation with team names as characters. I want to count number of occurrences per team in all 16 columns.I know I could do apply(test, 2, table) but that makes the data...

View Article


R: How to merge two files loaded with spark_read_csv

I'm working on data loaded with spark_read_csv in this way:library(sparklyr) connection <- spark_connect(master = 'local') all_data <- spark_read_csv(sc, "D:/my_data.csv") after working on this...

View Article

Insert list of vectors in matrix by matching names in R

I have a large list of vectors with names and values. The values of the vectors need to be added to the matrix by matching the names of vector in the list with the column names of matrix.For example,...

View Article

How do I generate tables simply and fast in R?

I'm not asking for the str() or glimpse()-commands but for a better way of generating tables. Let's say I want to see if my background variable (gymnasiegrov) affects my result variable...

View Article


Image may be NSFW.
Clik here to view.

What is the most efficient structure to run optim with many categories in the...

I am trying to implement an R version of this model.The task is to find the solution of:I am using optim. I made two code versions. One is using data.table the other is using dplyr. They give the same...

View Article


How can I plot out the mean?

I'm trying to using simulations, draw 1 to 1000 samples from a population with a mean of 50 and a standard deviation of 10. Calculate the mean of each sample, and make a plot that shows how that mean...

View Article

How to get the name of the calling function inside the called routine?

Is there a "non-Internal" way to get the caller's name, as the function stop does?The idea is that I have a small function that checks the inputs and halts execution if some condition is not met. This...

View Article

How to calculate multiple returns of assets

I have tried to set up a R-code to calculate returns of each column. My problem is that the code should consider multiple investments of different time periods in each asset (column).I have managed to...

View Article

Linear programming using python example

I have a question, here is the deal.The company manufactures two-unit home air conditioners, which have a capacity of 350 units per month. The production cost of the air conditioner in Drive 1 is 30000...

View Article


Creating a table extracting the first letter in a string and counts in R

I am trying to extract the first letter of a string that are separated by commas, then counting how many times that letter appears. So an example of a column in my data frame looks like this:test <-...

View Article

Dates %within% Intervals

Running into a real head-scratcher and not sure of how to resolve. Really hoping some of you may be able to help. Also, first time I've ever contributed to StackOverflow....yay!library(tidyverse)...

View Article


R - calculating the average value of previous quarter's dependent variable as...

I am running a logistic regression of the form:model_1 <- lrm(dependent_variable ~ var1 + var2 + var3, data = merged_dataset, na.action="na.delete") What I would like to do is to include the...

View Article

purrr::lift_vd doesn't work with some functions

I have te following data:df_1 <- data.frame( x = c(0, 1, 0, 2, 0), y = c(0, 2, 1, 2, 1), z = c(0, 2, 1, 2, 1) ) And code:library(tidyverse) df_1 %>% mutate(var = pmap(., lift_vd(..f = sum, na.rm...

View Article


Why does `substitute` work in multiple lines, but not in a single line?

I was attempting to answer this nice question about creating a non-standard evaluating function for a data.table object, doing a grouped sum. Akrun came up with a lovely answer which I'll simplify...

View Article

Convert strange formate character date to date in R

I have a dataset Peil_1 with column "timestamp" representing the time "value" was measured. # A tibble: 175,350 x 5 Timestamp Value `Quality Code` `Absolute Value` `AV Quality Code` <chr>...

View Article

Image may be NSFW.
Clik here to view.

Means barplot with confidence intervals?

I have a large dataset, where I have a variable Q1with 7 response/value options, and two groups (One and Two). Q1<- c(6,4,2,4,7,1,4,7,4,5,4,4,2,6,1) Group<- c(One, Two, One, Two,Two, Two, One,...

View Article
Browsing all 206180 articles
Browse latest View live