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
#Fix libraries | |
need<-c("jpeg","tcltk2","zoo") #needed libraries | |
ins<-installed.packages()[,1] #find out which libs are installed | |
(Get<-need[which(is.na(match(need,ins)))]) | |
if(length(Get)>0){install.packages(Get)} #install needed libs | |
eval(parse(text=paste("library(",need,")")))#load libraries | |
#load imagefile | |
jpegfile<-tk_choose.files(caption="JPEG FILE") |
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
#A short script to help installing packages on the go | |
#Most useful if you are distributing a set of script files to people who may not be aware that the needed packages are not installed | |
#Also useful if you use many packages and want to organise their loading at the beginning of a script | |
need<-c("jpeg","tcltk2","zoo") #needed packages for a job | |
ins<-installed.packages()[,1] #find out which packages are installed | |
(Get<-need[which(is.na(match(need,ins)))]) # check if the needed packages are installed | |
if(length(Get)>0){install.packages(Get)} #install the needed packages if they are not-installed | |
eval(parse(text=paste("library(",need,")")))#load the needed packages |
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
dat<-data.frame(x=Duration, y=as.numeric(idfkurve["2",])) | |
#polynomial fit | |
library(MASS) | |
LFts<-6 | |
Fits<-vector("list",length=LFts) | |
for(i in 1:LFts){ | |
Fits[[i]]$fit <-lm(y~poly(x,i),data=dat); | |
Fits[[i]]$col=i | |
Fits[[i]]$AIC=round(AIC(Fits[[i]]$fit ),0) | |
Fits[[i]]$coef=coef(Fits[[i]]$fit) |
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
install.packages(c("rscproxy","rcom"),repos="http://rcom.univie.ac.at/download",lib=.Library) | |
installstatconnDCOM() | |
library(rcom) | |
comRegisterRegistry() | |
download.file(url="http://rcom.univie.ac.at/download/RExcel.distro/RExcelInst.latest.exe",mode="wb",destfile="Rexcel.exe") | |
system("Rexcel.exe") | |
install.packages(c("Rcmdr","RcmdrPlugin.HH"),lib=.Library,dep=TRUE) | |
library(Rcmdr) |
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
World cup data analysis script!! | |
The data in cup.txt is taken from wikipedia(http://en.wikipedia.org/wiki/2014_FIFA_World_Cup_squads). the script cup.r analyses the data to create interesting charts about the 2014 world cup squads. Charts include boxplots og age, number of home/foreign based players for each country, clubs with more than 4 players in the world cup and leagues with more than 10 players in the World cup. | |
The data shows that the youngest team is the Netherlands(Dutch) team is the youngest. Only Mexico, Netherlands, Spain, England, Italy, Russia, germany and Iran have more home-based players than foreign based players. Most teams have less players based in their home countries. The European clubs dominate the number of clubs with the most players in the worls cup (gaian not a suprise)!! The world cup 2014 appears to be a sort of "European Cup"!! |
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 <string> | |
using namespace std; | |
class Div{//Module Divison or Spillway | |
public: | |
int id; | |
int ds; //Downstream module | |
float H[10];//elevation curve (moh) | |
float Q[10];//Outflow Curve (m3/s) Q[10][] |