This file contains hidden or 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(doSNOW) | |
| library(tcltk) | |
| cl <- makeSOCKcluster(2) | |
| registerDoSNOW(cl) | |
| pb <- txtProgressBar(max=100, style=3) | |
| progress <- function(n) setTxtProgressBar(pb, n) | |
| opts <- list(progress=progress) | |
| r <- foreach(i=1:100, .options.snow=opts) %dopar% { |
This file contains hidden or 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(foreach) | |
| library(iterators) | |
| library(doParallel) | |
| library(tcltk) | |
| # Choose number of iterations | |
| n <- 1000 | |
| cl <- makeCluster(8) |
This file contains hidden or 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 MKL threads if Revolution R Open or Revolution R Enterprise is available | |
| if(require("RevoUtilsMath")){ | |
| setMKLthreads(4) | |
| } | |
| # Initialization | |
| set.seed (1) |
This file contains hidden or 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
| ************* Preparing the environment for Debugger Extensions Gallery repositories ************** | |
| ExtensionRepository : Implicit | |
| UseExperimentalFeatureForNugetShare : true | |
| AllowNugetExeUpdate : true | |
| AllowNugetMSCredentialProviderInstall : true | |
| AllowParallelInitializationOfLocalRepositories : true | |
| -- Configuring repositories | |
| ----> Repository : LocalInstalled, Enabled: true |
This file contains hidden or 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
| import pandas # noqa: F401 (this line needed for Shinylive to load plotly.express) | |
| import plotly.express as px | |
| import plotly.graph_objs as go | |
| from shinywidgets import output_widget, render_widget | |
| from shiny import App | |
| from shiny import experimental as x | |
| from shiny import reactive, render, req, session, ui |
This file contains hidden or 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
| import pandas # noqa: F401 (this line needed for Shinylive to load plotly.express) | |
| import plotly.express as px | |
| import plotly.graph_objs as go | |
| from shinywidgets import output_widget, render_widget | |
| from shiny import App | |
| from shiny import experimental as x | |
| from shiny import reactive, render, req, session, ui |
This file contains hidden or 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("networkD3") | |
| library("igraph") | |
| # Download prepared igraph file from github | |
| url <- "https://github.com/andrie/cran-network-structure/blob/master/pdb/depGraph-CRAN.rds?raw=true" | |
| datafile <- tempfile(fileext = ".rds") | |
| download.file(url, destfile = datafile, mode = "wb") | |
| gs <- readRDS(datafile) | |
| # Remove all nodes with fewer than 50 edges |
This file contains hidden or 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
| # compute hilbert curve | |
| # inspired by https://logicgrimoire.wordpress.com/2020/06/19/how-to-draw-the-hilbert-curve-using-a-computer-program/ | |
| library(ggplot2) | |
| library(dplyr) | |
| library(magrittr) | |
| # rotate matrix | |
| rotate <- function(x, th = pi/2) { | |
| x %*% matrix(c(cos(th), -sin(th), sin(th), cos(th)), ncol = 2, byrow = TRUE) |
This file contains hidden or 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
| import {makeScene2D} from '@motion-canvas/2d/lib/scenes';; | |
| import {createRef} from '@motion-canvas/core/lib/utils'; | |
| import {all} from '@motion-canvas/core/lib/flow'; | |
| import {createSignal} from '@motion-canvas/core/lib/signals'; | |
| import {Polygon} from '../components/Polygon'; | |
| export default makeScene2D(function* (view) { | |
| const myPoly = createRef<Polygon>(); |
This file contains hidden or 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(repr) | |
| # Change plot size to 4 x 3 | |
| options(repr.plot.width=4, repr.plot.height=3) | |
| curve(sin(x), from = 0, to=2*pi, n = 100) | |
| # Change plot size to 8 x 3 | |
| options(repr.plot.width=8, repr.plot.height=3) | |
| curve(sin(x), from = 0, to=4*pi, n = 200) |
NewerOlder