Chargement...
 

Suivre les derniers ajouts

 ::  Flux RSS Coordination Groups
Flux RSS Homogeneous Groups
Custom stats Sidi Bibi

Number of Criteria per Question for Sidi Bibi


Error in setwd("export_stats_files/") : cannot change working directory
Execution halted

Dimensions for Sidi Bibi


Error in setwd("export_stats_files/") : cannot change working directory
Execution halted
R Code
dStart  <- 946684800
# Wikispiral basic request
# Generic request
# Loading libraries
library(RColorBrewer)
library(ggplot2)
library(plyr)

# Loading file
load(file="../../../export_stats_files/stats_4_R.Rda")
#Lang management
lang  <- "fr"
if(lang=="fr") tra <- langFR
if(lang=="ru") tra <- langRU

# Parameters consistency checking
# This is to avoid cryptic R error messages later
if( class(s4r$nbexpress)!="numeric" & class(s4r$nbexpress)!="integer" )
	stop('You must select an y variable of numeric type, like nbexpress')

## General correction of the file
# Removing unneeded levels and correcting values
s4r$nbexpress <- as.numeric(as.integer(s4r$nbexpress))
# Reduce the dataset with filters
s4r <- s4r[  s4r$CG=="Sidi Bibi" | s4r$CG=="Charleroi" , ]

# Locally filtering and reshaping the data and setting the variables
# (for better comprehension and titling - but check for the speed)
# Remove empty variablex
s4r <- s4r[!is.na(s4r$DIM),]
# Remove empty fill variable
s4r <- s4r[!is.na(s4r$question),]
# Remove empty faceting first variable
s4r <- s4r[!is.na(s4r$CG),]
# Remove non attributed criteria from dataset
s4r <- s4r[s4r$DIM!="N",]

#Aggregating data for criteria statistics
s4r <- droplevels(s4r)
s4r <- ddply(s4r, .(question, CG, DIM), summarize, sumvalue=sum(nbexpress, na.rm=TRUE))

# Basic definition of the plot
plot <- ggplot(s4r, aes(fill=question, x=DIM, y=sumvalue))

# Complete plotting
plot <- plot + geom_bar(stat="identity" , show_guide = FALSE  )  + scale_fill_manual(values = questcolors)  + guides(fill=guide_legend(reverse=FALSE))
# Relabelling
plot <- plot    + theme(axis.text=element_text(size=),  axis.title=element_text(size=,face="plain"), axis.text.x=element_text(angle=,hjust=1)) 
# Facetting and printing plot
plot <- plot + facet_wrap(~ CG, ncol=2 ) 
# Actually plot
plot
./temp/cache/R_page1389_Custom_stats_Sidi_Bibi/a66abb583a086cddab17ffbab87a6dce_1.png
DEBUG ECHO
dEnd  <- 1735239980
dStart  <- 946684800
# Wikispiral basic request
# Generic request
# Loading libraries
library(RColorBrewer)
library(ggplot2)
library(plyr)

# Loading file
load(file="../../../export_stats_files/stats_4_R.Rda")
#Lang management
lang  <- "fr"
if(lang=="fr") tra <- langFR
if(lang=="ru") tra <- langRU

# Parameters consistency checking
# This is to avoid cryptic R error messages later
if( class(s4r$nbexpress)!="numeric" & class(s4r$nbexpress)!="integer" )
	stop('You must select an y variable of numeric type, like nbexpress')

## General correction of the file
# Removing unneeded levels and correcting values
s4r$nbexpress <- as.numeric(as.integer(s4r$nbexpress))
# Reduce the dataset with filters
s4r <- s4r[  s4r$CG=="Sidi Bibi" | s4r$CG=="Charleroi" , ]

# Locally filtering and reshaping the data and setting the variables
# (for better comprehension and titling - but check for the speed)
# Remove empty variablex
s4r <- s4r[!is.na(s4r$DIM),]
# Remove empty fill variable
s4r <- s4r[!is.na(s4r$question),]
# Remove empty faceting first variable
s4r <- s4r[!is.na(s4r$CG),]
# Remove non attributed criteria from dataset
s4r <- s4r[s4r$DIM!="N",]

#Aggregating data for criteria statistics
s4r <- droplevels(s4r)
s4r <- ddply(s4r, .(question, CG, DIM), summarize, sumvalue=sum(nbexpress, na.rm=TRUE))

# Basic definition of the plot
plot <- ggplot(s4r, aes(fill=question, x=DIM, y=sumvalue))

# Complete plotting
plot <- plot + geom_bar(stat="identity" , show_guide = FALSE  )  + scale_fill_manual(values = questcolors)  + guides(fill=guide_legend(reverse=FALSE))
# Relabelling
plot <- plot    + theme(axis.text=element_text(size=),  axis.title=element_text(size=,face="plain"), axis.text.x=element_text(angle=,hjust=1)) 
# Facetting and printing plot
plot <- plot + facet_wrap(~ CG, ncol=2 ) 
# Actually plot
plot

Dernière modification de la page : Jeudi 27 février 2014 13:41:12 UTC