Derived from this helpful stackoverflow answer
dup_data %>%
group_by(MRN) %>%
filter(Year == min(Year)) %>%
slice(1) %>%
ungroup()
require 'faraday' | |
require 'uri' | |
data = { | |
:your_data => "YOUR DATA" | |
} | |
url = "some url" | |
response = Faraday.post(url) do |req| |
module LoginHelper | |
def login(user="test",pw="test") | |
request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user,pw) | |
end | |
end | |
RSpec.configure do |config| | |
config.include LoginHelper, type: :controller | |
end |
# Collected R utility methods | |
read_all_csv_files <- function(dir) { | |
save_dir <- getwd() | |
setwd(dir) | |
files <- list.files(pattern = "csv") | |
for (file in files) { | |
if (!exists("dataset")){ | |
dataset <- read.csv(file) | |
} else { |
read_all_csv_files <- function(dir) { | |
save_dir <- getwd() | |
setwd(dir) | |
files <- list.files(pattern = "csv") | |
for (file in files) { | |
if (!exists("dataset")){ | |
dataset <- read.csv(file) | |
} else { | |
temp_dataset <- read.csv(file, stringsAsFactors = FALSE) | |
dataset <- rbind(dataset, temp_dataset) |
Derived from this helpful stackoverflow answer
dup_data %>%
group_by(MRN) %>%
filter(Year == min(Year)) %>%
slice(1) %>%
ungroup()
make_2x2 <- function(exp_yes, exp_no, notexp_yes, notexp_no, exposure) {
as.table(matrix(c(exp_yes, exp_no, notexp_yes, notexp_no), nrow = 2, byrow = TRUE, dimnames = list(c(exposure, paste("No",exposure)), c("Yes","No"))))
}
chisq.test(make_2x2(10,990,100,9900,"Risk"))
### Keybase proof | |
I hereby claim: | |
* I am narath on github. | |
* I am narath (https://keybase.io/narath) on keybase. | |
* I have a public key ASCV2IYSNSJtU20wXHEULDadD1EPFt21sJp9ovywBkQfJQo | |
To claim this, I am signing this object: |
require "capistrano/setup" | |
require "capistrano/deploy" | |
require "capistrano/scm/git" | |
install_plugin Capistrano::SCM::Git | |
require "capistrano/rails" | |
require "capistrano/bundler" | |
require "capistrano/rvm" | |
require "capistrano/puma" |
before_release: | |
- bundle exec rake db:migrate |
# It is better to use date_trunc which is supported in Postgresql | |
volume.experiences %>% | |
mutate(monthyear = date_trunc("month",date_of_experience)) %>% | |
group_by(monthyear) %>% | |
summarize(count=sum(count)) %>% | |
ggplot(aes(x=monthyear, y = as.integer(count))) + | |
geom_area(fill="lightblue", color="black") + | |
labs(x = "Date", y = "# of experiences") |