r

Raking Multiple Imputed dataset

戏子无情 提交于 2021-02-20 02:14:36
问题 This is a continuation from my previous post Error with svydesign using imputed data sets I would like to run a rake() function in my imputed dataset. However, it seems it is not finding the input variable. Below is a sample code: library(mitools) library(survey) library(mice) data(nhanes) nhanes2$hyp <- as.factor(nhanes2$hyp) imp <- mice(nhanes2,method=c("polyreg","pmm","logreg","pmm"), seed = 23109) imp_list <- lapply( 1:5 , function( n ) complete( imp , action = n ) ) des<-svydesign(id=~1,

Plot discrete data [closed]

一世执手 提交于 2021-02-20 02:14:33
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . Improve this question Hy guys, I just need a suggestion on how to plot in a proper way some data so that they could be self-explanatory. I have a matrix of counts that looks like this: Condition1 Condition2 Condition3 ...... Patient1 30 4 23 ...... Patient2 22 1 2 ......

Raking Multiple Imputed dataset

不羁岁月 提交于 2021-02-20 02:11:46
问题 This is a continuation from my previous post Error with svydesign using imputed data sets I would like to run a rake() function in my imputed dataset. However, it seems it is not finding the input variable. Below is a sample code: library(mitools) library(survey) library(mice) data(nhanes) nhanes2$hyp <- as.factor(nhanes2$hyp) imp <- mice(nhanes2,method=c("polyreg","pmm","logreg","pmm"), seed = 23109) imp_list <- lapply( 1:5 , function( n ) complete( imp , action = n ) ) des<-svydesign(id=~1,

Construct a loop based on multiple conditions in a column R

[亡魂溺海] 提交于 2021-02-20 01:35:00
问题 I have a df attached and I would like to create a loop that would apply a specific sequence based on conditions in column "x9" . I would like to be able to set the sequence myself so I can try different sequences for this data frame, I will explain more below. I have a df of losses and wins for an algorithm. On the first instance of a win I want to take the value in "x9" and divide it by the sequence value. I want to keep iterating through the sequence values until a loss is achieved. Once a

Construct a loop based on multiple conditions in a column R

大憨熊 提交于 2021-02-20 01:33:44
问题 I have a df attached and I would like to create a loop that would apply a specific sequence based on conditions in column "x9" . I would like to be able to set the sequence myself so I can try different sequences for this data frame, I will explain more below. I have a df of losses and wins for an algorithm. On the first instance of a win I want to take the value in "x9" and divide it by the sequence value. I want to keep iterating through the sequence values until a loss is achieved. Once a

R - cox hazard model not including levels of a factor

浪子不回头ぞ 提交于 2021-02-19 23:59:13
问题 I am fitting a cox model to some data that is structured as such: str(test) 'data.frame': 147 obs. of 8 variables: $ AGE : int 71 69 90 78 61 74 78 78 81 45 ... $ Gender : Factor w/ 2 levels "F","M": 2 1 2 1 2 1 2 1 2 1 ... $ RACE : Factor w/ 5 levels "","BLACK","HISPANIC",..: 5 2 5 5 5 5 5 5 5 1 ... $ SIDE : Factor w/ 2 levels "L","R": 1 1 2 1 2 1 1 1 2 1 ... $ LESION.INDICATION: Factor w/ 12 levels "CLAUDICATION",..: 1 11 4 11 9 1 1 11 11 11 ... $ RUTH.CLASS : int 3 5 4 5 4 3 3 5 5 5 ... $

How to push git repository through ssh using git2r?

天大地大妈咪最大 提交于 2021-02-19 23:54:29
问题 I'm trying to use git2r package (version 0.21.0). I always use ssh connexions in my projects (GitHub and GitLab hosted): I can do git pull/push with both RStudio IDE and command line. I have a standard Ubuntu Xenial configuration; my keys are stored in ~/.ssh with standard names, my ssh-agent is running, and keys were added to ssh-agent . My problem is how to use the git2r package to push with ssh ? Here's what I do with a very basic workflow (work on master , remote name is origin ): library

How to push git repository through ssh using git2r?

爱⌒轻易说出口 提交于 2021-02-19 23:51:08
问题 I'm trying to use git2r package (version 0.21.0). I always use ssh connexions in my projects (GitHub and GitLab hosted): I can do git pull/push with both RStudio IDE and command line. I have a standard Ubuntu Xenial configuration; my keys are stored in ~/.ssh with standard names, my ssh-agent is running, and keys were added to ssh-agent . My problem is how to use the git2r package to push with ssh ? Here's what I do with a very basic workflow (work on master , remote name is origin ): library

Restrict fitted regression line (abline) to range of data used in model

﹥>﹥吖頭↗ 提交于 2021-02-19 23:44:20
问题 Is it possible to draw an abline of a fit only in a certain range of x-values? I have a dataset with a linear fit of a subset of that dataset: # The dataset: daten <- data.frame(x = c(0:6), y = c(0.3, 0.1, 0.9, 3.1, 5, 4.9, 6.2)) # make a linear fit for the datapoints 3, 4, 5 daten_fit <- lm(formula = y~x, data = daten, subset = 3:5) When I plot the data and draw a regression line: plot (y ~ x, data = daten) abline(reg = daten_fit) The line is drawn for the full range of x-values in the

Restrict fitted regression line (abline) to range of data used in model

拥有回忆 提交于 2021-02-19 23:39:06
问题 Is it possible to draw an abline of a fit only in a certain range of x-values? I have a dataset with a linear fit of a subset of that dataset: # The dataset: daten <- data.frame(x = c(0:6), y = c(0.3, 0.1, 0.9, 3.1, 5, 4.9, 6.2)) # make a linear fit for the datapoints 3, 4, 5 daten_fit <- lm(formula = y~x, data = daten, subset = 3:5) When I plot the data and draw a regression line: plot (y ~ x, data = daten) abline(reg = daten_fit) The line is drawn for the full range of x-values in the