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
require(reshape2) | |
require(rgl) | |
plot_rgl_model <- function(fdata){ | |
fdata <- fdata[order(fdata[, 1], fdata[, 2]), ] | |
orig_names <- colnames(fdata) | |
colnames(fdata) <- c("x", "y", "z") | |
fdata <- as.data.frame(fdata) |
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
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
vector<vector<int> > cart_product (const vector<vector<int>>& v) { | |
vector<vector<int>> s = {{}}; | |
for (auto& u : v) { | |
vector<vector<int>> r; |
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
#include <iostream> | |
#include <fstream> | |
#include <unistd.h> | |
void process_mem_usage(double& vm_usage, double& resident_set) | |
{ | |
vm_usage = 0.0; | |
resident_set = 0.0; | |
// the two fields we want |
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
// | |
// Based on code sent by Kevin Ushey | |
// to Rcpp-devel on Tue, 8 Jul 2014 | |
// | |
#ifndef LIST_BUILDER_H | |
#define LIST_BUILDER_H | |
#include <Rcpp.h> | |
using namespace Rcpp; |
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
# improved list of objects by Dirk | |
.ls.objects <- function (pos = 1, pattern, order.by, | |
decreasing=FALSE, head=FALSE, n=5) { | |
napply <- function(names, fn) sapply(names, function(x) | |
fn(get(x, pos = pos))) | |
names <- ls(pos = pos, pattern = pattern) | |
obj.class <- napply(names, function(x) as.character(class(x))[1]) | |
obj.mode <- napply(names, mode) | |
obj.type <- ifelse(is.na(obj.class), obj.mode, obj.class) | |
obj.size <- napply(names, object.size) |
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
# required: RGtk2 | |
calculateGUI <- function() { | |
## Run on "OK" | |
performStatistics <- function(button, user.data) { | |
res <- NULL | |
d <- NULL | |
error <- NULL | |
warning <- NULL | |
# Get the information about data and the file | |
the.file <- filename$getText() |
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
require('tcltk') | |
calcinp ='' | |
mkput = function(sym){ | |
function(...){ | |
calcinp <<- paste(calcinp,sym,sep='') | |
tkconfigure(display,text=calcinp) | |
} | |
} | |
clearit = function(...){ |
NewerOlder