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
library(dplyr) | |
library(survey) | |
data(nhanes) | |
# with clusters | |
svy <- svydesign(id=~SDMVPSU, strata=~SDMVSTRA, weights=~WTMEC2YR, nest=TRUE, data=nhanes) | |
svytotal(~HI_CHOL, svy, na.rm = TRUE) | |
### reproducing results with dplyr is simple | |
nhanes %>% |
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
extern crate bindgen; | |
use std::env; | |
use std::path::PathBuf; | |
fn main() { | |
println!("cargo:rustc-link-lib=R"); | |
println!("cargo:rustc-link-search=native={}", "/usr/lib/R/lib"); | |
// The bindgen::Builder is the main entry point | |
// to bindgen, and lets you build up options for |
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
library(dplyr) | |
library(tibble) | |
myList <- list( | |
list( | |
id = 1, | |
name = "A", | |
sublist = list( | |
a=1,b=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
library(shiny) | |
# WARNING: This sketch does not make proper use of the "state" parameter. | |
# Doing so usually involves using cookies, which can be done with the | |
# Rook package but I have not done that here. If you choose to use this | |
# approach in production, please check the state parameter properly! | |
APP_URL <- if (interactive()) { | |
# This might be useful for local development. If not, just hardcode APP_URL | |
# to the deployed URL that you'll provide a few lines below. |
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
setMethod("%*%", c("gammaconv","gammaconv"), function(x,y) { | |
# maxterms<-sum(outer(x@power,y@power,function(n1,n2) 2*pmax(n1+1,n2+1))) | |
allcoef<- list() #numeric(maxterms) | |
allpower<- list() #integer(maxterms) | |
allexp<- list() #numeric(maxterms) | |
# here<-0 | |
iterator <- 1 | |
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
test <- function() { | |
ui <- miniPage( | |
gadgetTitleBar("Test"), | |
miniContentPanel( | |
uiOutput("test") | |
) | |
) | |
server <- function(input,output,session) { |
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
# get library path | |
lib <- .libPaths()[1] | |
# does it end in 3.3? | |
if (grepl("*3.3",lib)) { | |
# if yes then assume old library is same place with 3.2 instead | |
oldlib <- gsub("*3.3","3.2",lib) | |
} | |
# check that old library exists |