Browse code

script.R - v2.1 - Strucutre and plot saving updated

Fred authored on24/05/2015 23:07:04
Showing1 changed files
... ...
@@ -1,23 +1,23 @@
1 1
 #!/usr/bin/R
2
-# title :
3
-# version : 
4
-# author : Fédéric CHEVALIER
5
-# created in:
6
-# modified in:
2
+# Title:
3
+# Version: 
4
+# Author: Frédéric CHEVALIER
5
+# Created in:
6
+# Modified in:
7 7
 
8 8
 
9 9
 
10
-#----------#
11
-# Comments #
12
-#----------#
10
+#------#
11
+# Aims #
12
+#------#
13 13
 
14 14
 
15 15
 
16 16
 
17 17
 
18
-#-------------------#
19
-# Packages required #
20
-#-------------------#
18
+#-----------------#
19
+# Library loading #
20
+#-----------------#
21 21
 
22 22
 
23 23
 
... ...
@@ -26,7 +26,7 @@
26 26
 # Variables #
27 27
 #-----------#
28 28
 
29
-# Removing of all existing variables from the memory
29
+# Remove all variables from the memory
30 30
 rm(list = ls())
31 31
 
32 32
 # Data file
... ...
@@ -34,41 +34,48 @@ file <- ""
34 34
 
35 35
 data <- read.csv(file, header=T, sep=";")
36 36
 
37
-# Object contaning the input file name
37
+# Object containing the name of the data file
38 38
 name <- strsplit(file,".csv")
39 39
 
40 40
 
41 41
 
42 42
 #-----------------#
43
-# Data processing #
43
+# Data Processing #
44 44
 #-----------------#
45 45
 
46 46
 
47 47
 
48 48
 # Result export in folder
49 49
 if (file.exists("Results/") == FALSE) {dir.create("Results")}
50
-write.table(x, file=paste("Rsults/x",file, sep=""), col.names = NA, row.names = TRUE, sep=";") # x = object to sauve
50
+write.table(x, file=paste("Résultats/x",file, sep=""), col.names = NA, row.names = TRUE, sep=";") # x = object to save
51 51
 
52 52
 
53 53
 
54
-#--------#
55
-# Curves #
56
-#--------#
54
+#--------------------#
55
+# Graphical commands #
56
+#--------------------#
57 57
 
58 58
 
59 59
 
60 60
 
61
-#---------#
62
-# Figures #
63
-#---------#
61
+#------#
62
+# Plot #
63
+#------#
64 64
 
65 65
 
66 66
 
67 67
 
68 68
 
69
-# Folder creation for graphic output (if does not exist)
69
+# Create the graph folder if it do not already exist
70 70
 if (file.exists("Graphs/") == FALSE) {dir.create("Graphs")}
71 71
 
72
-# Graphic saving (png format)
73
-savePlot(paste("Graphs/",name,".png", sep=""))
72
+postscript(file=paste("Graphs/", name, ".ps", sep="")
73
+
74
+# Draw graph here
75
+
76
+dev.off()
77
+
78
+
79
+## Save the graph in png format
80
+#savePlot(paste("Graphs/",name,".png", sep=""))
74 81