Browse code

Rprofile - v0.2 - Correct terminal column display

Fred authored on21/10/2014 23:57:43
Showing1 changed files
... ...
@@ -1,8 +1,8 @@
1 1
 # Title: .Rprofile
2 2
 # Author: Frédéric CHEVALIER <f15.chevalier@gmail.com>
3
-# Version: 0.1
3
+# Version: 0.2
4 4
 # Created in: 2014-07-06
5
-# Modified in: 2014-08-06
5
+# Modified in: 2014-10-21
6 6
 
7 7
 
8 8
 
... ...
@@ -19,6 +19,7 @@
19 19
 # Versions #
20 20
 #==========#
21 21
 
22
+# v0.2 - 2014-10-21: bug correction about width of terminal
22 23
 # v0.1 - 2014-08-06: bug correction about interactivity (curly brackets missing)
23 24
 # v0.0 - 2014-07-06: creation
24 25
 
... ...
@@ -37,6 +38,10 @@ if (interactive()) {
37 38
 # Don't ask me for my CRAN mirror every time
38 39
 options("repos" = c(CRAN = "http://cran.revolutionanalytics.com"))
39 40
 
41
+# Enlarge columns display in R terminal
42
+# source: http://stackoverflow.com/questions/1172485/how-to-increase-the-number-of-columns-using-r-in-linux
43
+options(width=as.integer(system("stty -a | head -n 1 | awk '{print $7}' | sed 's/;//'", intern=TRUE)))
44
+
40 45
 
41 46
 
42 47
 #===========#
... ...
@@ -73,13 +78,6 @@ require(utils, quietly = TRUE)
73 78
 		cat("\n")
74 79
     }
75 80
 	
76
-	# Enlarge columns display in R terminal
77
-	# source: http://stackoverflow.com/questions/1172485/how-to-increase-the-number-of-columns-using-r-in-linux
78
-	wideScreen <- function(howWide=Sys.getenv("COLUMNS")) {
79
-		options(width=as.integer(howWide))
80
-	wideScreen()
81
-	}
82
-
83 81
 }
84 82
 
85 83