This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set.seed(1) | |
m = array(runif(12) * 10, c(3, 4)) | |
class(m) | |
typeof(m) | |
dput(m) | |
# > class(m) | |
# [1] "matrix" | |
# > typeof(m) | |
# [1] "double" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set.seed(1) | |
m = array(runif(12) * 10, c(3, 4)) | |
dput(m) | |
# > dput(m) | |
# structure(c(2.655086631421, 3.7212389963679, 5.72853363351896, | |
# 9.08207789994776, 2.01681931037456, 8.98389684967697, 9.44675268605351, | |
# 6.60797792486846, 6.2911404389888, 0.617862704675645, 2.05974574899301, | |
# 1.76556752528995), .Dim = 3:4) | |
m2 = as.integer(m) | |
dput(m2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# onedrive-ubu.sh | |
# A BASH script to set up OneDrive integration with GNOME on Ubuntu | |
# Copyright (C) 2018 Garrett Mills ([email protected]) | |
# This software is licensed under the MIT License. | |
# This sofware is provided without warranty or even any implied intent of purpose. | |
# | |
# OnedriveD: https://github.com/xybu/onedrived-dev | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Effect of compression type and file complexity on saveRDS size and speed" | |
author: "David Robinson" | |
date: "April 20, 2015" | |
output: html_document | |
--- | |
```{r echo = FALSE} | |
knitr::opts_chunk$set(cache = TRUE, message = FALSE) | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 셀레늄 패키지와 rvest 패키지를 설치합니다. | |
source("https://install-github.me/ropensci/RSelenium") | |
install.packages("rvest") | |
install.packages("dplyr") | |
# 패키지를 불러서 사용할 준비를 합니다. | |
library(RSelenium) | |
library(rvest) | |
library(dplyr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34 %>% mutate( | |
Q3138rowMeansReverseCoded = as.numeric(Q31 + 6 - Q32 + Q33 + 6 - Q34 + Q35 + Q36 + 6 - Q37 + 6 - Q38)/8 # remove labels | |
, Q3138rowSumsReverseCoded = as.numeric(Q31 + 6 - Q32 + Q33 + 6 - Q34 + Q35 + Q36 + 6 - Q37 + 6 - Q38) # remove labels | |
) %>% select(Q31, Q32, Q33, Q34, Q35, Q36, Q37, Q38, matches("Q3138")) | |
# > ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34 %>% mutate( | |
# + Q3138rowMeansReverseCoded = as.numeric(Q31 + 6 - Q32 + Q33 + 6 - Q34 + Q35 + Q36 + 6 - Q37 + 6 - Q38)/8 # remove labels | |
# + , Q3138rowSumsReverseCoded = as.numeric(Q31 + 6 - Q32 + Q33 + 6 - Q34 + Q35 + Q36 + 6 - Q37 + 6 - Q38) # remove labels | |
# + ) %>% select(Q31, Q32, Q33, Q34, Q35, Q36, Q37, Q38, matches("Q3138")) | |
# # A tibble: 191 x 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34 %>% mutate( | |
Q3138rowMeans = rowMeans(.[, c("Q31", "Q32", "Q33", "Q34", "Q35", "Q36", "Q37", "Q38")], na.rm = T) | |
, Q3138rowSums = rowSums(.[, c("Q31", "Q32", "Q33", "Q34", "Q35", "Q36", "Q37", "Q38")], na.rm = T) | |
, Q4044rowMeans = rowMeans(.[, c("Q40", "Q41", "Q42", "Q43", "Q44")], na.rm = T) | |
, Q4044rowSums = rowSums(.[, c("Q40", "Q41", "Q42", "Q43", "Q44")], na.rm = T) | |
) %>% select(Q31, Q32, Q33, Q34, Q35, Q36, Q37, Q38, matches("Q3138"), Q40, Q41, Q42, Q43, Q44, matches("Q4044")) %>% | |
# > ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34 %>% mutate( | |
# + Q3138rowMeans = rowMeans(.[, c("Q31", "Q32", "Q33", "Q34", "Q35", "Q36", "Q37", "Q38")], na.rm = T) | |
# + , Q3138rowSums = rowSums(.[, c("Q31", "Q32", "Q33", "Q34", "Q35", "Q36", "Q37", "Q38")], na.rm = T) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--#@@ [Research] HCCI MDD annual prevalence 180501.pptm -p128.sql ---- | |
select count(z_patid), count(distinct z_patid) | |
from hcci.MEMBER_SDDV2_1115 | |
where ( | |
z_patid in ( | |
select z_patid | |
from hcci.MEMBER_SDDV2_1115 | |
where ( | |
gdr in ('1', '2') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ function.11matching.by.factors() ----- | |
function.11matching.by.factors = function(data, varname4MatchingUpon = "diabetes", varnames4MatchingBy = c("age", "sex"), seed = 1) { | |
library(tidyverse) | |
if ("RowNum_original" %in% names(data)) { | |
warning('"RowNum_original" %in% names(data)') | |
} else { | |
data$RowNum_original = 1:nrow(data) | |
} | |
set.seed(seed) | |
data$runif = runif(nrow(data)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to Ask for Help using R | |
======================================================== | |
The key to getting good help with an R problem is to provide a minimally working | |
reproducible example (MWRE). Making an MWRE is really easy with R, and it will | |
help ensure that those helping you can identify the source of the error, and | |
ideally submit to you back the corrected code to fix the error instead of sending | |
you hunting for code that works. To have an MWRE you need the following items: | |
- a minimal dataset that produces the error |