# Tagged Questions

R is a free, open-source programming language and software environment for statistical computing, bioinformatics, visualization and general computing. Provide minimal, reproducible, representative example(s) with your questions. Use dput() for data and specify all non-base packages with library ...

**0**

votes

**0**answers

7 views

### Constant function of time

I'm looking for some assistance with the lcmm() r package. I'm trying to fit a model in which the Y dependent value is constant or persistent over time vs a simple linear function; however, i'm not ...

**0**

votes

**0**answers

11 views

### Select distinct rows in a data frame with only NA Values in R

I have a data frame with 3 cols.ID1 <- c(1,1,2,2,3,4)ID2 <- c(11,NA,12,NA,NA,NA)Val <- c("A","B","C","D","E","F")DF <- data.frame(ID1,ID2,Val, stringsAsFactors=FALSE)Now, I need ...

**1**

vote

**1**answer

4 views

### Adding index to points in ggplot

I have a basic plot, with a small number of points on. I would like to label the points with a numeric index, and then have the full description of the point in the legend. These is commonly seen on ...

**0**

votes

**0**answers

3 views

### Univariable regression: x~y different than y~x in lm, rq, and rlm

We came across a problem, where changing outcome and predictor in univariable linear regression (i.e. y~x vs. x~y) yielded different results. We compared linear regression, quantile regression and ...

**0**

votes

**0**answers

2 views

### Extracting labels from SPSS files in R

I imported a SPSS file into R using the haven package. As you can see on the next image, all variables have labels associated with them (e.g. "2016 YEAR OF ADMINISTRATION"):I'm trying to read those ...

**0**

votes

**0**answers

11 views

### Linear model grid search in R

I would like to do a grid search using linear model in R. I have experimental data with periodic pattern and I am trying to fit something like:lin_fit <- lm(y ~ x + sin(2*pi*x) + cos(4*pi*x), ...

**0**

votes

**0**answers

7 views

### Sparklyr how to view variables

Hi I have a deeply nested json file. I used sparklyr to read this json file and called this "data" object.Firstly I will show what the data structure looks like:# Database: spark_connectiondata...

**0**

votes

**1**answer

14 views

### smoothing line with categorical variable with ggplot?

I have a huge data sets and this is a sample.data.frame(basket_size_group=c("[0,2]", "[0,2]", "(2,4]", "(2,4]", "(4,6]"),channel=c("offline", "online/mobile", "offline", "online/mobile", ...

**-3**

votes

**0**answers

20 views

### Feed R function with spreadsheet data [on hold]

I am currently writing an R function, that should give me a present value of cash flows for an asset producing a given constant stream of cash flow. I would like to extend it to produce the present ...

**1**

vote

**0**answers

18 views

### Automating the generation of preformated text in Rmarkdown using R

I'm creating a document in which I repeat the same formatting multiple times. So I want to automate the process using the for loop in R. Here's a simple example.Assume, I have an R code that ...

**0**

votes

**1**answer

4 views

### Changes label/dimnames for metaSEM

I'm looking for a way to change labels/dimnames on imported data used for metaSEM. Specifically, I am looking a way to label each study and change the dim names to actually represent the variables ...

**-1**

votes

**1**answer

24 views

### Change colors to the 'fill' in aes?

I have this:colr=c(a='black',b='red',c='brown')Basically, i have used the fill with the categories from a column in the df in the aes. Thus it will show through the categories the plot. The ...

**5**

votes

**1**answer

47 views

### Extract column name in mutate_if call

I would like to extract the column name in the function call to mutate_if. With this I then want to lookup a value in adifferent table and fill in missing values with the look up value. I tried using ...

**1**

vote

**2**answers

39 views

### Recursive function using dplyr

I have data: dat <- tibble(day=200:210,x=sample(-10:10, size=11,replace=T))I have a variable y with initial value of 2. I want to calculate the final value of y by ...

**-1**

votes

**0**answers

14 views

### Legend breaks cut off at the limits ggplot2

I'm plotting different types of graphs where my legend has the colorbar of the values in my graph in log like in the image below:ColorBar breaks: per decadeThe code that gives something like this ...