├── Commands ├── CRAN Packages.tmCommand ├── Completion….tmCommand ├── Copy Result into Pasteboard.tmCommand ├── Create Matrix from Selection.tmCommand ├── Create Vector from Selection.tmCommand ├── Descriptives….tmCommand ├── Edit user-defined Function Parameter.tmCommand ├── Evaluate Selection:Line in R_app & Step.tmCommand ├── Function Call.tmCommand ├── Function Definition.tmCommand ├── Help.tmCommand ├── Insert Result.tmCommand ├── Load Library using "library".tmCommand ├── Load Library using "require".tmCommand ├── Option List as Pull Down… : BoolToggler.tmCommand ├── Package Name….tmCommand ├── Plots….tmCommand ├── Prefix Package Name current Function.tmCommand ├── R Web Search for Word:Selection.tmCommand ├── RSiteSearch for Word:Selection.tmCommand ├── R_app.tmCommand ├── Rd Insert arguments tag.tmCommand ├── Rd Preview as HTML.tmCommand ├── Rdaemon.tmCommand ├── Run Selection:Document In R.tmCommand ├── Show File Header.tmCommand ├── Show Function Usage.tmCommand ├── Show R Documentation.tmCommand ├── Show R Help for actual Word:Selection.tmCommand ├── Show Result as Tooltip.tmCommand ├── Summaries….tmCommand ├── Terminate Helper Daemon.tmCommand ├── Tidy.tmCommand ├── “ <- ”.tmCommand ├── “par()” Parameters….tmCommand └── “require(xxx)” for current Function.tmCommand ├── DragCommands ├── load (*_Rdata).tmDragCommand ├── read_csv (*_csv).tmDragCommand ├── read_spss (*_sav).tmDragCommand ├── read_table (*_tab).tmDragCommand └── source (*_R).tmDragCommand ├── Macros ├── Function Parameters….tmMacro ├── Next List Element:Parameter Value.tmMacro ├── Previous List Element:Parameter Value.tmMacro └── Show Function Usage + Insert “(”.tmMacro ├── Preferences ├── Comments.plist ├── Folding - Documentation.tmPreferences ├── Folding - R.tmPreferences ├── Indentation Rules.tmPreferences ├── Methods.tmPreferences ├── Symbol List (Rd Documentation).tmPreferences └── Symbol List: Pragma.tmPreferences ├── README.mdown ├── Snippets ├── Add Tick Marks.tmSnippet ├── Attach.tmSnippet ├── Cummulative.tmSnippet ├── Density.tmSnippet ├── Detach.tmSnippet ├── Divide Into Intervals.tmSnippet ├── Factor.tmSnippet ├── For Loop.tmSnippet ├── Function.tmSnippet ├── Ifelse.tmSnippet ├── Length.tmSnippet ├── Load Dataset.tmSnippet ├── Polygonal Line.tmSnippet ├── Read From File.tmSnippet ├── Sequence (from,to,by).tmSnippet ├── Sort.tmSnippet ├── Source.tmSnippet ├── file_choose.tmSnippet └── na_omit.tmSnippet ├── Support ├── Rmate.css ├── bin │ ├── ProcessHelpFiles.rb │ ├── RhelperDaemon.rb │ ├── RhelperScript.R │ ├── Rsearch.sh │ ├── askRhelperDaemon.sh │ ├── auto_show_func_usage.sh │ ├── initCommandArgsDir.sh │ ├── insert_command_template.rb │ ├── insert_function_param.sh │ ├── insert_package_name.sh │ ├── parseDocForFunctions.sh │ ├── parseHTMLForUsage.sh │ ├── prefix_package_name.sh │ ├── startRhelperDaemon.sh │ └── startRhelperbuilder.sh ├── getSig.R ├── getSigTest.R ├── lib │ ├── command_args │ │ ├── dist │ │ ├── getOption │ │ ├── lines │ │ ├── mean │ │ ├── options │ │ ├── par │ │ ├── plot │ │ └── points │ ├── help.markdown │ ├── historyList.rb │ ├── parsing.rb │ └── popen3.rb ├── pastel.css ├── tests │ ├── historytestFile.Rconsole │ └── testHistoryList.rb └── tmR.rb ├── Syntaxes ├── R.plist └── Rd (R Documentation).tmLanguage └── info.plist /Commands/CRAN Packages.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | CRAN="http://cran.cnr.berkeley.edu" 9 | SOFILE="$HOME/Library/Application Support/Rdaemon/startOptions.R" 10 | if [ -f "$SOFILE" ]; then 11 | RES=$(cat "$SOFILE" | egrep 'options.*?repos.*?list' | perl -pe 's/^\s*options\s*.*?repos\s*=\s*.*?[\x{27}"](.*?)[\x{27}"].*/$1/g' | tail -n 1) 12 | [[ ! -z "$RES" ]] && [[ "${RES:0:4}" == "http" ]] && CRAN="$RES" 13 | fi 14 | open "$CRAN/web/packages/" 15 | input 16 | none 17 | name 18 | CRAN Packages 19 | output 20 | showAsTooltip 21 | scope 22 | source.r 23 | uuid 24 | 2A3C3EF9-2043-4304-81EC-EA3309286F98 25 | 26 | 27 | -------------------------------------------------------------------------------- /Commands/Completion….tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | 9 | export WORD=$(ruby18 -- <<-SCR1 10 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/current_word.rb") 11 | word = Word.current_word('\w\.') 12 | print word 13 | SCR1 14 | ) 15 | 16 | #check whether WORD is defined otherwise quit 17 | [[ -z "$WORD" ]] && echo "No keyword found" && exit_show_tool_tip 18 | 19 | RhelperAnswer="/tmp/textmate_Rhelper_out" 20 | 21 | WORDORG="$WORD" 22 | RD=$(echo -n "$TM_SCOPE" | grep -c -F 'source.rd.console') 23 | 24 | if [ $RD -gt 0 ]; then 25 | RDHOME="$HOME/Library/Application Support/Rdaemon" 26 | if [ "$TM_RdaemonRAMDRIVE" == "1" ]; then 27 | RDRAMDISK="/tmp/TMRramdisk1" 28 | else 29 | RDRAMDISK="$RDHOME" 30 | fi 31 | 32 | #get R's PID 33 | RPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' ) 34 | 35 | #check whether Rdaemon runs 36 | if [ -z $RPID ]; then 37 | RDTEXT="Rdaemon is not running." 38 | else 39 | [[ -e "$RDRAMDISK"/r_tmp ]] && rm "$RDRAMDISK"/r_tmp 40 | TASK="@|sink('$RDRAMDISK/r_tmp')" 41 | echo -e "$TASK" > "$RDHOME"/r_in 42 | TASK="@|cat(paste(apropos('^${WORD}'),'|OK',sep='',collapse='\\\n'))" 43 | echo -e "$TASK" > "$RDHOME"/r_in 44 | TASK="@|sink(file=NULL)" 45 | echo -e "$TASK" > "$RDHOME"/r_in 46 | 47 | #get R's PID 48 | RPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' ) 49 | #check whether Rdaemon runs 50 | test -z $RPID && echo -en "Rdaemon is not running." && exit 206 51 | 52 | while [ 1 ] 53 | do 54 | RES=$(tail -c 2 "$RDRAMDISK"/r_out) 55 | #expect these things from R 56 | [[ "$RES" == "> " ]] && break 57 | [[ "$RES" == "+ " ]] && break 58 | [[ "$RES" == ": " ]] && break 59 | sleep 0.05 60 | done 61 | sleep 0.001 62 | LOCAL=$(cat "$RDRAMDISK"/r_tmp | sort) 63 | fi 64 | fi 65 | 66 | [[ $RD -eq 0 ]] && LOCAL=$(cat | grep '<\- *function' | perl -pe 's/\t//g;s/ *(.*?) *<\-.*/$1|OK/' | sort | egrep -i "^${WORD//./\\.}") 67 | 68 | #get suggestions 69 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getCompletionList('$WORD',T)" 70 | RES=$(cat "$RhelperAnswer") 71 | RES=$(echo -e "$LOCAL"; echo -en "$RES") 72 | 73 | ruby18 -- <<-SCRIPT 2> /dev/null 74 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/exit_codes.rb") 75 | require "#{ENV["TM_SUPPORT_PATH"]}/lib/ui" 76 | word = "$WORD" 77 | wordorg = "$WORDORG" 78 | text = "$RES" 79 | funs = text.gsub(/\n{2,}/,"\n").split("\n") 80 | 81 | rdfuns = funs.select {|x| x =~ /\|OK$/ } 82 | rdfuns.collect! {|x| x.gsub(/\|OK$/, "") } 83 | funs.delete_if {|x| x.match('\|OK$') } 84 | f1 = funs.collect{|item| item.gsub(/\t.*/, "")} 85 | rdfuns.sort! {|x,y| y <=> x } 86 | rdfuns.each_index do |i| 87 | if ! f1.include?(rdfuns[i]) && rdfuns[i].length > 0 88 | funs.unshift(rdfuns[i] + " local" ) 89 | end 90 | end 91 | 92 | funs.delete_if {|x| x.match('[,\- ]') } 93 | funs.delete_if {|x| x.match('matrices.*rgl') } 94 | funs.delete_if {|x| x.match('^\s*$') } 95 | if "$RD" == "1" 96 | funs.collect! do |x| 97 | if rdfuns.include?(x.gsub(/\t.*/,"")) 98 | x= "%s   …%s…" % x.split("\t") 99 | else 100 | x= "%s   {%s}" % x.split("\t") 101 | end 102 | end 103 | else 104 | funs.collect! do |x| 105 | if rdfuns.include?(x.gsub(/\t.*/,"")) 106 | x= "%s   …%s…" % x.split("\t") 107 | else 108 | x= "%s   [%s]" % x.split("\t") 109 | end 110 | end 111 | end 112 | 113 | functions = funs.select{|item| item =~ /^#{word.gsub(".","\\.")}/} 114 | func = funs.select{|item| item !~ /^#{word.gsub(".","\\.")}/} 115 | fp = func.join("\n") 116 | if (functions.size < 1 && (ENV['TM_SELECTED_TEXT'].nil? || ENV['TM_SELECTED_TEXT'].empty?)) then 117 | if fp.size > 0 118 | TextMate.exit_show_tool_tip("Only found :\n#{fp}") 119 | else 120 | TextMate.exit_show_tool_tip("Nothing found") 121 | end 122 | end 123 | 124 | if (! ENV['TM_SELECTED_TEXT'].nil? && ! ENV['TM_SELECTED_TEXT'].empty?) then 125 | functions.replace(funs) 126 | end 127 | 128 | if (functions.size == 1 && (ENV['R_AUTOCOMPLETE'].to_i == 1 || ENV['TM_R_AUTOCOMPLETE'].to_i == 1)) 129 | function = functions.first 130 | else 131 | isDIALOG2 = ! ENV["DIALOG"].match(/2$/).nil? 132 | if isDIALOG2 133 | fn = [] 134 | functions.each do |f| 135 | fn << {'insert' => "\${1:(\${2:})}", 'display' => f, 'match' => f.gsub(/\s.*/,"")} 136 | end 137 | TextMate::UI.complete(fn, :extra_chars => '.') 138 | TextMate.exit_discard 139 | else 140 | idx = TextMate::UI.menu(functions) 141 | TextMate.exit_discard if idx.nil? 142 | function = functions[idx] 143 | end 144 | end 145 | # TextMate.exit_discard if function.empty? 146 | if ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty? 147 | print function.gsub!(/\s.*/,"")[wordorg.length..-1] 148 | else 149 | print function.gsub!(/\s.*/,"") 150 | end 151 | SCRIPT 152 | 153 | fallbackInput 154 | none 155 | input 156 | document 157 | keyEquivalent 158 | ^. 159 | name 160 | Completion… 161 | output 162 | insertAsSnippet 163 | scope 164 | source.r, source.rd.console 165 | uuid 166 | 8A17F5A3-7E52-4C6D-AA70-99476FB82625 167 | 168 | 169 | -------------------------------------------------------------------------------- /Commands/Copy Result into Pasteboard.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | cat | R --vanilla --slave --no-readline --encoding=UTF-8 | pbcopy 9 | input 10 | selection 11 | keyEquivalent 12 | ^@r 13 | name 14 | Copy Result into Pasteboard 15 | output 16 | showAsTooltip 17 | scope 18 | source.r 19 | uuid 20 | C666D732-9E4D-49C7-BEEC-BC20590414BF 21 | 22 | 23 | -------------------------------------------------------------------------------- /Commands/Create Matrix from Selection.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 9 | require ENV['TM_SUPPORT_PATH'] + "/lib/escape.rb"; 10 | text = STDIN.read 11 | text = `pbpaste` if text.empty? 12 | text << "\n" if ! text.match(/\n$/) 13 | rcnt = text.count "\n" 14 | 15 | text.gsub!(/(^\s+|\s+$)/,"") 16 | text.gsub!(/\s{1,}/," ") 17 | print "${1:${2:x} <- }matrix(c(" 18 | out = Array.new 19 | $LFlag = '' 20 | text.split.each{|b| 21 | $LFlag = '' 22 | if b.match(/^\d+L$/) 23 | $LFlag = 'L' 24 | b.gsub!(/L$/, '') 25 | end 26 | if (b.to_f == 0 && ! b.match(/-?\.?0\.?0*/) && ! b.match(/^["'].*["']$/)) || b.match(/^\d+[^\d\-\.eE]+/) 27 | out << '"' + e_sn(b) + '"' 28 | else 29 | out << e_sn(b) + $LFlag 30 | end 31 | } 32 | print out.join(', ') 33 | print "), nrow=#{rcnt}, byrow=TRUE)" 34 | 35 | 36 | 37 | #print "${1:${2:x} <- }matrix(c("+e_sn(text).sub(/\s+$/,"").gsub(/([a-zA-Z]+)/, '"\1"').gsub(/\s+/,", ") + "), nrow=#{rcnt}, byrow=TRUE)" 38 | fallbackInput 39 | none 40 | input 41 | selection 42 | keyEquivalent 43 | ^~c 44 | name 45 | Create Matrix from Selection 46 | output 47 | insertAsSnippet 48 | scope 49 | source.r, source.rd.console 50 | uuid 51 | BC6C2055-67E1-4902-98B0-AACDFEE031BB 52 | 53 | 54 | -------------------------------------------------------------------------------- /Commands/Create Vector from Selection.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 -wKU 9 | require ENV['TM_SUPPORT_PATH'] + "/lib/escape.rb"; 10 | text = STDIN.read 11 | text = `pbpaste` if text.empty? 12 | text.gsub!(/(^\s+|\s+$)/,"") 13 | text.gsub!(/\s{1,}/," ") 14 | print "${1:${2:x} <- }c(" 15 | out = Array.new 16 | $LFlag = '' 17 | text.split.each{|b| 18 | $LFlag = '' 19 | if b.match(/^\d+L$/) 20 | $LFlag = 'L' 21 | b.gsub!(/L$/, '') 22 | end 23 | if (b.to_f == 0 && ! b.match(/-?\.?0\.?0*/) && ! b.match(/^["'].*["']$/)) || b.match(/^\d+[^\d\-\.eE]+/ ) 24 | out << '"' + e_sn(b) + '"' 25 | else 26 | out << e_sn(b) + $LFlag 27 | end 28 | } 29 | print out.join(', ') 30 | print ")" 31 | 32 | fallbackInput 33 | none 34 | input 35 | selection 36 | keyEquivalent 37 | ^~c 38 | name 39 | Create Vector from Selection 40 | output 41 | insertAsSnippet 42 | scope 43 | source.r, source.rd.console 44 | uuid 45 | F61688AA-C298-4D58-A9DE-87891797B2F9 46 | 47 | 48 | -------------------------------------------------------------------------------- /Commands/Descriptives….tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 9 | # print "Got:" + STDIN.read 10 | 11 | require ENV['TM_SUPPORT_PATH'] +'/lib/ui.rb' 12 | require ENV['TM_SUPPORT_PATH'] +'/lib/exit_codes.rb' 13 | opts = { "Mean" => "mean(${1:x})", 14 | "Variance" => "var(${1:x})", 15 | "Std. Dev." => "sd(${1:x})", 16 | "Correlation" => "cor(${1:x})", 17 | "Five Num Sum" => "fivenum(${1:x})", 18 | "Quantiles" => "quantile(${1:x},${2:quantiles})", 19 | "Median" => "median(${1:x})", 20 | "Max" => "max(${1:x}${2:, na.rm=TRUE})", 21 | "Min" => "min(${1:x}${2:, na.rm=TRUE})", 22 | "Range" => "range(${1:x}${2:, na.rm=TRUE})" 23 | } 24 | keys = opts.keys.sort 25 | ans = TextMate::UI.menu(keys) 26 | TextMate.exit_discard unless ans 27 | print opts[keys[ans]] 28 | fallbackInput 29 | word 30 | input 31 | none 32 | keyEquivalent 33 | ~@D 34 | name 35 | Descriptives… 36 | output 37 | insertAsSnippet 38 | scope 39 | source.r, source.rd.console 40 | uuid 41 | 6BC03260-79E4-47B6-87CE-020BD066E0FB 42 | 43 | 44 | -------------------------------------------------------------------------------- /Commands/Edit user-defined Function Parameter.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | WDIR="$HOME/Library/Application Support/TextMate/R/help/command_args" 9 | 10 | "$TM_BUNDLE_SUPPORT"/bin/initCommandArgsDir.sh 11 | 12 | mate "$WDIR" 13 | input 14 | none 15 | name 16 | Edit user-defined Function Parameter 17 | output 18 | showAsTooltip 19 | scope 20 | source.r, source.rd.console 21 | uuid 22 | BED22435-E025-4C52-9CC5-08B4296F524F 23 | 24 | 25 | -------------------------------------------------------------------------------- /Commands/Evaluate Selection:Line in R_app & Step.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env bash 9 | 10 | # input is selection or document 11 | rawText="`cat`" 12 | 13 | curDir='' 14 | if [[ ${#TM_DIRECTORY} -gt 0 ]]; then 15 | curDir="$TM_DIRECTORY" 16 | fi 17 | 18 | osascript -e 'on run(theCode)' \ 19 | -e 'tell application "R" to activate' \ 20 | -e 'if (item 2 of theCode) is not "" then tell application "R" to cmd "setwd('\''" & (item 2 of theCode) & "'\'')"' \ 21 | -e 'tell application "R" to cmd (item 1 of theCode)' \ 22 | -e 'end run' -- "$rawText" "$curDir" 23 | 24 | if [ "$TM_LINE_NUMBER" != "" ]; then 25 | "$TM_MATE" -l "$(($TM_LINE_NUMBER+1)):1000000" 26 | elif [[ $TM_SELECTION =~ [1-9][0-9]*:?[0-9]*-([1-9][0-9]*):?[0-9]* ]]; then 27 | # Regular Selection 28 | "$TM_MATE" -l "$((${BASH_REMATCH[1]}+1)):1000000" 29 | elif [[ $TM_SELECTION =~ [1-9][0-9]*:?[0-9]*x([1-9][0-9]*):?[0-9]* ]]; then 30 | # Block (option) selection 31 | "$TM_MATE" -l "$((${BASH_REMATCH[1]}+1)):1000000" 32 | else 33 | "$TM_MATE" 34 | fi 35 | 36 | fallbackInput 37 | line 38 | input 39 | selection 40 | inputFormat 41 | text 42 | keyEquivalent 43 | ~$ 44 | name 45 | R.app & Step 46 | outputCaret 47 | afterOutput 48 | outputFormat 49 | text 50 | outputLocation 51 | discard 52 | scope 53 | source.r 54 | uuid 55 | ED52D514-DDB8-4D8C-BE0C-F791C70F530A 56 | version 57 | 2 58 | 59 | 60 | -------------------------------------------------------------------------------- /Commands/Function Call.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 9 | require ENV['TM_SUPPORT_PATH'] +'/lib/escape.rb' 10 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/current_word.rb") 11 | if ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty? 12 | word = Word.current_word('\w\.') 13 | else 14 | word = ENV['TM_SELECTED_TEXT'] 15 | end 16 | line, col = ENV['TM_CURRENT_LINE'], ENV['TM_LINE_INDEX'].to_i 17 | left = line[0...(col - word.length)].to_s 18 | right = line[col..-1].to_s 19 | if ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty? 20 | print "#{e_sn(left)}${1:sum}(#{e_sn(word)})#{e_sn(right)}" 21 | else 22 | print "${1:#{ENV['TM_R_WRAP_DEFAULT_FUNCTION']?ENV['TM_R_WRAP_DEFAULT_FUNCTION']:'sum'}}(#{e_sn(word)})" 23 | end 24 | fallbackInput 25 | line 26 | input 27 | selection 28 | keyEquivalent 29 | ^W 30 | name 31 | Function Call 32 | output 33 | insertAsSnippet 34 | scope 35 | source.r, source.rd.console 36 | uuid 37 | 769AC12C-9EDF-4089-8834-062A301907ED 38 | 39 | 40 | -------------------------------------------------------------------------------- /Commands/Function Definition.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 9 | #require ENV['TM_SUPPORT_PATH'] +'/lib/escape.rb' 10 | #print "${1:${2:x} <- }function(${3:var}) {\n#{if s = ENV['TM_SELECTED_TEXT'] then e_sn(s.chomp.gsub(/(\A|\n)/,"\\1\t")) else "\t\$4" end}\n}" 11 | 12 | require ENV['TM_SUPPORT_PATH'] +'/lib/escape.rb' 13 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/current_word.rb") 14 | if ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty? 15 | word = Word.current_word('\w\.') 16 | else 17 | word = ENV['TM_SELECTED_TEXT'] 18 | end 19 | line, col = ENV['TM_CURRENT_LINE'], ENV['TM_LINE_INDEX'].to_i 20 | left = line[0...(col - word.length)].to_s 21 | right = line[col..-1].to_s 22 | if ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty? 23 | print "#{e_sn(left)}${1:${2:x} <- }function(${3:var}) {\n\t#{e_sn(word)}\$4\n}#{e_sn(right)}" 24 | else 25 | print "${1:${2:x} <- }function(${3:var}) {\n\t#{e_sn(word)}\$4\n}" 26 | end 27 | fallbackInput 28 | line 29 | input 30 | selection 31 | keyEquivalent 32 | ^@W 33 | name 34 | Function Definition 35 | output 36 | insertAsSnippet 37 | scope 38 | source.r, source.rd.console 39 | uuid 40 | 4C1A1536-31FF-4FF5-B0C5-CD47D21CFD52 41 | 42 | 43 | -------------------------------------------------------------------------------- /Commands/Help.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | 9 | # clean unused file 10 | rm -f "$TM_BUNDLE_SUPPORT/help.index" 11 | rm -f "$TM_BUNDLE_SUPPORT/helpshort.index" 12 | rm -f "$TM_BUNDLE_SUPPORT/help.pkgs" 13 | rm -f "$TM_BUNDLE_SUPPORT/libpaths" 14 | rm -f "$TM_BUNDLE_SUPPORT/httpPort" 15 | rm -f "$TM_BUNDLE_SUPPORT/isHelpServer" 16 | rm -f "$TM_BUNDLE_SUPPORT/lib/data.html" 17 | rm -f "$TM_BUNDLE_SUPPORT/lib/head.html" 18 | rm -f "$TM_BUNDLE_SUPPORT/lib/search.html" 19 | 20 | . "$TM_SUPPORT_PATH/lib/webpreview.sh" 21 | html_header "R Bundle Help" "R" 22 | "$TM_SUPPORT_PATH/lib/markdown_to_help.rb" "$TM_BUNDLE_SUPPORT/lib/help.markdown" 23 | html_footer 24 | 25 | input 26 | none 27 | name 28 | Help 29 | output 30 | showAsHTML 31 | scope 32 | source.r -source.rd.console -source.rapp-console 33 | uuid 34 | 8A8B6803-AF20-47EC-9382-62E1EBA76B4A 35 | 36 | 37 | -------------------------------------------------------------------------------- /Commands/Insert Result.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | if [ -z "$TM_SELECTED_TEXT" ]; then 9 | echo 10 | cat | R --vanilla --slave --no-readline --encoding=UTF-8 11 | else 12 | cat | R --vanilla --slave --no-readline --encoding=UTF-8 13 | exit_replace_text 14 | fi 15 | input 16 | selection 17 | keyEquivalent 18 | ^@r 19 | name 20 | Insert Result 21 | output 22 | afterSelectedText 23 | scope 24 | source.r 25 | uuid 26 | 99E59A8E-A7DC-4CB0-AA51-6305921D3411 27 | 28 | 29 | -------------------------------------------------------------------------------- /Commands/Load Library using "library".tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | echo -en 'library(${1:"${2:`"$TM_BUNDLE_SUPPORT"/bin/insert_package_name.sh`}"})${0:}' 9 | input 10 | none 11 | name 12 | Load Library using “library” 13 | output 14 | insertAsSnippet 15 | scope 16 | source.r, source.rd.console 17 | tabTrigger 18 | lib 19 | uuid 20 | 2EBC36A2-A927-4AEC-99A1-9F06C88B6844 21 | 22 | 23 | -------------------------------------------------------------------------------- /Commands/Load Library using "require".tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | echo -en 'require(${1:"${2:`"$TM_BUNDLE_SUPPORT"/bin/insert_package_name.sh`}"})${0:}' 9 | input 10 | none 11 | name 12 | Load Library using “require” 13 | output 14 | insertAsSnippet 15 | scope 16 | source.r, source.rd.console 17 | tabTrigger 18 | req 19 | uuid 20 | C2ADF348-D6FE-45B5-8BCC-A62B912A881B 21 | 22 | 23 | -------------------------------------------------------------------------------- /Commands/Option List as Pull Down… : BoolToggler.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | LIST=$(cat) 9 | [[ -z "$LIST" ]] && exit_discard 10 | echo -en "$LIST" | ruby18 -e ' 11 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/ui.rb") 12 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/exit_codes.rb") 13 | words = STDIN.read().split("|") 14 | if words.size == 1 15 | if words[0] == "TRUE" || words[0] == "FALSE" || words[0] == "T" || words[0] == "F" 16 | print "FALSE" if words[0] == "TRUE" 17 | print "TRUE" if words[0] == "FALSE" 18 | print "F" if words[0] == "T" 19 | print "T" if words[0] == "F" 20 | else 21 | TextMate.exit_discard() 22 | end 23 | else 24 | index=TextMate::UI.menu(words) 25 | if index != nil 26 | if words[index].match("\-") 27 | print words[index].gsub!(/\-.*/,"") 28 | else 29 | print words[index] 30 | end 31 | else 32 | TextMate.exit_discard() 33 | end 34 | end 35 | ' 36 | 37 | 38 | fallbackInput 39 | word 40 | input 41 | selection 42 | keyEquivalent 43 | ^ 44 | name 45 | Option List as Pull Down… / BoolToggler 46 | output 47 | replaceSelectedText 48 | scope 49 | source.r, source.rd.console 50 | uuid 51 | B2612EB0-22A3-4D09-A851-721EA294DF13 52 | 53 | 54 | -------------------------------------------------------------------------------- /Commands/Package Name….tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | "$TM_BUNDLE_SUPPORT"/bin/insert_package_name.sh 9 | input 10 | none 11 | keyEquivalent 12 | ~@L 13 | name 14 | Package Name… 15 | output 16 | discard 17 | scope 18 | source.r, source.rd.console 19 | uuid 20 | 18B3BAF5-A2E0-43A6-9017-56E1D365A055 21 | 22 | 23 | -------------------------------------------------------------------------------- /Commands/Plots….tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 9 | # print "Got:" + STDIN.read 10 | 11 | require ENV['TM_SUPPORT_PATH'] +'/lib/ui.rb' 12 | require ENV['TM_SUPPORT_PATH'] +'/lib/exit_codes.rb' 13 | opts = { "Formula" => "plot(${1:y~x}${2:, data=${3:frame})", 14 | "Bar Graph" => "barplot(${1:table(${2:x})})", 15 | "Pie Chart" => "pie(${1:x}${2:, col=c(${3:colors})})", 16 | "Histogram" => "hist(${1:x}${2:, breaks = ${3:8}})", 17 | "Box Plot" => "boxplot(${1:x}${2:, horizontal = TRUE})", 18 | "Scatterplot" => "plot(${1:x})"} 19 | keys = opts.keys.sort 20 | ans = TextMate::UI.menu(keys) 21 | TextMate.exit_discard unless ans 22 | print opts[keys[ans]] 23 | fallbackInput 24 | word 25 | input 26 | none 27 | keyEquivalent 28 | ~@P 29 | name 30 | Plots… 31 | output 32 | insertAsSnippet 33 | scope 34 | source.r, source.rd.console 35 | uuid 36 | 90EA3ACF-121E-4BBA-B1EB-3F461BCBDC8D 37 | 38 | 39 | -------------------------------------------------------------------------------- /Commands/Prefix Package Name current Function.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | "$TM_BUNDLE_SUPPORT"/bin/prefix_package_name.sh 9 | fallbackInput 10 | line 11 | input 12 | selection 13 | keyEquivalent 14 | ^~L 15 | name 16 | Prefix Package Name to current Function 17 | output 18 | insertAsSnippet 19 | scope 20 | source.r, source.rd.console 21 | uuid 22 | 7657BD74-1736-49B9-9AB1-4A10E256D484 23 | 24 | 25 | -------------------------------------------------------------------------------- /Commands/R Web Search for Word:Selection.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env bash 9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" 10 | 11 | 12 | if [ -z "$TM_SELECTED_TEXT" ]; then 13 | WORD=$(ruby18 -- <<-SCR1 14 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/current_word.rb") 15 | word = Word.current_word('\w\.') 16 | word.gsub!(/^[\d\.\-]+$/,"") 17 | print word 18 | SCR1 19 | ) 20 | else 21 | WORD=$TM_SELECTED_TEXT 22 | fi 23 | 24 | if [ -z "$WORD" ]; then 25 | open "http://www.rseek.org" 26 | else 27 | open "http://www.rseek.org/?cx=010923144343702598753%3Aboaz1reyxd4&q=$WORD&sa=Search+functions%2C+lists%2C+and+more&cof=FORID%3A11" 28 | fi 29 | 30 | fallbackInput 31 | word 32 | input 33 | selection 34 | inputFormat 35 | text 36 | keyEquivalent 37 | ^~@H 38 | name 39 | RSeek Search for Word / Selection 40 | outputCaret 41 | afterOutput 42 | outputFormat 43 | text 44 | outputLocation 45 | toolTip 46 | scope 47 | source.r, source.rd.console 48 | uuid 49 | 4DCF1FF7-D104-43C3-B0E3-8333A50CA5AA 50 | version 51 | 2 52 | 53 | 54 | -------------------------------------------------------------------------------- /Commands/RSiteSearch for Word:Selection.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env bash 9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" 10 | 11 | 12 | if [ -z "$TM_SELECTED_TEXT" ]; then 13 | WORD=$(ruby18 -- <<-SCR1 14 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/current_word.rb") 15 | word = Word.current_word('\w\.') 16 | word.gsub!(/^[\d\.\-]+$/,"") 17 | print word 18 | SCR1 19 | ) 20 | else 21 | WORD=$TM_SELECTED_TEXT 22 | fi 23 | 24 | if [ -z "$WORD" ]; then 25 | open "http://search.r-project.org/" 26 | else 27 | W=`echo -en "$WORD" | sed 's/ {1,}/+/g'` 28 | open "http://search.r-project.org/cgi-bin/namazu.cgi?query=$W&max=20&result=normal&sort=score&idxname=Rhelp02a&idxname=functions&idxname=docs" 29 | fi 30 | 31 | fallbackInput 32 | word 33 | input 34 | selection 35 | inputFormat 36 | text 37 | keyEquivalent 38 | ^~@H 39 | name 40 | RSite Search for Word / Selection 41 | outputCaret 42 | afterOutput 43 | outputFormat 44 | text 45 | outputLocation 46 | toolTip 47 | scope 48 | source.r, source.rd.console 49 | uuid 50 | B26AF49E-C737-41D4-990F-5BBB138B3FCD 51 | version 52 | 2 53 | 54 | 55 | -------------------------------------------------------------------------------- /Commands/R_app.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env bash 9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" 10 | 11 | # input is selection or document 12 | rawText="`cat`" 13 | 14 | curDir='' 15 | if [[ ${#TM_DIRECTORY} -gt 0 ]]; then 16 | curDir="$TM_DIRECTORY" 17 | fi 18 | 19 | osascript -e 'on run(theCode)' \ 20 | -e 'tell application "R" to activate' \ 21 | -e 'if (item 2 of theCode) is not "" then tell application "R" to cmd "setwd('\''" & (item 2 of theCode) & "'\'')"' \ 22 | -e 'tell application "R" to cmd (item 1 of theCode)' \ 23 | -e 'end run' -- "$rawText" "$curDir" 24 | 25 | input 26 | selection 27 | inputFormat 28 | text 29 | keyEquivalent 30 | ~@R 31 | name 32 | R.app 33 | outputCaret 34 | afterOutput 35 | outputFormat 36 | text 37 | outputLocation 38 | toolTip 39 | scope 40 | source.r 41 | semanticClass 42 | process.external.run.r 43 | uuid 44 | 15FF2003-99F5-464C-A0C2-BAFED7AD73EB 45 | version 46 | 2 47 | 48 | 49 | -------------------------------------------------------------------------------- /Commands/Rd Insert arguments tag.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 -wKU 9 | 10 | rd=STDIN.read() 11 | if rd =~ /(?m).*?\\usage\{.*?\((.*?)\).*/m 12 | rd.gsub!(/(?m).*?\\usage\{.*?\((.*?)\).*/m, '\1') 13 | puts "\\arguments{" 14 | counter=1 15 | rd.scan(/([\w\._]+)\s*=/) do |arg| 16 | puts "\t\\item{#{arg}}{${#{counter}:}}" 17 | counter = counter+1 18 | end 19 | puts "}" 20 | else 21 | puts "\\arguments{" 22 | puts "\t\\item{${1:}}{${2:}}${0:}" 23 | puts "}" 24 | end 25 | 26 | input 27 | document 28 | name 29 | Rd Insert arguments tag 30 | output 31 | insertAsSnippet 32 | scope 33 | text.tex.latex.rd 34 | tabTrigger 35 | arg 36 | uuid 37 | EB595EE3-9439-4AC6-8352-1EC7CAC9B05E 38 | 39 | 40 | -------------------------------------------------------------------------------- /Commands/Rd Preview as HTML.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | saveActiveFile 7 | command 8 | R CMD Rdconv -t html "$TM_FILEPATH" 9 | input 10 | none 11 | keyEquivalent 12 | ^~@p 13 | name 14 | Rd Preview as HTML 15 | output 16 | showAsHTML 17 | scope 18 | text.tex.latex.rd 19 | uuid 20 | AE350C40-DA76-4BDD-AAD0-27F7247511EB 21 | 22 | 23 | -------------------------------------------------------------------------------- /Commands/Rdaemon.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | B5A22967-2E6A-4B66-9C71-DA8762C01E27 9 | command 10 | #!/usr/bin/env bash 11 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" 12 | 13 | ######### global variables ######### 14 | 15 | RDHOME="$HOME/Library/Application Support/Rdaemon" 16 | if [ "$TM_RdaemonRAMDRIVE" == "1" ]; then 17 | RDRAMDISK="/tmp/TMRramdisk1" 18 | else 19 | RDRAMDISK="$RDHOME" 20 | fi 21 | 22 | [[ ! -d "$RDHOME" ]] && echo "Please install Rdaemon first." && exit 206 23 | 24 | ######### begin script ######### 25 | 26 | #get R's PID 27 | RPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' ) 28 | RdaemonWASrunning=1 29 | #check whether Rdaemon runs - if not start it 30 | if [ -z $RPID ]; then 31 | [[ -e "$RDHOME"/daemon/x11runs ]] && rm "$RDHOME"/daemon/x11runs 32 | X=$(ps -ax | grep X11 | wc -l) 33 | if [ "$X" -gt "1" ]; then 34 | touch "$RDHOME"/daemon/x11runs 35 | fi 36 | if [ -f "$RDHOME"/daemon/startScript.sh ]; then 37 | "$RDHOME"/daemon/startScript.sh 38 | else 39 | echo "You have to install Rdaemon first!" 40 | exit_show_tool_tip 41 | fi 42 | RdaemonWASrunning=0 43 | fi 44 | 45 | #check free space on ram drive 46 | if [ "$TM_RdaemonRAMDRIVE" == "1" ]; then 47 | RES=$(df -H | grep TMRramdisk1 | awk '{ print $5 }' | perl -e 'print <>+0;') 48 | if [ $RES -gt 96 ]; then 49 | "$DIALOG" -e -p '{messageTitle="Rdaemon – RAM drive – Security Alert"; alertStyle="critical"; informativeText="Free disk space is less than 3%!\nFor safety reasons save your data image and restart the Rdaemon!";}' >/dev/null 50 | echo "RAM drive on '/tmp/TMRramdrive1':" 51 | RES=$(df -H | grep TMRramdisk1 | awk '{ print $5 }') 52 | echo -n " $RES are used of" 53 | RES=$(df -H | grep TMRramdisk1 | awk '{ print $2 }') 54 | echo -n " $RES." 55 | exit_show_tool_tip 56 | fi 57 | fi 58 | 59 | #get the task from TM and delete beginning >+: SPACE TAB 60 | TASK=$(cat | sed -e 's/Browse\[.*\]//;s/^[>+:]//;s/^[ ]*//;s/\\/\\\\/g;/^#/d') 61 | 62 | #check named input pipe for safety reasons 63 | if [ ! -p "$RDHOME"/r_in ]; then 64 | echo -en "Rdaemon Error:\nThe pipe /tmp/r_in is not found!\n\nYou have to kill Rdaemon manually!" 65 | exit 206 66 | fi 67 | 68 | #set history counter to 0 69 | echo -n 0 > "$RDHOME/history"/Rhistcounter.txt 70 | 71 | #get current position of r_out 72 | POS=$(stat "$RDRAMDISK"/r_out | awk '{ print $8 }') 73 | PROMPT=$(tail -n 1 "$RDRAMDISK"/r_out | sed 's/> $//') 74 | 75 | #if [ ! -z "$TM_DIRECTORY" ]; then 76 | # echo -e "@|setwd('$TM_DIRECTORY')" > "$RDHOME"/r_in 77 | #fi 78 | 79 | #send task to Rdaemon and give Rdaemon the chance to read from the pipe 80 | export token=$("$DIALOG" -a ProgressDialog -p "{title=Rdaemon;isIndeterminate=1;summary='Sending task to Rdaemon…';}") 81 | echo "$TASK" | sed 's/\\/\\\\/g' | while read LINE 82 | do 83 | echo -e "@|$LINE" > "$RDHOME"/r_in 84 | sleep 0.002 85 | "$DIALOG" -t $token -p "{details='$LINE';}" 2&>/dev/null 86 | done 87 | "$DIALOG" -x $token 2&>/dev/null 88 | 89 | #wait for R's response by expecting >, +, or : plus SPACE! 90 | POSNEW=$(stat "$RDRAMDISK"/r_out | awk '{ print $8 }') 91 | OFF=$(($POSNEW - $POS + 2)) 92 | 93 | PROGRESS_INIT=0 # to start the progress dialog after 100ms only 94 | while [ 1 ] 95 | do 96 | RES=$(tail -c 2 "$RDRAMDISK"/r_out) 97 | #expect these things from R 98 | [[ "$RES" == "> " ]] && break 99 | [[ "$RES" == "+ " ]] && break 100 | [[ "$RES" == ": " ]] && break 101 | #monitoring of the CPU coverage as progress bar 102 | cpu=$(ps o pcpu -p "$RPID" | tail -n 1) 103 | [[ "${cpu:0:1}" == "%" ]] && break 104 | CP=$(echo -n "$cpu" | perl -e 'print 100-<>') 105 | sleep 0.1 106 | if [ $PROGRESS_INIT -eq 0 ]; then 107 | export token=$("$DIALOG" -a ProgressDialog -p "{title=Rdaemon;progressValue=50;summary='Rdaemon is busy…';}") 108 | PROGRESS_INIT=1 109 | fi 110 | "$DIALOG" -t $token -p "{details='`tail -n 1 "$RDRAMDISK"/r_out`';progressValue=$CP;}" 2&>/dev/null 111 | done 112 | "$DIALOG" -x $token 2&>/dev/null 113 | 114 | #read only the current response from Rdaemon 115 | POSNEW=$(stat "$RDRAMDISK"/r_out | awk '{ print $8 }') 116 | OFF=$(($POSNEW - $POS + 2)) 117 | #clean/escape the response 118 | echo -en "$PROMPT" 119 | RES=$(tail -c $OFF "$RDRAMDISK"/r_out | perl -e ' 120 | undef($/); $a=<>; 121 | $a=~s/\x0D{1,}/\x0D/sg; 122 | while($a=~m/(.*?)\x0D<.{50}(.) +\x08+(.*)/) { $a=~s/(.*?)\x0D<.{50}(.) +\x08+(.*)/$1$2$3/sg; } 123 | $a=~s/\\/\\\\/g;$a=~s/\`/\\\`/sg;$a=~s/\$/\\\$/sg;$a=~s/_\x08//sg; 124 | $a=~s/\x07//sg; 125 | $a .= "\n> " if ($a!~/> $/ && $a!~/\+ $/); 126 | print "$a"; 127 | ') 128 | ERR=$(echo -en "$RES" | egrep -i '^\s*err' | wc -l) 129 | if [ $ERR -gt 0 ]; then 130 | echo -en "$RES" > /tmp/TMRdaemon_error.rCon 131 | mate /tmp/TMRdaemon_error.Rcon 132 | exit 133 | # else 134 | # echo -en "$RES" >> "$RDHOME"/console.Rcon 135 | fi 136 | 137 | 138 | if [ "$RdaemonWASrunning" == "0" ]; then 139 | #read only the current response from Rdaemon 140 | POSNEW=$(stat "$RDRAMDISK"/r_out | awk '{ print $8 }') 141 | OFF=$(($POSNEW - $POS + 2)) 142 | #clean/escape the response 143 | #echo -en "$PROMPT" 144 | # tail -c $OFF "$RDRAMDISK"/r_out | perl -e ' 145 | # undef($/); $a=<>; 146 | # $a=~s/\x0D{1,}/\x0D/sg; 147 | # while($a=~m/(.*?)\x0D<.{50}(.) +\x08+(.*)/) { $a=~s/(.*?)\x0D<.{50}(.) +\x08+(.*)/$1$2$3/sg; } 148 | # $a=~s/_\x08//sg; 149 | # $a=~s/_\x07//sg; 150 | # #$a=~s/\`/\\\`/sg;$a=~s/\$/\\\$/sg; 151 | # $a .= "\n> " if ($a!~/> $/ && $a!~/\+ $/); 152 | # print "$a"; 153 | # ' >> "$RDHOME"/console.Rcon 154 | 155 | osascript &>/dev/null \ 156 | -e 'tell app "SystemUIServer" to activate' \ 157 | -e 'tell app "TextMate" to activate' & 158 | 159 | open "$RDHOME/Rsession.tmproj" 160 | mate "$RDHOME"/console.Rcon 161 | sleep 0.3 162 | open "txmt://open?line=1000000&column=10000000" 163 | fi 164 | 165 | 166 | fallbackInput 167 | document 168 | input 169 | selection 170 | inputFormat 171 | text 172 | keyEquivalent 173 | @R 174 | name 175 | Rdaemon 176 | outputCaret 177 | afterOutput 178 | outputFormat 179 | text 180 | outputLocation 181 | toolTip 182 | scope 183 | source.r 184 | semanticClass 185 | process.external.run.r 186 | uuid 187 | DC1EC8A4-BC20-4D1C-91B6-328CEC2CA228 188 | version 189 | 2 190 | 191 | 192 | -------------------------------------------------------------------------------- /Commands/Run Selection:Document In R.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | autoScrollOutput 6 | 7 | beforeRunningCommand 8 | nop 9 | command 10 | #!/usr/bin/env bash 11 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" 12 | 13 | cd "${TM_PROJECT_DIRECTORY:-${TM_DIRECTORY:-$HOME}}" 14 | 15 | #only for Mac OSX 10.4 X11 16 | OS=$(uname -r | perl -pe 's/(\d+)\..*/$1/') 17 | [[ $OS -eq 8 ]] && export DISPLAY=:0.0 18 | 19 | CRAN="http://cran.cnr.berkeley.edu" 20 | SOFILE="$HOME/Library/Application Support/Rdaemon/startOptions.R" 21 | if [ -f "$SOFILE" ]; then 22 | RES=$(cat "$SOFILE" | egrep 'options.*?repos.*?list' | perl -pe 's/^\s*options\s*.*?repos\s*=\s*.*?[\x{27}"](.*?)[\x{27}"].*/$1/g' | tail -n 1) 23 | [[ ! -z "$RES" ]] && [[ "${RES:0:4}" == "http" ]] && CRAN="$RES" 24 | fi 25 | 26 | if [ ! -z "$TM_INPUT_START_LINE" ]; then 27 | if [ `echo -en "$TM_SELECTED_TEXT" | egrep -cv '^[ ]*#'` -gt 0 ]; then 28 | echo -en "$TM_SELECTED_TEXT" | "$TM_BUNDLE_SUPPORT/tmR.rb" "$CRAN" 1 29 | else 30 | cat | "$TM_BUNDLE_SUPPORT/tmR.rb" "$CRAN" 0 31 | fi 32 | else 33 | cat | "$TM_BUNDLE_SUPPORT/tmR.rb" "$CRAN" 0 34 | fi 35 | 36 | fallbackInput 37 | document 38 | input 39 | selection 40 | inputFormat 41 | text 42 | keyEquivalent 43 | @r 44 | name 45 | Run Document / Selection in R 46 | outputCaret 47 | afterOutput 48 | outputFormat 49 | html 50 | outputLocation 51 | newWindow 52 | scope 53 | source.r 54 | semanticClass 55 | process.run.script.r 56 | uuid 57 | F5D7F00C-6DEE-469E-AFEE-6E4B7CDD4148 58 | version 59 | 2 60 | 61 | 62 | -------------------------------------------------------------------------------- /Commands/Show File Header.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | head -n 3 "$TM_SELECTED_TEXT" 9 | fallbackInput 10 | none 11 | input 12 | selection 13 | name 14 | Show File Header 15 | output 16 | showAsTooltip 17 | scope 18 | source.r, source.rd.console 19 | uuid 20 | 381D1464-6F33-41E3-A938-C10FAB619C24 21 | 22 | 23 | -------------------------------------------------------------------------------- /Commands/Show Function Usage.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env bash 9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" 10 | 11 | if [ -z "$TM_SELECTED_TEXT" ]; then 12 | export WORD=$(ruby18 -- <<-SCR1 13 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/current_word.rb") 14 | word = Word.current_word('\w\.:') 15 | word.gsub!(/^[\d\.\-]+$/,"") 16 | print word 17 | SCR1 18 | ) 19 | if [ -z "$WORD" ]; then 20 | #look for nested commands 21 | export WORD=$(perl -e ' 22 | $line=$ENV{"TM_CURRENT_LINE"};$col=$ENV{"TM_LINE_INDEX"}; 23 | $line=substr($line,0,$col); 24 | #$line=~s/ //g; 25 | @arr=split(//,$line);$c=0; 26 | for($i=$#arr;$i>-1;$i--){$c-- if($arr[$i] eq ")");$c++ if($arr[$i] eq "(");last if $c>0;} 27 | if($i==-1) { 28 | print ""; 29 | } else { 30 | substr($line,0,$i)=~m/([\w\.:]+)$/; 31 | print $1 if defined($1); 32 | } 33 | ') 34 | fi 35 | else 36 | #take the selected text 37 | export WORD=$(echo -en "$TM_SELECTED_TEXT" | perl -e '$_=<>;chomp;s/^[\t ]*//;s/([\w\.]+)[ \(\{].*/$1/g;print') 38 | fi 39 | 40 | WORDORG="$WORD" 41 | PKG="" 42 | if [ `echo "$WORD" | grep -Fc ':'` -gt 0 ]; then 43 | PKG=",package='${WORD%%:*}'" 44 | fi 45 | WORD="${WORD##*:}" 46 | 47 | #check whether WORD is defined otherwise quit 48 | [[ -z "$WORD" ]] && exit 200 49 | 50 | TEXT=$(cat) 51 | 52 | RhelperAnswer="/tmp/textmate_Rhelper_out" 53 | 54 | # Rdaemon 55 | RPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' ) 56 | RD=$(echo -n "$TM_SCOPE" | grep -c -F 'source.rd.console') 57 | if [ ! -z "$RPID" -a "$RD" -gt 0 ]; then 58 | RDHOME="$HOME/Library/Application Support/Rdaemon" 59 | if [ "$TM_RdaemonRAMDRIVE" == "1" ]; then 60 | RDRAMDISK="/tmp/TMRramdisk1" 61 | else 62 | RDRAMDISK="$RDHOME" 63 | fi 64 | [[ -e "$RDRAMDISK"/r_tmp ]] && rm "$RDRAMDISK"/r_tmp 65 | 66 | # execute "args()" in Rdaemon 67 | TASK="@|sink('$RDRAMDISK/r_tmp');args($WORDORG)" 68 | echo "$TASK" > "$RDHOME"/r_in 69 | echo "@|sink(file=NULL)" > "$RDHOME"/r_in 70 | while [ 1 ] 71 | do 72 | RES=$(tail -c 2 "$RDRAMDISK"/r_out) 73 | [[ "$RES" == "> " ]] && break 74 | [[ "$RES" == ": " ]] && break 75 | [[ "$RES" == "+ " ]] && break 76 | sleep 0.03 77 | done 78 | sleep 0.001 79 | RES=$(cat "$RDRAMDISK"/r_tmp | sed 's/NULL$//;') 80 | [[ "$RES" == "NULL" ]] && RES="" 81 | # "args()" did find something 82 | if [ ! -z "$RES" ]; then 83 | OUT=$(echo -en "$WORD${RES:9}" | perl -e 'undef($/);$a=<>;$a=~s/"\t"/"\\t"/sg;$a=~s/"\n"/"\\n"/sg;print $a') 84 | rm -f "$RDRAMDISK"/r_tmp 85 | TASK="@|sink('$RDRAMDISK/r_tmp');cat(gsub('.*?/library/(.*?)/.*','\\\\1',as.vector(help('$WORD',try.all.packages=F)),perl=T),sep='\n')" 86 | echo "$TASK" > "$RDHOME"/r_in 87 | TASK="@|sink(file=NULL)" 88 | echo "$TASK" > "$RDHOME"/r_in 89 | while [ 1 ] 90 | do 91 | RES=$(tail -c 2 "$RDRAMDISK"/r_out) 92 | [[ "$RES" == "> " ]] && break 93 | [[ "$RES" == ": " ]] && break 94 | [[ "$RES" == "+ " ]] && break 95 | sleep 0.03 96 | done 97 | sleep 0.001 98 | LIB=$(cat "$RDRAMDISK"/r_tmp) 99 | if [ -z "$LIB" ]; then 100 | echo -n "$OUT" 101 | echo -en "\n• local" 102 | exit 206 103 | fi 104 | CNT=$(echo "$LIB" | wc -l) 105 | if [ $CNT -eq 1 ]; then 106 | echo -n "$OUT" 107 | echo -en "\n•• library: $LIB" 108 | exit 206 109 | fi 110 | # "args()" didn't find anything ergo library isn't yet loaded 111 | else 112 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getHelpURL('$WORD'$PKG)" 113 | FILE=$(cat "$RhelperAnswer") 114 | if [ ! -z "$FILE" -a "$FILE" != "NA" ]; then 115 | exec<"$RhelperAnswer" 116 | while read i 117 | do 118 | if [ "${i:0:1}" = "/" ]; then 119 | RES=$(cat "$i") 120 | else 121 | RES=$(curl -gsS "$i") 122 | fi 123 | echo -n "$RES" | "$TM_BUNDLE_SUPPORT/bin/parseHTMLForUsage.sh" "$WORD" 0 124 | LIB=$(echo "$i" | perl -pe 's!.*?/library/(.*?)/.*!$1!') 125 | TASK="@|sink('$RDRAMDISK/r_tmp')" 126 | echo "$TASK" > "$RDHOME"/r_in 127 | TASK="@|cat(sum((.packages()) %in% \"$LIB\"),sep='')" 128 | echo "$TASK" > "$RDHOME"/r_in 129 | TASK="@|sink(file=NULL)" 130 | echo "$TASK" > "$RDHOME"/r_in 131 | while [ 1 ] 132 | do 133 | RES=$(tail -c 2 "$RDRAMDISK"/r_out) 134 | [[ "$RES" == "> " ]] && break 135 | [[ "$RES" == ": " ]] && break 136 | [[ "$RES" == "+ " ]] && break 137 | sleep 0.02 138 | done 139 | sleep 0.001 140 | RES=$(cat "$RDRAMDISK"/r_tmp) 141 | if [ ! -z "$RES" -a "$RES" == "1" ]; then 142 | echo -en "\n•• library: $LIB" 143 | else 144 | echo -en "\n• library “${LIB}” not loaded [press CTRL+SHIFT+L]" 145 | fi 146 | echo 147 | done 148 | exit 206 149 | else 150 | exit 200 151 | fi 152 | fi 153 | fi 154 | 155 | # R script 156 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getHelpURL('$WORD'$PKG)" 157 | FILE=$(cat "$RhelperAnswer") 158 | if [ ! -z "$FILE" -a "$FILE" != "NA" ]; then 159 | exec<"$RhelperAnswer" 160 | while read i 161 | do 162 | if [ "${i:0:1}" = "/" ]; then 163 | RES=$(cat "$i") 164 | else 165 | RES=$(curl -gsS "$i") 166 | fi 167 | # "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getPackageFor('$WORD')" 168 | # LIB=$(cat "$RhelperAnswer") 169 | LIB=$(echo "$i" | perl -pe 's!.*?/library/(.*?)/.*!$1!') 170 | RES=$(echo -en "$RES" | "$TM_BUNDLE_SUPPORT/bin/parseHTMLForUsage.sh" "$WORD" 0) 171 | if [ ! -z "$RES" -a "${RES:0:1}" == "${WORD:0:1}" ]; then 172 | echo -n "$RES" 173 | echo -en "\n•• library: $LIB\n" 174 | fi 175 | done 176 | exit 206 177 | else 178 | [[ `echo -n "$TM_SCOPE" | grep -c -F 'text.tex.latex.rdaemon'` -gt 0 ]] && exit 200 179 | # Parse R script for functions 180 | OUT=$(echo -en "$TEXT" | "$TM_BUNDLE_SUPPORT/bin/parseDocForFunctions.sh" "$WORD") 181 | [[ -z "$OUT" ]] && exit 200 182 | echo -n "$WORD$OUT 183 | • local" 184 | exit 206 185 | fi 186 | 187 | fallbackInput 188 | none 189 | input 190 | document 191 | inputFormat 192 | text 193 | keyEquivalent 194 | ~H 195 | name 196 | Show Function Usage 197 | outputCaret 198 | afterOutput 199 | outputFormat 200 | text 201 | outputLocation 202 | toolTip 203 | scope 204 | source.r, source.rd.console 205 | uuid 206 | 797A6B84-49BB-4BBD-8F51-9A225433CA9C 207 | version 208 | 2 209 | 210 | 211 | -------------------------------------------------------------------------------- /Commands/Show R Documentation.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | 9 | 10 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getHttpPort()" 11 | sleep 0.05 12 | PORT=$(cat /tmp/textmate_Rhelper_out) 13 | 14 | 15 | if [ $PORT -gt 0 ]; then 16 | echo "<base href='http://127.0.0.1:$PORT/doc/html/index.html'>" 17 | curl -sS "http://127.0.0.1:$PORT/doc/html/index.html" 18 | 19 | else 20 | RHOME=${R_HOME:=/Library/Frameworks/R.framework/Versions/Current/Resources} 21 | echo "<base href='file://${RHOME// /%20}/doc/html/index.html'>" 22 | cat "${RHOME// /%20}"/doc/html/index.html 23 | 24 | fi 25 | input 26 | none 27 | name 28 | Show R Documentation 29 | output 30 | showAsHTML 31 | scope 32 | source.r 33 | uuid 34 | F6F4215A-5543-42B3-8EBD-C8C7C9F190C9 35 | 36 | 37 | -------------------------------------------------------------------------------- /Commands/Show R Help for actual Word:Selection.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/bin/bash 9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" 10 | 11 | #dispose all frozen ProgressDialogs 12 | { 13 | while [ 1 ] 14 | do 15 | res=$("$DIALOG" -x `"$DIALOG" -l 2>/dev/null| grep Rdaemon | cut -d " " -f 1` 2>/dev/null) 16 | [[ ${#res} -eq 0 ]] && break 17 | done 18 | } & 19 | 20 | RhelperAnswer="/tmp/textmate_Rhelper_out" 21 | 22 | if [ -z "$TM_SELECTED_TEXT" ]; then 23 | WORD=$(ruby18 -- <<-SCR1 24 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/current_word.rb") 25 | word = Word.current_word('\w\.:') 26 | word.gsub!(/^[\d\.\-]+$/,"") 27 | print word 28 | SCR1 29 | ) 30 | 31 | if [ -z "$WORD" ]; then 32 | #look for nested commands 33 | WORD=$(perl -e ' 34 | $line=$ENV{"TM_CURRENT_LINE"};$col=$ENV{"TM_LINE_INDEX"}; 35 | $line=substr($line,0,$col); 36 | #$line=~s/ //g; 37 | @arr=split(//,$line);$c=0; 38 | for($i=$#arr;$i>-1;$i--){$c-- if($arr[$i] eq ")");$c++ if($arr[$i] eq "(");last if $c>0;} 39 | if($i==-1) { 40 | print ""; 41 | } else { 42 | substr($line,0,$i)=~m/([\w\.:]+)$/; 43 | print $1 if defined($1); 44 | } 45 | ') 46 | fi 47 | else 48 | #take the selected text 49 | WORD=$(echo -en "$TM_SELECTED_TEXT" | perl -e '$_=<>;chomp;s/^[\t ]*//;s/([\w\.:]+)[ \(\{].*/$1/g;print') 50 | fi 51 | 52 | if [ -z "$WORD" ]; then 53 | WORD=$("$DIALOG" -m -p 'prompt="Search for:";title="Look up in R Documentation";' RequestString | perl -e 'undef($/);$a=<>;$a=~s/\n|\t//mg;$a=~m/.*?<key>returnArgument<\/key><string>(.*?)<\/string>.*/; print $1 if (length($1))') 54 | [[ -z "$WORD" ]] && exit_discard 55 | fi 56 | 57 | 58 | # LIB= 59 | if [ ! -z "${WORD//:/}" ]; then 60 | if [ `echo "$WORD" | grep -Fc ':'` -gt 0 ]; then 61 | LIB=",package='${WORD%%:*}'" 62 | fi 63 | WORD="${WORD##*:}" 64 | fi 65 | 66 | #check whether WORD is defined otherwise quit 67 | [[ -z "$WORD" ]] && echo "No keyword found." && exit_show_tool_tip 68 | 69 | # Check if it is a Rdaemon doc 70 | RD=$(echo -n "$TM_SCOPE" | grep -c -F 'source.rd.console') 71 | if [ $RD -gt 0 -a "$TM_R_SHOW_ALWAYS_HELPSEARCH" != "1" ]; then 72 | #get R's PID 73 | RPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' ) 74 | #check whether Rdaemon runs 75 | if [ ! -z $RPID ]; then 76 | RDHOME="$HOME/Library/Application Support/Rdaemon" 77 | if [ "$TM_RdaemonRAMDRIVE" == "1" ]; then 78 | RDRAMDISK="/tmp/TMRramdisk1" 79 | else 80 | RDRAMDISK="$RDHOME" 81 | fi 82 | [[ -e "$RDRAMDISK"/r_tmp ]] && rm "$RDRAMDISK"/r_tmp 83 | TASK="@|sink('$RDRAMDISK/r_tmp')" 84 | echo "$TASK" > "$RDHOME"/r_in 85 | echo "@|if(getRversion()>='2.10.0'){cat(gsub('.*/library/(.*?)/.*?/(.*?)(\\\\.html|$)',paste('http://127.0.0.1:',ifelse(tools:::httpdPort()<1,tools::startDynamicHelp(T),tools:::httpdPort()),'/library/\\\\1/html/\\\\2.html',sep=''),as.vector(help('$WORD'$LIB)),perl=T),sep='\n')}else{cat(gsub('(.*?)/library/(.*?)/.*?/(.*?)(\\\\.html|$)','\\\\1/library/\\\\2/html/\\\\3.html',as.vector(help('$WORD'$LIB)),perl=T),sep='\n')}" > "$RDHOME"/r_in 86 | sleep 0.001 87 | while [ 1 ] 88 | do 89 | RES=$(tail -c 2 "$RDRAMDISK"/r_out) 90 | [[ "$RES" == "> " ]] && break 91 | [[ "$RES" == ": " ]] && break 92 | [[ "$RES" == "+ " ]] && break 93 | sleep 0.005 94 | done 95 | sleep 0.001 96 | FILE=$(cat "$RDRAMDISK"/r_tmp) 97 | TASK="@|sink(NULL)" 98 | echo "$TASK" > "$RDHOME"/r_in 99 | sleep 0.001 100 | if [ ! -z "$FILE" -a "$FILE" != "NA" ]; then 101 | if [ "${FILE:0:1}" = "/" ]; then 102 | echo -en "<meta http-equiv='REFRESH' content='0;url=file://$FILE'></head>" 103 | else 104 | echo -en "<meta http-equiv='REFRESH' content='0;url=$FILE'></head>" 105 | fi 106 | exit_show_html 107 | fi 108 | fi 109 | fi 110 | 111 | FILE="" 112 | CNT=0 113 | if [ "$TM_R_SHOW_ALWAYS_HELPSEARCH" != "1" ]; then 114 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getHelpURL('$WORD'$LIB)" 115 | FILE=$(cat "$RhelperAnswer") 116 | CNT=`echo -e "$FILE" | wc -l` 117 | if [ ! -z "$FILE" -a "$FILE" != "NA" -a $CNT -eq 1 ]; then 118 | if [ "${FILE:0:1}" = "/" ]; then 119 | echo -en "<meta http-equiv='REFRESH' content='0;url=file://$FILE'></head>" 120 | else 121 | echo -en "<meta http-equiv='REFRESH' content='0;url=$FILE'></head>" 122 | fi 123 | exit_show_html 124 | else 125 | FILE="" 126 | CNT=0 127 | fi 128 | fi 129 | 130 | # Function to output the HTML frame set 131 | printframe() { 132 | ROWSIZE=$1 133 | cat <<-HF 134 | <HTML> 135 | <HEAD> 136 | <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> 137 | <TITLE>TextMate&apos;s R Help</TITLE> 138 | </HEAD> 139 | <FRAMESET COLS="$ROWSIZE,*" FRAMEBORDER="5" FRAMESPACING="5" BORDER="7" FRAMEBORDER="YES" onload='parent.search.sform.search.value="$WORD";parent.search.sform.search.select();parent.search.sform.search.focus()'> 140 | <FRAMESET ROWS="*,90" FRAMEBORDER="1" FRAMESPACING="0" BORDER="1" FRAMEBORDER="NO"> 141 | <FRAME SRC="file:///tmp/textmate_Rhelper_head.html" NAME="head" MARGINWIDTH="30" MARGINHEIGHT="0" SCROLLING="YES"> 142 | <FRAME SRC="file:///tmp/textmate_Rhelper_search.html" NAME="search" MARGINWIDTH="30" MARGINHEIGHT="0" SCROLLING="NO"> 143 | </FRAMESET> 144 | <FRAME SRC="file:///tmp/textmate_Rhelper_data.html" NAME="data" MARGINWIDTH="30" MARGINHEIGHT="0" SCROLLING="YES"> 145 | </FRAMESET> 146 | </HTML> 147 | HF 148 | 149 | } 150 | 151 | HEAD="/tmp/textmate_Rhelper_head.html" 152 | DATA="/tmp/textmate_Rhelper_data.html" 153 | SEARCH="/tmp/textmate_Rhelper_search.html" 154 | RHOME=${R_HOME:=/Library/Frameworks/R.framework/Versions/Current/Resources} 155 | 156 | echo "<html></html>" > "$DATA" 157 | 158 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "cat(getRversion()>='2.10.0',sep='')" 159 | IS_HELPSERVER=$(cat "$RhelperAnswer") 160 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getHttpPort()" 161 | PORT=$(cat "$RhelperAnswer") 162 | 163 | 164 | cat <<-"HFS" > "$SEARCH" 165 | <html> 166 | <head> 167 | <script type='text/javascript' charset='utf-8'> 168 | function SearchServer(term) { 169 | if (term.length > 0) { 170 | TextMate.isBusy = true; 171 | if(document.sform.where.checked == true) { 172 | TextMate.system('"$TM_BUNDLE_SUPPORT/bin/Rsearch.sh" "' + term + '" 1', null); 173 | } else { 174 | TextMate.system('"$TM_BUNDLE_SUPPORT/bin/Rsearch.sh" "' + term + '" 0', null); 175 | } 176 | TextMate.system('sleep 0.3', null); 177 | parent.head.location.reload(); 178 | parent.data.location.reload(); 179 | TextMate.isBusy = false; 180 | parent.search.sform.search.value = term; 181 | } 182 | } 183 | function Rdoc() { 184 | HFS 185 | 186 | if [ "$IS_HELPSERVER" != "TRUE" ]; then 187 | echo "TextMate.system('open \"${R_HOME:=/Library/Frameworks/R.framework/Versions/Current/Resources}/doc/html/index.html\"', null);" >> "$SEARCH" 188 | else 189 | echo "TextMate.system('open \"http://127.0.0.1:$PORT/doc/html/index.html\"', null);" >> "$SEARCH" 190 | fi 191 | 192 | 193 | if [ "$TM_R_SHOW_ALWAYS_HELPSEARCH" == "1" ]; then 194 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getHelpURL('$WORD'$LIB)" 195 | FILE=$(cat "$RhelperAnswer") 196 | if [ -z "$FILE" -o "$FILE" == "NA" ]; then 197 | CNT=0 198 | FILE="" 199 | else 200 | CNT=`echo -e "$FILE" | wc -l` 201 | if [ $CNT -eq 1 ]; then 202 | theLib=$(echo "$FILE" | perl -pe 's!.*?/library/(.*?)/.*!$1!') 203 | FILE="$theLib $WORD $FILE" 204 | else 205 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getSearchHelp('^$WORD$')" 206 | FILE=$(cat "$RhelperAnswer") 207 | CNT=`echo -e "$FILE" | wc -l` 208 | fi 209 | fi 210 | BEGINSEARCH="" 211 | fi 212 | if [ $CNT -eq 0 ]; then 213 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getSearchHelp('^$WORD')" 214 | sleep 0.01 215 | FILE=$(cat "$RhelperAnswer") 216 | if [ -z "$FILE" -o "$FILE" == "NA" ]; then 217 | CNT=0 218 | FILE="" 219 | else 220 | CNT=`echo -e "$FILE" | wc -l` 221 | fi 222 | BEGINSEARCH="checked" 223 | if [ $CNT -eq 0 ]; then 224 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getSearchHelp('$WORD')" 225 | FILE=$(cat "$RhelperAnswer") 226 | if [ -z "$FILE" -o "$FILE" == "NA" ]; then 227 | CNT=0 228 | FILE="" 229 | else 230 | CNT=`echo -e "$FILE" | wc -l` 231 | fi 232 | BEGINSEARCH="" 233 | fi 234 | fi 235 | 236 | cat <<-HFS01 >> "$SEARCH" 237 | } 238 | </script> 239 | </head> 240 | <body bgcolor='#ECECEC''> 241 | <table> 242 | <tr> 243 | <td> 244 | <form name='sform' onsubmit='SearchServer(document.sform.search.value)'> 245 | <small><small><i>Search for</i><br /></small></small> 246 | <input tabindex='0' id='search' type='search' placeholder='regexp' results='20' onsearch='SearchServer(this.value)'> 247 | </td> 248 | <td> 249 | <font style='font-size:7pt'> 250 | <br /><button onclick='SearchServer(document.sform.search.value)'>Search</button><br /><input type='checkbox' name='where' value='key' $BEGINSEARCH><i> begins with</i> 251 | </font> 252 | </td> 253 | </form> 254 | </td> 255 | </tr> 256 | <tr> 257 | <td align=center colspan=3> 258 | <input onclick='Rdoc()' type=button value='R documentation'><br/> 259 | </td> 260 | </tr> 261 | </table> 262 | </body> 263 | </html> 264 | HFS01 265 | 266 | echo "<html><body style='margin-top:5mm'>" > "$HEAD" 267 | echo "<table style='border-collapse:collapse'><tr><td style='padding-right:1cm;border-bottom:1px solid black'><b>Package</b></td><td style='border-bottom:1px solid black'><b>Topic</b></td></tr>" >> "$HEAD" 268 | 269 | if [ $CNT -gt 10 ]; then 270 | export token=$("$DIALOG" -c -a ProgressDialog -p "{title=Rdaemon;isIndeterminate=1;summary='R Documentation';details='Please wait. Building Help Page… $CNT items found';}") 271 | fi 272 | 273 | if [ $CNT -gt 500 ]; then 274 | echo "<tr colspan=2><td><i>too much matches...</i></td></tr>" >> "$HEAD" 275 | else 276 | oifs="$IFS" 277 | IFS=" 278 | " 279 | 280 | if [ "$IS_HELPSERVER" == "TRUE" ]; then 281 | for i in $FILE 282 | do 283 | lib=$(echo -e "$i" | cut -d ' ' -f1) 284 | fun=$(echo -e "$i" | cut -d ' ' -f2) 285 | link=$(echo -e "$i" | cut -d ' ' -f3) 286 | echo "<tr><td>$lib</td><td><a href='$link' target='data'>$fun</a></td></tr>" >> "$HEAD" 287 | done 288 | if [ $CNT -eq 1 ]; then 289 | echo "<base href=\"$link\">" > "$DATA" 290 | curl -gsS "$link" >> "$DATA" 291 | fi 292 | else 293 | for i in $FILE 294 | do 295 | lib=$(echo -e "$i" | cut -d ' ' -f1) 296 | fun=$(echo -e "$i" | cut -d ' ' -f2) 297 | link=$(echo -e "$i" | cut -d ' ' -f3) 298 | echo "<tr><td>$lib</td><td><a href='file://$link' target='data'>$fun</a></td></tr>" >> "$HEAD" 299 | done 300 | if [ $CNT -eq 1 ]; then 301 | echo "<base href=\"file://$link\">" > "$DATA" 302 | cat "$link" | iconv -s -f ISO8859-1 -t UTF-8 >> "$DATA" 303 | fi 304 | fi 305 | fi 306 | echo "</table></body></html>" >> "$HEAD" 307 | 308 | printframe 340 309 | 310 | "$DIALOG" -x $token 2&>/dev/null 311 | exit_show_html 312 | 313 | 314 | fallbackInput 315 | none 316 | input 317 | selection 318 | inputFormat 319 | text 320 | keyEquivalent 321 | ^h 322 | name 323 | Show R Help for actual Word / Selection 324 | outputCaret 325 | afterOutput 326 | outputFormat 327 | text 328 | outputLocation 329 | toolTip 330 | scope 331 | source.r, source.rd.console 332 | uuid 333 | 3F849C03-8BFC-4A54-B985-09BB453AF679 334 | version 335 | 2 336 | 337 | 338 | -------------------------------------------------------------------------------- /Commands/Show Result as Tooltip.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | cat | R --vanilla --slave --no-readline --encoding=UTF-8 9 | input 10 | selection 11 | keyEquivalent 12 | ^@r 13 | name 14 | Show Result as Tooltip 15 | output 16 | showAsTooltip 17 | scope 18 | source.r 19 | uuid 20 | E3EAFF15-1B8D-4E74-8649-2A3CADC0A119 21 | 22 | 23 | -------------------------------------------------------------------------------- /Commands/Summaries….tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 9 | # print "Got:" + STDIN.read 10 | 11 | require ENV['TM_SUPPORT_PATH'] +'/lib/ui.rb' 12 | require ENV['TM_SUPPORT_PATH'] +'/lib/exit_codes.rb' 13 | opts = { "Summary" => "summary(${1:x})", 14 | "Table" => "table(${1:x})"} 15 | keys = opts.keys.sort 16 | ans = TextMate::UI.menu(keys) 17 | TextMate.exit_discard unless ans 18 | print opts[keys[ans]] 19 | fallbackInput 20 | word 21 | input 22 | none 23 | keyEquivalent 24 | ~@S 25 | name 26 | Summaries… 27 | output 28 | insertAsSnippet 29 | scope 30 | source.r, source.rd.console 31 | uuid 32 | 6A931F29-5A2B-4CCB-A958-0A0A9A3F2BEF 33 | 34 | 35 | -------------------------------------------------------------------------------- /Commands/Terminate Helper Daemon.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | RPID=$(ps aw | grep '[0-9] /.*TMRHelperDaemon' | awk '{print $1}' ) 9 | if [ ! -z $RPID ]; then 10 | out=$(kill $RPID) 11 | if [ -z "$out" ]; then 12 | rm -f /tmp/textmate_Rhelper_console 13 | rm -f /tmp/textmate_Rhelper_data.html 14 | rm -f /tmp/textmate_Rhelper_head.html 15 | rm -f /tmp/textmate_Rhelper_in 16 | rm -f /tmp/textmate_Rhelper_out 17 | rm -f /tmp/textmate_Rhelper_search.html 18 | rm -f /tmp/textmate_Rhelper_status 19 | echo "Helper Daemon was terminated." 20 | else 21 | echo "Error while terminating Helper Daemon running as PID $RPID." 22 | fi 23 | else 24 | echo "No Helper Daemon found." 25 | fi 26 | input 27 | none 28 | name 29 | Terminate Helper Daemon 30 | output 31 | showAsTooltip 32 | scope 33 | source.r, source.rd.console 34 | uuid 35 | 90C73568-B9B1-4D3D-BAC5-5C2999BE39BC 36 | 37 | 38 | -------------------------------------------------------------------------------- /Commands/Tidy.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #[[ -z "$TM_SELECTED_TEXT" ]] && echo "Please select a function definition" && #exit_show_tool_tip 9 | 10 | echo "dummy <- function() {" > /tmp/TM_Rtidy_func.R 11 | cat >> /tmp/TM_Rtidy_func.R 12 | echo "}" >> /tmp/TM_Rtidy_func.R 13 | 14 | if [ $TM_SOFT_TABS == "YES" ]; then 15 | export TAB=$(perl -e 'print " " x $ENV{"TM_TAB_SIZE"}') 16 | else 17 | export TAB=" " 18 | fi 19 | 20 | export TABLEVEL=$(head -n 2 /tmp/TM_Rtidy_func.R | tail -n 1 | perl -pe 's/^([ \t]*).*/$1/') 21 | 22 | cat <<-HFS > /tmp/TM_Rtidy.R 23 | options(keep.source = FALSE) 24 | options(warn = -1) 25 | options(show.error.messages = TRUE) 26 | source("/tmp/TM_Rtidy_func.R") 27 | dump(ls(all = TRUE), file = "/tmp/TM_Rtidy_func_new.R", control = c("keepInteger", "keepNA", "quoteExpressions")) 28 | HFS 29 | 30 | R --vanilla --slave < /tmp/TM_Rtidy.R 2> /tmp/TM_Rtidy.err 31 | 32 | ERR=$(cat /tmp/TM_Rtidy.err | sed '1,3d' | sed '$d') 33 | if [ ! -z "$ERR" ]; then 34 | [[ -e /tmp/TM_Rtidy_func.R ]] && rm /tmp/TM_Rtidy_func.R 35 | [[ -e /tmp/TM_Rtidy.R ]] && rm /tmp/TM_Rtidy.R 36 | [[ -e /tmp/TM_Rtidy_func_new.R ]] && rm /tmp/TM_Rtidy_func_new.R 37 | [[ -e /tmp/TM_Rtidy.err ]] && rm /tmp/TM_Rtidy.err 38 | echo "Syntax Error at:" 39 | if [ -z "$TM_SELECTED_TEXT" ]; then 40 | ERR=$(echo -en "$ERR" | perl -e '$_=<>;chomp;m/^(\d+):(.*)/;print "line " . ($1-1) . ": $2"') 41 | LINE=$(echo -en "$ERR" | perl -pe 's/^line (\d+):.*/$1/') 42 | open "txmt://open?line=$LINE" 43 | else 44 | ERR=$(echo -en "$ERR" | perl -e '$_=<>;chomp;m/^(\d+):(.*)/;print "line " . ($1-2+$ENV{"TM_INPUT_START_LINE"}) . ": $2"') 45 | LINE=$(echo -en "$ERR" | perl -pe 's/^line (\d+):.*/$1/') 46 | #LINE=$(($LINE + $TM_INPUT_START_LINE - 1)) 47 | open "txmt://open?line=$LINE" 48 | fi 49 | echo -en "$ERR" 50 | exit_show_tool_tip 51 | fi 52 | 53 | if [ -e /tmp/TM_Rtidy_func_new.R ]; then 54 | cat /tmp/TM_Rtidy_func_new.R | sed '1,3d;$d' | perl -pe 's/^ /$ENV{"TABLEVEL"}/;s/^\`(.*?)\` <\-\n/$1 <\- /;s/ {4}/$ENV{"TAB"}/g;s/function \(/function(/;s/(.*?<\- function\()/\n$1/' 55 | else 56 | echo "Unknown error occured" 57 | exit_show_tool_tip 58 | fi 59 | 60 | [[ -e /tmp/TM_Rtidy_func.R ]] && rm /tmp/TM_Rtidy_func.R 61 | [[ -e /tmp/TM_Rtidy.R ]] && rm /tmp/TM_Rtidy.R 62 | [[ -e /tmp/TM_Rtidy_func_new.R ]] && rm /tmp/TM_Rtidy_func_new.R 63 | [[ -e /tmp/TM_Rtidy.err ]] && rm /tmp/TM_Rtidy.err 64 | 65 | 66 | 67 | 68 | fallbackInput 69 | document 70 | input 71 | selection 72 | keyEquivalent 73 | ^H 74 | name 75 | Tidy (removes all comments!) 76 | output 77 | replaceSelectedText 78 | scope 79 | source.r -source.r.rd.console 80 | uuid 81 | 3A526F78-B82D-41BD-9799-CA5F846401DC 82 | 83 | 84 | -------------------------------------------------------------------------------- /Commands/“ <- ”.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | FLAG=$(echo -en "$TM_CURRENT_LINE" | perl -e '$_=<>;m/.*?( $)/;print 1 if defined($1)') 9 | if [ -z "$FLAG" ]; then 10 | echo -n " <- " 11 | else 12 | echo -n "<- " 13 | fi 14 | input 15 | none 16 | keyEquivalent 17 | ^- 18 | name 19 | “ <- ” 20 | output 21 | afterSelectedText 22 | scope 23 | source.r, source.rd.console 24 | uuid 25 | 06BD4251-25D5-4BA0-99BC-5D3061E64128 26 | 27 | 28 | -------------------------------------------------------------------------------- /Commands/“par()” Parameters….tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | export WORD="par" 9 | 10 | "$TM_BUNDLE_SUPPORT"/bin/initCommandArgsDir.sh 11 | if [ -e "$TM_BUNDLE_SUPPORT"/lib/command_args/$WORD ]; then 12 | export RES=$(cat "$TM_BUNDLE_SUPPORT"/lib/command_args/$WORD | perl -pe 's/\|/:/g;s/,/\|/g;s/\n/,/g;s/ //g;') 13 | fi 14 | 15 | #if no parameter quit 16 | [[ -z "$RES" ]] && exit_discard 17 | 18 | #show all parameters as inline menu and insert the parameter as snippet (if '=' is found only the value) 19 | ruby18 -- <<-SCRIPT 20 | # 2> /dev/null 21 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/exit_codes.rb") 22 | require "#{ENV["TM_SUPPORT_PATH"]}/lib/ui" 23 | word = "$WORD" 24 | text = ENV["RES"] 25 | funs = text.split(",") 26 | funs.collect! {|x| x.gsub(/\|/, ", ").gsub(/=/, " = ").gsub(/:/, "|")} 27 | 28 | TextMate.exit_discard if funs.size < 1 29 | 30 | if funs.size == 1 31 | function = funs.first 32 | else 33 | idx = TextMate::UI.menu(funs) 34 | TextMate.exit_discard if idx.nil? 35 | function = funs[idx] 36 | end 37 | TextMate.exit_discard if function.empty? 38 | curword = ENV['TM_CURRENT_WORD'] 39 | comma="" 40 | if ! curword.match(",") && ! curword.match('\( *\)+$') 41 | comma = "\${200:, }" 42 | end 43 | 44 | if function.match("=") 45 | arr = function.gsub(/ = /, "=").split('=') 46 | if arr[1].match("\"") 47 | print "#{comma}#{arr[0]} = \"\${1:#{arr[1].gsub(/\"/, "")}}\"\${300:}" 48 | else 49 | if arr[1].match("^c\(.*?\)$") 50 | subarr = arr[1].gsub(/^c\(/, "").gsub(/\)$/,"").gsub(/ /,"").split(",") 51 | for i in (0..(subarr.size - 1)) 52 | subarr[i] = "\${#{i+2}:#{subarr[i]}}" 53 | end 54 | print "#{comma}#{arr[0]} = \${1:c(#{subarr.join(", ")})}\${300:}" 55 | else 56 | print "#{comma}#{arr[0]} = \${1:#{arr[1]}}\${30:}" 57 | end 58 | end 59 | else 60 | print "#{comma}\${1:#{function}}\${3:}" 61 | end 62 | SCRIPT 63 | 64 | fallbackInput 65 | none 66 | input 67 | none 68 | keyEquivalent 69 | ^; 70 | name 71 | “par()” Parameters… 72 | output 73 | insertAsSnippet 74 | scope 75 | source.r, source.rd.console 76 | uuid 77 | 38BD6CA7-0916-43BD-88C9-CBFC4ED17FDE 78 | 79 | 80 | -------------------------------------------------------------------------------- /Commands/“require(xxx)” for current Function.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | [[ -n "$TM_SELECTED_TEXT" ]] && echo "Please unselect first." && exit_show_tool_tip 9 | 10 | LINE=$(cat | perl -e ' 11 | $line=$ENV{"TM_CURRENT_LINE"};$col=$ENV{"TM_LINE_INDEX"}; 12 | $lineL=substr($line,0,$col); 13 | $lineR=substr($line,$col); 14 | $lineL=~s/(?=[\$`\\])/\\/g; 15 | $lineR=~s/(?=[\$`\\])/\\/g; 16 | print "$lineL\${0:}$lineR"; 17 | ') 18 | WORD=$(ruby18 -- <<-SCR1 19 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/current_word.rb") 20 | word = Word.current_word('\w._\(') 21 | print word 22 | SCR1 23 | ) 24 | 25 | WORD=$(echo -en "$WORD" | perl -pe 's/\([^\(]*$//') 26 | 27 | [[ -z "$WORD" ]] && echo "No keyword found" && exit_show_tool_tip 28 | 29 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getPackageFor('$WORD')" 30 | LIB=$(cat /tmp/textmate_Rhelper_out) 31 | if [ -z "$LIB" ]; then 32 | echo -en "No package found." 33 | exit 206 34 | fi 35 | 36 | if [ `echo "$LIB" | wc -l` -gt 1 ]; then 37 | LIB=$(echo "$LIB" | sort -f | ruby18 -e ' 38 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/ui.rb") 39 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/exit_codes.rb") 40 | words = STDIN.read().split("\n") 41 | index=TextMate::UI.menu(words) 42 | if index != nil 43 | print words[index] 44 | end 45 | ') 46 | fi 47 | 48 | if [ `echo -n "$TM_SCOPE" | grep -c -F 'source.rd.console'` -gt 0 ]; then 49 | echo -en "> require($LIB); " 50 | echo -n "$LINE" | sed 's/^> //' 51 | else 52 | TABS=$(echo -en "$LINE" | perl -e '$a=<>;$a=~m/^([\t ]+)/;print $1 if defined($1)') 53 | echo -en "$TABS" 54 | echo -e "require($LIB)" 55 | echo -n "$LINE" 56 | fi 57 | 58 | 59 | fallbackInput 60 | line 61 | input 62 | selection 63 | keyEquivalent 64 | ^L 65 | name 66 | “require(xxx)” for current Function 67 | output 68 | insertAsSnippet 69 | scope 70 | source.r, source.rd.console 71 | uuid 72 | 8D7F64A5-B2C5-4BF1-B7C5-352CF6AAEF28 73 | 74 | 75 | -------------------------------------------------------------------------------- /DragCommands/load (*_Rdata).tmDragCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | B29D7850-6E70-11D9-A369-000D93B3A10E 9 | command 10 | 11 | if [ "${TM_SCOPE:0:17}" == "source.rd.console" ]; then 12 | echo -n "load(\"$TM_DROPPED_FILEPATH\")" 13 | else 14 | if [ "$TM_MODIFIER_FLAGS" == "SHIFT" ]; then 15 | echo "load(\"$TM_DROPPED_FILEPATH\")" 16 | else 17 | echo "load(\"$TM_DROPPED_FILE\")" 18 | fi 19 | fi 20 | draggedFileExtensions 21 | 22 | rdata 23 | Rdata 24 | rda 25 | Rda 26 | 27 | input 28 | selection 29 | name 30 | load (*.Rdata) 31 | output 32 | insertAsSnippet 33 | scope 34 | source.r, source.rd.console 35 | uuid 36 | BC3C944A-A0D9-4438-A9CF-C813970DD533 37 | 38 | 39 | -------------------------------------------------------------------------------- /DragCommands/read_csv (*_csv).tmDragCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | B29D7850-6E70-11D9-A369-000D93B3A10E 9 | command 10 | 11 | if [ "${TM_SCOPE:0:17}" == "source.rd.console" ]; then 12 | echo -n "read.csv(file = \"$TM_DROPPED_FILEPATH\", header = \${1:TRUE}, stringsAsFactors = \${2:FALSE})" 13 | else 14 | if [ "$TM_MODIFIER_FLAGS" == "SHIFT" ]; then 15 | echo "read.csv(file = \"$TM_DROPPED_FILEPATH\", header = \${1:TRUE}, stringsAsFactors = \${2:FALSE})" 16 | else 17 | echo "read.csv(file = \"$TM_DROPPED_FILE\", header = \${1:TRUE}, stringsAsFactors = \${2:FALSE})" 18 | fi 19 | fi 20 | draggedFileExtensions 21 | 22 | csv 23 | CSV 24 | 25 | input 26 | selection 27 | name 28 | read.csv (*.csv) 29 | output 30 | insertAsSnippet 31 | scope 32 | source.r, source.rd.console 33 | uuid 34 | FF242DDB-CDE9-4FC0-8AC7-3345E49FBACA 35 | 36 | 37 | -------------------------------------------------------------------------------- /DragCommands/read_spss (*_sav).tmDragCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | B29D7850-6E70-11D9-A369-000D93B3A10E 9 | command 10 | #!/usr/bin/env bash 11 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" 12 | 13 | 14 | 15 | if [ "${TM_SCOPE:0:17}" == "source.rd.console" ]; then 16 | echo -n "read.spss(file=\"$TM_DROPPED_FILEPATH\", use.value.labels=\${1:TRUE}, to.data.frame=\${2:TRUE}, max.value.labels=\${3:Inf}, trim.factor.names=\${4:FALSE})" 17 | else 18 | if [ "$TM_MODIFIER_FLAGS" == "SHIFT" ]; then 19 | echo "read.spss(file=\"$TM_DROPPED_FILEPATH\", use.value.labels=\${1:TRUE}, to.data.frame=\${2:TRUE}, max.value.labels=\${3:Inf}, trim.factor.names=\${4:FALSE})" 20 | else 21 | echo "read.spss(file=\"$TM_DROPPED_FILE\", use.value.labels=\${1:TRUE}, to.data.frame=\${2:TRUE}, max.value.labels=\${3:Inf}, trim.factor.names=\${4:FALSE})" 22 | fi 23 | fi 24 | draggedFileExtensions 25 | 26 | sav 27 | SAV 28 | 29 | input 30 | selection 31 | name 32 | read.spss (*.sav) 33 | output 34 | insertAsSnippet 35 | scope 36 | source.r, source.rd.console 37 | uuid 38 | A6E69150-0E80-4D24-9170-725B7A30EE18 39 | 40 | 41 | -------------------------------------------------------------------------------- /DragCommands/read_table (*_tab).tmDragCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | B29D7850-6E70-11D9-A369-000D93B3A10E 9 | command 10 | #!/usr/bin/env bash 11 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" 12 | 13 | 14 | if [ "${TM_SCOPE:0:17}" == "source.rd.console" ]; then 15 | echo -n "read.table(file = \"$TM_DROPPED_FILEPATH\", sep = \"\${1:\\t}\", header = \${2:TRUE}, stringsAsFactors = \${3:FALSE})" 16 | else 17 | if [ "$TM_MODIFIER_FLAGS" == "SHIFT" ]; then 18 | echo "read.table(file = \"$TM_DROPPED_FILEPATH\", sep = \"\${1:\\t}\", header = \${2:TRUE}, stringsAsFactors = \${3:FALSE})" 19 | else 20 | echo "read.table(file = \"$TM_DROPPED_FILE\", sep = \"\${1:\\t}\", header = \${2:TRUE}, stringsAsFactors = \${3:FALSE})" 21 | fi 22 | fi 23 | draggedFileExtensions 24 | 25 | tab 26 | TAB 27 | 28 | input 29 | selection 30 | name 31 | read.table (*.tab) 32 | output 33 | insertAsSnippet 34 | scope 35 | source.r, source.rd.console 36 | uuid 37 | 59C40B86-99F3-4713-9C88-C3AD7CE0C821 38 | 39 | 40 | -------------------------------------------------------------------------------- /DragCommands/source (*_R).tmDragCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | B29D7850-6E70-11D9-A369-000D93B3A10E 9 | command 10 | 11 | if [ "${TM_SCOPE:0:17}" == "source.rd.console" ]; then 12 | echo -n "source(\"$TM_DROPPED_FILEPATH\", chdir = \${1:TRUE})" 13 | else 14 | if [ "$TM_MODIFIER_FLAGS" == "SHIFT" ]; then 15 | echo "source(\"$TM_DROPPED_FILEPATH\", chdir = \${1:TRUE})" 16 | else 17 | echo "source(\"$TM_DROPPED_FILE\", chdir = \${1:TRUE})" 18 | fi 19 | fi 20 | draggedFileExtensions 21 | 22 | r 23 | R 24 | 25 | input 26 | selection 27 | name 28 | source (*.R) 29 | output 30 | insertAsSnippet 31 | scope 32 | source.r, source.rd.console 33 | uuid 34 | 7AA6473C-4B13-4252-8773-9B08675048FB 35 | 36 | 37 | -------------------------------------------------------------------------------- /Macros/Function Parameters….tmMacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | commands 6 | 7 | 8 | argument 9 | 10 | beforeRunningCommand 11 | nop 12 | command 13 | "$TM_BUNDLE_SUPPORT"/bin/insert_function_param.sh 14 | fallbackInput 15 | none 16 | input 17 | document 18 | name 19 | Function Parameters… 20 | output 21 | insertAsSnippet 22 | scope 23 | source.r -source.rd.console 24 | uuid 25 | D977E5CA-C8BD-414E-AF8B-98279DF571DC 26 | 27 | command 28 | executeCommandWithOptions: 29 | 30 | 31 | keyEquivalent 32 | ^, 33 | name 34 | Function Parameters… 35 | scope 36 | source.r, source.rd.console 37 | uuid 38 | E16BBBCF-CDD5-49DB-9626-1125A97C4D89 39 | 40 | 41 | -------------------------------------------------------------------------------- /Macros/Next List Element:Parameter Value.tmMacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | commands 6 | 7 | 8 | argument 9 | 10 | action 11 | findNext 12 | findInProjectIgnoreCase 13 | 14 | findString 15 | (?<=[ ,\(=\"'])-?[^\"', \)\(=\n\t]+(?=([\"']?| *|\" *|' *)[,\)])|(?<=[\"'])(?=[\"']) 16 | ignoreCase 17 | 18 | regularExpression 19 | 20 | replaceAllScope 21 | document 22 | wrapAround 23 | 24 | 25 | command 26 | findWithOptions: 27 | 28 | 29 | keyEquivalent 30 | ^~ 31 | name 32 | Next List Element/Parameter Value 33 | scope 34 | source.r, source.rd.console 35 | uuid 36 | C28E338D-7E5F-4E3C-9603-70C22912166D 37 | 38 | 39 | -------------------------------------------------------------------------------- /Macros/Previous List Element:Parameter Value.tmMacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | commands 6 | 7 | 8 | argument 9 | 10 | action 11 | findPrevious 12 | findInProjectIgnoreCase 13 | 14 | findString 15 | (?<=[ ,\(=\"'])-?[^\"', \)\(=\n\t]+(?=([\"']?| *|\" *|' *)[,\)])|(?<=[\"'])(?=[\"']) 16 | ignoreCase 17 | 18 | regularExpression 19 | 20 | replaceAllScope 21 | document 22 | wrapAround 23 | 24 | 25 | command 26 | findWithOptions: 27 | 28 | 29 | keyEquivalent 30 | ^~ 31 | name 32 | Previous List Element/Parameter Value 33 | scope 34 | source.r, source.rd.console 35 | uuid 36 | C4BEAEEF-970A-40DC-B511-5C4B2C0AB43E 37 | 38 | 39 | -------------------------------------------------------------------------------- /Macros/Show Function Usage + Insert “(”.tmMacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | commands 6 | 7 | 8 | argument 9 | 10 | beforeRunningCommand 11 | nop 12 | command 13 | "$TM_BUNDLE_SUPPORT"/bin/auto_show_func_usage.sh & 14 | fallbackInput 15 | line 16 | input 17 | document 18 | name 19 | Auto Show Func Usage 20 | output 21 | showAsTooltip 22 | uuid 23 | 9AACF8E0-2705-4994-B67F-77D030F9ABA7 24 | 25 | command 26 | executeCommandWithOptions: 27 | 28 | 29 | argument 30 | ( 31 | command 32 | insertText: 33 | 34 | 35 | isDisabled 36 | 37 | keyEquivalent 38 | ( 39 | name 40 | Show Function Usage + Insert “(” 41 | scope 42 | source.r, source.rd.console 43 | uuid 44 | 280CC3F2-8A69-446D-89A2-2886D3DF9495 45 | 46 | 47 | -------------------------------------------------------------------------------- /Preferences/Comments.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Comments 7 | scope 8 | source.r 9 | settings 10 | 11 | shellVariables 12 | 13 | 14 | name 15 | TM_COMMENT_START 16 | value 17 | # 18 | 19 | 20 | 21 | uuid 22 | F38E1657-C2D9-48CE-9FFD-3EEA36D8B320 23 | 24 | 25 | -------------------------------------------------------------------------------- /Preferences/Folding - Documentation.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Folding (Documentation) 7 | scope 8 | text.tex.latex.rd 9 | settings 10 | 11 | foldingStartMarker 12 | /\w*\{\s*$ 13 | foldingStopMarker 14 | ^\s*\} 15 | 16 | uuid 17 | 60CD1452-8D51-4AAA-938F-A40628EA7B9A 18 | 19 | 20 | -------------------------------------------------------------------------------- /Preferences/Folding - R.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Folding (R) 7 | scope 8 | source.r 9 | settings 10 | 11 | foldingStartMarker 12 | ^[^#]*(\([^\)]*$|\{\s*$) 13 | foldingStopMarker 14 | (^\s*\)|^\s*\}) 15 | 16 | uuid 17 | 88425650-DA1A-44DF-98E8-D37EA091ACA0 18 | 19 | 20 | -------------------------------------------------------------------------------- /Preferences/Indentation Rules.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Indentation Rules 7 | scope 8 | source.r 9 | settings 10 | 11 | decreaseIndentPattern 12 | ^\s*\} 13 | indentNextLinePattern 14 | ^\s*(repeat|else|(((else\s+)?if|for|while)\s*\(.+\))) 15 | unIndentedLinePattern 16 | ^\s*$ 17 | 18 | uuid 19 | 8A8DFE5C-EA28-46EB-BD5C-C2B08CAA7352 20 | 21 | 22 | -------------------------------------------------------------------------------- /Preferences/Methods.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Symbol List: Method 7 | scope 8 | keyword.name.function, meta.method.declaration.r 9 | settings 10 | 11 | showInSymbolList 12 | 1 13 | symbolTransformation 14 | s/^.*?\(\s*([\w\d]+\s*=\s*)?(["\x{27}])(.*?)\2[^"\x{27}]+?(["\x{27}])(.*?)\4.*/- $3 ($5)/; 15 | s/^\s*(\S+?)\s*\(\s*([\w\d]+\s*=\s*)?(["\x{27}])([^\3]+?)\3.*/- $1:$4/; 16 | 17 | 18 | uuid 19 | 0AE8C5E0-C202-4965-B877-4CD0B9420A7D 20 | 21 | 22 | -------------------------------------------------------------------------------- /Preferences/Symbol List (Rd Documentation).tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Symbol List (Rd Documentation) 7 | scope 8 | keyword.other.section.rd 9 | settings 10 | 11 | showInSymbolList 12 | 1 13 | symbolTransformation 14 | s/\\(.*)/$1/; 15 | 16 | uuid 17 | 5DBBC018-D895-4A52-91D4-60196BC76B49 18 | 19 | 20 | -------------------------------------------------------------------------------- /Preferences/Symbol List: Pragma.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Symbol List: Pragma 7 | scope 8 | comment.line.pragma-mark 9 | settings 10 | 11 | showInSymbolList 12 | 1 13 | symbolTransformation 14 | s/^.*?mark\s+\-+\s*/-/;s/^.*?mark\s+([^\-].+?)/# $1/;s/\s+$//; 15 | 16 | uuid 17 | E4D3F9E2-CE92-4142-B164-0CE1EB1AD453 18 | 19 | 20 | -------------------------------------------------------------------------------- /README.mdown: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | You can install this bundle in TextMate by opening the preferences and going to the bundles tab. After installation it will be automatically updated for you. 4 | 5 | # General 6 | 7 | * [Bundle Styleguide](http://kb.textmate.org/bundle_styleguide) — _before you make changes_ 8 | * [Commit Styleguide](http://kb.textmate.org/commit_styleguide) — _before you send a pull request_ 9 | * [Writing Bug Reports](http://kb.textmate.org/writing_bug_reports) — _before you report an issue_ 10 | 11 | # License 12 | 13 | If not otherwise specified (see below), files in this repository fall under the following license: 14 | 15 | Permission to copy, use, modify, sell and distribute this 16 | software is granted. This software is provided "as is" without 17 | express or implied warranty, and with no claim as to its 18 | suitability for any purpose. 19 | -------------------------------------------------------------------------------- /Snippets/Add Tick Marks.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | rug(${1:jitter(${2:x})}) 7 | name 8 | Add Tick Marks 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | rug 13 | uuid 14 | EB449D09-F66E-4C1B-BFAF-B9FA27DB991C 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Attach.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | attach(${1:frame}) 7 | name 8 | Attach 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | att 13 | uuid 14 | 5F49FB43-86AA-4352-AECB-CA573E9DC7E8 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Cummulative.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | cum${1:max}(${2:x}) 7 | name 8 | Cummulative 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | cum 13 | uuid 14 | 9BB0E6BD-62E9-4D5A-A1B6-6A5545F58EFD 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Density.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | density(${1:x}${2:, bw = ${3:bandwidth}}) 7 | name 8 | Density 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | den 13 | uuid 14 | 93D9F298-A5FF-4935-A906-1C1E31AF451A 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Detach.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | detach(${0:}) 7 | name 8 | Detach 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | det 13 | uuid 14 | 481CC207-5003-4AAE-8202-E353889470C9 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Divide Into Intervals.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | cut(${1:x}, breaks = c(${2:${3:}, ${4:max(${1:x})}})) 7 | name 8 | Divide Into Intervals 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | cut 13 | uuid 14 | 217EE449-B990-4FDA-A897-F7063022241E 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Factor.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | factor(${1:x}) 7 | name 8 | Factor 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | fac 13 | uuid 14 | 0D80E89D-F95D-4C5E-B174-342B245CD56B 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/For Loop.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | for (${1:i} in ${2:seq}) ${3:{$0\}} 7 | name 8 | For Loop 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | for 13 | uuid 14 | 63A97132-D522-48D9-937A-6A1F04E45F7D 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Function.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | function(${1:x}) ${3:{$0\}} 7 | name 8 | Function 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | fun 13 | uuid 14 | 02F9D19E-BE8F-4BAA-99EB-2A304BB873FE 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Ifelse.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ifelse(${1:test}, ${2:yes}, ${3:no}) 7 | name 8 | Ifelse 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | ife 13 | uuid 14 | 69D9877A-4A4C-4DC7-97E5-392B45941A82 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Length.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | length(${1:x}) 7 | name 8 | Length 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | len 13 | uuid 14 | CE3CB75A-3283-4BF0-BDD8-FF8F50F61762 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Load Dataset.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | data(${1:name}) 7 | name 8 | Load Dataset 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | dat 13 | uuid 14 | 5A0EA5CD-5767-4D11-AF9A-C4447A8EA4B4 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Polygonal Line.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | lines(${1:x}${2:, color=${3:red}}) 7 | name 8 | Polygonal Line 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | lin 13 | uuid 14 | A4E14B93-E8D0-4C8E-AB8E-CCB029E170F0 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Read From File.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | read.table("${1:filename}"${2:, header = ${3:TRUE}, sep = "${4:\t}", stringsAsFactors = ${5:FALSE}}) 7 | name 8 | Read From File 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | rea 13 | uuid 14 | D8F85702-E792-4856-8D16-54E4EB2F9483 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Sequence (from,to,by).tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | seq(${1:from}, ${2:to}, ${3:by}) 7 | name 8 | Sequence (from,to,by) 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | seq 13 | uuid 14 | 4852C9E0-D22C-4FA2-8C85-628B97F6C3B2 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Sort.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | sort(${1:x}) 7 | name 8 | Sort 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | sor 13 | uuid 14 | A9D21636-8157-4C3B-967B-B0E24595AA86 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Source.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | source(${1:"${2:}"}${3:, chdir = ${4:TRUE}}) 7 | name 8 | Source 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | sou 13 | uuid 14 | D7A7E674-E2E6-4454-BA78-952A129FB1E2 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/file_choose.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ${1:file = }file.choose()${0:} 7 | name 8 | file.choose 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | fch 13 | uuid 14 | FA279758-BC29-4BE9-AFD6-045DB6A17711 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/na_omit.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | na.omit(${0:}) 7 | name 8 | na.omit 9 | scope 10 | source.r, source.rd.console 11 | tabTrigger 12 | nao 13 | uuid 14 | C7D7C1F9-E2F7-4B09-8C1A-AD66C19E9CB3 15 | 16 | 17 | -------------------------------------------------------------------------------- /Support/Rmate.css: -------------------------------------------------------------------------------- 1 | /* 2 | Style sheet rewritten by Felix Jung on 11/27/2012. 3 | */ 4 | body 5 | { 6 | font-family: FONTPLACEHOLDER; 7 | font-size: FONTSIZEPLACEHOLDER; 8 | background-color: rgb(99, 99, 99); 9 | } 10 | 11 | p 12 | { 13 | margin: 0; 14 | padding: 2px 0 2px 0; 15 | } 16 | 17 | p#version 18 | { 19 | font-size: 10pt; 20 | font-weight: bold; 21 | color: rgb(185, 140, 174); 22 | } 23 | 24 | div.framed 25 | { 26 | border-style: dotted; 27 | border-width: 1px 0; 28 | border-color: #666; 29 | margin: 10px 0; 30 | padding: 10px 31 | } 32 | 33 | span.comment 34 | { 35 | color: rgb(143, 144, 141); 36 | } 37 | 38 | div#script_output 39 | { 40 | background-color: rgb(39, 41, 44); 41 | } 42 | 43 | div.img 44 | { 45 | background-color: rgb(255, 255, 255); 46 | } 47 | 48 | span.output 49 | { 50 | color: rgb(162, 181, 112); 51 | } 52 | 53 | span.error 54 | { 55 | background: rgb(170, 71, 68); 56 | color: rgb(247, 202, 141); 57 | } 58 | 59 | span.warning 60 | { 61 | background: rgb(247, 202, 141); 62 | color: rgb(0, 0, 0); 63 | } 64 | 65 | hr 66 | { 67 | border: none; 68 | color: rgb(99, 99, 99); 69 | background-color: rgb(99, 99, 99); 70 | height: 1pt; 71 | } 72 | 73 | pre 74 | { 75 | padding: 0; 76 | margin: 0; 77 | line-height: 1.5; 78 | font-family: FONTPLACEHOLDER; 79 | font-size: FONTSIZEPLACEHOLDER; 80 | color:rgba(231, 231, 231, 1); 81 | } 82 | 83 | a 84 | { 85 | color: rgb(126, 175, 194); 86 | } 87 | 88 | .hidden 89 | { 90 | display: none; 91 | } 92 | 93 | .prompt 94 | { 95 | color: rgb(126, 175, 194); 96 | font-weight: bold; 97 | text-decoration: none; 98 | } -------------------------------------------------------------------------------- /Support/bin/ProcessHelpFiles.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby18 2 | require 'pp' 3 | Dir.chdir(File.join((ENV["R_HOME"] || "/Library/Frameworks/R.framework/Resources"), "library")) 4 | resources = Dir.glob("*/latex/*.tex") 5 | # puts resources 6 | results = "" 7 | resources.each do |file| 8 | tex = File.read(file) 9 | terms = tex.scan(/\\begin\{verbatim\}\n(.*)\\end\{verbatim\}/m) 10 | #.split(/\n+(?=[\w.]+\()/) 11 | results << terms[0][0] unless terms.empty? 12 | #.map{|line| line.gsub(/\n|( )/,"")} 13 | end 14 | results.gsub!(/\s*#+(\s.*|)$/,"") # Removes comments. Need to watch out for something like "#" 15 | results.gsub!(/^\s*[\w.:]+\s*\n/,"") # Removes stupid lines like a:b 16 | results.gsub!(/^(\.|<)\w.*|.*(\?topic|@name|survexp\.uswhite).*/,"") # removes function names starting with a dot, as well as other random stuff 17 | results.gsub!(/.*value\n/,"") # Removes lines like: tsp(x) <- value 18 | results.gsub!(/^\w\s+.*\n/,"") # Removes lines like: R CMD ... 19 | results.gsub!(/^[\w.]*(?:\[|\$).*\n/,"") # Removes lines starting with: x[[...]] or x$name 20 | results.gsub!(/^[\w.:+-\/><\s;!&|"]*\n/,"") # Removes things like: time1 + time2 21 | results.gsub!(/^(?:if|for|while|function)\(.*\n/,"") # Removes definitions of if/for/while/function 22 | results.gsub!(/\n(?![\w.]+\()/," ") # Brings together arguments on different lines 23 | results.gsub!(/[\t ]+/," ") 24 | results.gsub!(/\s+$/,"") 25 | # puts "Suspicious lines:" # UNCOMMENT FOR DEBUGGIN 26 | # pp results.scan(/^(.*[^ \w\(].\)) +(\w.*)/) #,"\\1\n\\2" # Try to fix some lines that got together 27 | puts "=" * 40 28 | puts results.split("\n").sort.uniq.join("\n") 29 | -------------------------------------------------------------------------------- /Support/bin/RhelperDaemon.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby18 -KU 2 | 3 | ################################### 4 | # 5 | # R daemon for as Helper 6 | # 7 | # written by Hans-Jörg Bibiko - bibiko@eva.mpg.de 8 | ################################### 9 | 10 | require 'pty' 11 | require 'fileutils' 12 | 13 | $pipe_in = "/tmp/textmate_Rhelper_in" 14 | $pipe_out = "/tmp/textmate_Rhelper_out" 15 | $pipe_status = "/tmp/textmate_Rhelper_status" 16 | $pipe_console = "/tmp/textmate_Rhelper_console" 17 | 18 | # check for valid TM_REXEC; if not use "R" 19 | if ENV['TM_REXEC'] != nil 20 | check = %x{which #{ENV['TM_REXEC']}} 21 | if check == "" 22 | %x{osascript -e 'tell app "TextMate" to display dialog "Please check TM_REXEC shell variable! “#{ENV['TM_REXEC']}” in PATH not found! Using “R” instead." buttons "OK" default button "OK"'} 23 | ENV['TM_REXEC'] = nil 24 | end 25 | end 26 | 27 | cmd = "#{(ENV['TM_REXEC']==nil) ? 'R' : ENV['TM_REXEC']} -q --vanilla --encoding=UTF-8 --TMRHelperDaemon 2&> '#{$pipe_console}'" 28 | 29 | FileUtils.rm_f($pipe_out) 30 | FileUtils.rm_f($pipe_status) 31 | FileUtils.rm_f($pipe_console) 32 | 33 | %x{echo -en "TM_RHelper" > /tmp/textmate_Rhelper_status} 34 | %x{echo -en "TM_RHelper" > /tmp/textmate_Rhelper_out} 35 | 36 | PTY.spawn(cmd) { |r,w,pid| 37 | 38 | r.sync = FALSE 39 | 40 | # write r to the nirvana 41 | Thread.new { 42 | r.read 43 | } 44 | 45 | # Thread to destroy daemon after quitting TextMate 46 | Thread.new do 47 | # Check if TextMate is still running; if not terminate Help Daemon 48 | while TRUE 49 | sleep 10 50 | break if %x{ps -ax | grep "[0-9] /.*app.*/TextMate" | cut -d ' ' -f2}.empty? 51 | end 52 | w.puts("q('no')") 53 | FileUtils.rm_f($pipe_in) 54 | FileUtils.rm_f($pipe_out) 55 | FileUtils.rm_f($pipe_status) 56 | FileUtils.rm_f($pipe_console) 57 | FileUtils.rm_f("/tmp/textmate_Rhelper_head.html") 58 | FileUtils.rm_f("/tmp/textmate_Rhelper_data.html") 59 | FileUtils.rm_f("/tmp/textmate_Rhelper_search.html") 60 | end 61 | 62 | $fin = File.open($pipe_in, "r+") 63 | 64 | w.puts "source('RhelperScript.R')" 65 | 66 | %x{echo -en "STARTED" > '#{$pipe_status}'} 67 | 68 | while TRUE 69 | task = $fin.gets.chomp 70 | %x{echo -en "BUSY" > '#{$pipe_status}'} 71 | if task[0,1] == "@" 72 | w.puts "sink('/tmp/textmate_Rhelper_out');TM_Rdaemon#{task[1..-1]};sink(file=NULL);cat('READY',file='#{$pipe_status}',sep='')" 73 | else 74 | w.puts "sink('/tmp/textmate_Rhelper_out');#{task};sink(file=NULL);cat('READY',file='#{$pipe_status}',sep='')" 75 | end 76 | w.puts "cat('READY',file='#{$pipe_status}',sep='');while(sink.number()>0){sink(file=NULL)}" 77 | end 78 | } 79 | -------------------------------------------------------------------------------- /Support/bin/RhelperScript.R: -------------------------------------------------------------------------------- 1 | TM_RdaemongetHelpURL <- function(x,...) { 2 | if(getRversion()>='2.10.0') { 3 | a<-gsub(".*/library/(.*?)/.*?/(.*?)(\\.html|$)",paste("http://127.0.0.1:",ifelse(tools:::httpdPort()<1,tools::startDynamicHelp(T),tools:::httpdPort()),"/library/\\1/html/\\2.html",sep=""),as.vector(help(x,try.all.packages=T,...)),perl=T) 4 | ifelse(length(a),cat(a,sep='\n'),cat("NA",sep='')) 5 | } else { 6 | a<-gsub("(.*?)/library/(.*?)/.*?/(.*?)(\\.html|$)","\\1/library/\\2/html/\\3.html",as.vector(help(x,try.all.packages=T,...)),perl=T) 7 | ifelse(length(a),cat(a,sep='\n'),cat("NA",sep='')) 8 | } 9 | } 10 | 11 | TM_RdaemongetHttpPort <- function() cat(ifelse(getRversion()>='2.10.0',ifelse(tools:::httpdPort()<1,tools::startDynamicHelp(T),tools:::httpdPort()),-2)) 12 | TM_RdaemongetSearchHelp <- function(x,ic=T) { 13 | if (getRversion()>='3.2.0') { 14 | p<-ifelse(tools:::httpdPort()<1,tools::startDynamicHelp(T),tools:::httpdPort()) 15 | a<-help.search(x,ignore.case=ic)$matches[,c("Package", "Name", "LibPath")] 16 | if(length(a)>0){ 17 | if(is.null(dim(a))) {a<-matrix(a,ncol=2)} 18 | cat(sort(apply(a,1,function(x) { 19 | h<-gsub(".*/library/(.*?)/.*?/(.*?)(\\.html|$)",paste("http://127.0.0.1:",p,"/library/\\1/html/\\2.html",sep=""),help(x[2],package=x[1])[1],perl=T) 20 | paste(c(x[1],x[2],h),collapse='\t')})),sep='\n') 21 | } else { 22 | # cat("NA",sep='') 23 | } 24 | } else { 25 | a<-help.search(x,ignore.case=ic)[[4]][,c(3,1)] 26 | if(length(a)>0){ 27 | if(is.null(dim(a))) {a<-matrix(a,ncol=2)} 28 | cat(sort(apply(a,1,function(x) { 29 | h<-gsub("(.*?)/library/(.*?)/.*?/(.*?)(\\.html|$)","\\1/library/\\2/html/\\3.html",help(x[2],package=x[1])[1],perl=T) 30 | paste(c(x[1],x[2],h),collapse='\t')})),sep='\n') 31 | } else { 32 | cat("NA",sep='') 33 | } 34 | } 35 | } 36 | TM_RdaemongetInstalledPackages <- function() cat(installed.packages()[,1],sep='\n') 37 | TM_RdaemongetLoadedPackages <- function() cat(sort(.packages()),sep='\n') 38 | TM_RdaemongetPackageFor <- function(x) cat(help.search(paste("^","ogrInfo","$",sep=""),ignore.case=F)$matches$Package,sep='\n') 39 | TM_RdaemongetCompletionList <- function(x,ic=F) { 40 | invisible(help.search("^§!#%$"));db<-utils:::.hsearch_db() 41 | a<-db$Alias[grep(paste("^",x,sep=""),db$Alias[,1],ignore.case=ic,perl=T),c(1,3)] 42 | if(is.null(dim(a))) {a<-matrix(a,ncol=2)} 43 | a<-a[grep("[<,]|-(class|package|method(s)?)|TM_Rdaemon",a[,1],invert=T),] 44 | if(is.null(dim(a))) {a<-matrix(a,ncol=2)} 45 | cat(sort(apply(a,1,function(x)paste(c(x[1],x[2]),collapse='\t'))),sep='\n') 46 | } 47 | -------------------------------------------------------------------------------- /Support/bin/Rsearch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | TERM="$1" 3 | AS="$2" 4 | 5 | HEAD=/tmp/textmate_Rhelper_head.html 6 | DATA=/tmp/textmate_Rhelper_data.html 7 | SEARCH=/tmp/textmate_Rhelper_search.html 8 | RhelperAnswer=/tmp/textmate_Rhelper_out 9 | 10 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "cat(getRversion()>='2.10.0',sep='')" 11 | sleep 0.05 12 | IS_HELPSERVER=$(cat "$RhelperAnswer") 13 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getHttpPort()" 14 | sleep 0.05 15 | PORT=$(cat "$RhelperAnswer") 16 | 17 | echo "" > "$HEAD" 18 | 19 | 20 | if [ "$AS" == "1" ]; then 21 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getSearchHelp('^$TERM')" 22 | AS="checked" 23 | else 24 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getSearchHelp('$TERM')" 25 | AS="" 26 | fi 27 | sleep 0.09 28 | 29 | CNT=`cat "$RhelperAnswer" | wc -l` 30 | if [ $CNT -gt 500 ]; then 31 | echo "" >> "$HEAD" 32 | else 33 | exec<"$RhelperAnswer" 34 | if [ "$IS_HELPSERVER" == "TRUE" ]; then 35 | while read i 36 | do 37 | lib=$(echo "$i" | cut -d ' ' -f1) 38 | fun=$(echo "$i" | cut -d ' ' -f2) 39 | link=$(echo "$i" | cut -d ' ' -f3) 40 | echo "" >> "$HEAD" 41 | done 42 | if [ $CNT -eq 1 ]; then 43 | echo "" > "$DATA" 44 | curl -gsS "$link" >> "$DATA" 45 | fi 46 | else 47 | while read i 48 | do 49 | lib=$(echo -e "$i" | cut -d ' ' -f1) 50 | fun=$(echo -e "$i" | cut -d ' ' -f2) 51 | link=$(echo -e "$i" | cut -d ' ' -f3) 52 | echo "" >> "$HEAD" 53 | done 54 | if [ $CNT -eq 1 ]; then 55 | echo "" 56 | cat "$link" | iconv -s -f ISO8859-1 -t UTF-8 57 | fi 58 | fi 59 | fi 60 | echo "
PackageTopic
too much matches...
$lib$fun
$lib$fun
" >> "$HEAD" 61 | 62 | cat <<-HFS > "$SEARCH" 63 | 64 | 65 | 93 | 94 | 95 | 96 | 97 | 102 | 108 | 109 | 110 | 111 | 112 | 115 | 116 |
98 |
99 | Search for
100 | 101 |
103 | 104 |
105 |
 begins with 106 |
107 |
113 | 114 |
117 | 118 | 119 | HFS2 120 | 121 | sleep 0.05 122 | -------------------------------------------------------------------------------- /Support/bin/askRhelperDaemon.sh: -------------------------------------------------------------------------------- 1 | 2 | #dispose all frozen ProgressDialogs first 3 | { 4 | while [ 1 ] 5 | do 6 | res=$("$DIALOG" -x `"$DIALOG" -l 2>/dev/null| grep Rdaemon | cut -d " " -f 1` 2>/dev/null) 7 | [[ ${#res} -eq 0 ]] && break 8 | done 9 | } & 10 | 11 | 12 | "$TM_BUNDLE_SUPPORT"/bin/startRhelperDaemon.sh &> /dev/null 13 | echo "$1" > /tmp/textmate_Rhelper_in 14 | sleep 0.01 15 | SAFECNT=0 16 | while [ 1 ] 17 | do 18 | SAFECNT=$(($SAFECNT+1)) 19 | if [ $SAFECNT -gt 5000 ]; then 20 | echo -en "No RESULT from R Helper server!" 21 | exit 206 22 | fi 23 | RES=$(tail -c 2 /tmp/textmate_Rhelper_console) 24 | [[ "$RES" == "> " ]] && break 25 | sleep 0.01 26 | done 27 | if [ -e /tmp/textmate_Rhelper_status ]; then 28 | SAFECNT=0 29 | sleep 0.001 30 | while [ `cat /tmp/textmate_Rhelper_status` != "READY" ] 31 | do 32 | SAFECNT=$(($SAFECNT+1)) 33 | if [ $SAFECNT -gt 1000 ]; then 34 | echo -en "No RESULT from R Helper server!" 35 | exit 206 36 | fi 37 | sleep 0.01 38 | done 39 | fi 40 | 41 | 42 | -------------------------------------------------------------------------------- /Support/bin/auto_show_func_usage.sh: -------------------------------------------------------------------------------- 1 | 2 | export WORD=$(ruby18 -- <<-SCR1 3 | print ENV['TM_CURRENT_LINE'][0...ENV['TM_LINE_INDEX'].to_i].gsub!(/ *$/, "").match(/[\w.:]*$/).to_s 4 | SCR1 5 | ) 6 | 7 | 8 | WORDORG="$WORD" 9 | PKG="" 10 | if [ `echo "$WORD" | grep -Fc ':'` -gt 0 ]; then 11 | PKG=",package='${WORD%%:*}'" 12 | fi 13 | WORD="${WORD##*:}" 14 | 15 | #check whether WORD is defined otherwise quit 16 | [[ -z "$WORD" ]] && exit 200 17 | 18 | TEXT=$(cat) 19 | 20 | RhelperAnswer="/tmp/textmate_Rhelper_out" 21 | 22 | # Rdaemon 23 | RPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' ) 24 | RD=$(echo -n "$TM_SCOPE" | grep -c -F 'source.rd.console') 25 | if [ ! -z "$RPID" -a "$RD" -gt 0 ]; then 26 | RDHOME="$HOME/Library/Application Support/Rdaemon" 27 | if [ "$TM_RdaemonRAMDRIVE" == "1" ]; then 28 | RDRAMDISK="/tmp/TMRramdisk1" 29 | else 30 | RDRAMDISK="$RDHOME" 31 | fi 32 | [[ -e "$RDRAMDISK"/r_tmp ]] && rm "$RDRAMDISK"/r_tmp 33 | 34 | # execute "args()" in Rdaemon 35 | TASK="@|sink('$RDRAMDISK/r_tmp');args($WORDORG)" 36 | echo "$TASK" > "$RDHOME"/r_in 37 | echo "@|sink(file=NULL)" > "$RDHOME"/r_in 38 | while [ 1 ] 39 | do 40 | RES=$(tail -c 2 "$RDRAMDISK"/r_out) 41 | [[ "$RES" == "> " ]] && break 42 | [[ "$RES" == ": " ]] && break 43 | [[ "$RES" == "+ " ]] && break 44 | sleep 0.03 45 | done 46 | sleep 0.001 47 | RES=$(cat "$RDRAMDISK"/r_tmp | sed 's/NULL$//;') 48 | [[ "$RES" == "NULL" ]] && RES="" 49 | # "args()" did find something 50 | if [ ! -z "$RES" ]; then 51 | OUT=$(echo -en "$WORD${RES:9}" | perl -e 'undef($/);$a=<>;$a=~s/"\t"/"\\t"/sg;$a=~s/"\n"/"\\n"/sg;print $a') 52 | rm -f "$RDRAMDISK"/r_tmp 53 | TASK="@|sink('$RDRAMDISK/r_tmp');cat(gsub('.*?/library/(.*?)/.*','\\\\1',as.vector(help('$WORD',try.all.packages=F)),perl=T),sep='\n')" 54 | echo "$TASK" > "$RDHOME"/r_in 55 | TASK="@|sink(file=NULL)" 56 | echo "$TASK" > "$RDHOME"/r_in 57 | while [ 1 ] 58 | do 59 | RES=$(tail -c 2 "$RDRAMDISK"/r_out) 60 | [[ "$RES" == "> " ]] && break 61 | [[ "$RES" == ": " ]] && break 62 | [[ "$RES" == "+ " ]] && break 63 | sleep 0.03 64 | done 65 | sleep 0.001 66 | LIB=$(cat "$RDRAMDISK"/r_tmp) 67 | if [ -z "$LIB" ]; then 68 | echo -n "$OUT" 69 | echo -en "\n• local" 70 | exit 206 71 | fi 72 | CNT=$(echo "$LIB" | wc -l) 73 | if [ $CNT -eq 1 ]; then 74 | echo -n "$OUT" 75 | echo -en "\n•• library: $LIB" 76 | exit 206 77 | fi 78 | # "args()" didn't find anything ergo library isn't yet loaded 79 | else 80 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getHelpURL('$WORD'$PKG)" 81 | FILE=$(cat "$RhelperAnswer") 82 | if [ ! -z "$FILE" -a "$FILE" != "NA" ]; then 83 | exec<"$RhelperAnswer" 84 | while read i 85 | do 86 | if [ "${i:0:1}" = "/" ]; then 87 | RES=$(cat "$i") 88 | else 89 | RES=$(curl -gsS "$i") 90 | fi 91 | echo -n "$RES" | "$TM_BUNDLE_SUPPORT/bin/parseHTMLForUsage.sh" "$WORD" 0 92 | LIB=$(echo "$i" | perl -pe 's!.*?/library/(.*?)/.*!$1!') 93 | TASK="@|sink('$RDRAMDISK/r_tmp')" 94 | echo "$TASK" > "$RDHOME"/r_in 95 | TASK="@|cat(sum((.packages()) %in% \"$LIB\"),sep='')" 96 | echo "$TASK" > "$RDHOME"/r_in 97 | TASK="@|sink(file=NULL)" 98 | echo "$TASK" > "$RDHOME"/r_in 99 | while [ 1 ] 100 | do 101 | RES=$(tail -c 2 "$RDRAMDISK"/r_out) 102 | [[ "$RES" == "> " ]] && break 103 | [[ "$RES" == ": " ]] && break 104 | [[ "$RES" == "+ " ]] && break 105 | sleep 0.02 106 | done 107 | sleep 0.001 108 | RES=$(cat "$RDRAMDISK"/r_tmp) 109 | if [ ! -z "$RES" -a "$RES" == "1" ]; then 110 | echo -en "\n•• library: $LIB" 111 | else 112 | echo -en "\n• library “${LIB}” not loaded [press CTRL+SHIFT+L]" 113 | fi 114 | echo 115 | done 116 | exit 206 117 | else 118 | exit 200 119 | fi 120 | fi 121 | fi 122 | 123 | # R script 124 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getHelpURL('$WORD'$PKG)" 125 | FILE=$(cat "$RhelperAnswer") 126 | if [ ! -z "$FILE" -a "$FILE" != "NA" ]; then 127 | exec<"$RhelperAnswer" 128 | while read i 129 | do 130 | if [ "${i:0:1}" = "/" ]; then 131 | RES=$(cat "$i") 132 | else 133 | RES=$(curl -gsS "$i") 134 | fi 135 | # "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getPackageFor('$WORD')" 136 | # LIB=$(cat "$RhelperAnswer") 137 | LIB=$(echo "$i" | perl -pe 's!.*?/library/(.*?)/.*!$1!') 138 | RES=$(echo -en "$RES" | "$TM_BUNDLE_SUPPORT/bin/parseHTMLForUsage.sh" "$WORD" 0) 139 | if [ ! -z "$RES" -a "${RES:0:1}" == "${WORD:0:1}" ]; then 140 | echo -n "$RES" 141 | echo -en "\n•• library: $LIB\n" 142 | fi 143 | done 144 | exit 206 145 | else 146 | [[ `echo -n "$TM_SCOPE" | grep -c -F 'text.tex.latex.rdaemon'` -gt 0 ]] && exit 200 147 | # Parse R script for functions 148 | OUT=$(echo -en "$TEXT" | "$TM_BUNDLE_SUPPORT/bin/parseDocForFunctions.sh" "$WORD") 149 | [[ -z "$OUT" ]] && exit 200 150 | echo -n "$WORD$OUT 151 | • local" 152 | exit 206 153 | fi 154 | -------------------------------------------------------------------------------- /Support/bin/initCommandArgsDir.sh: -------------------------------------------------------------------------------- 1 | WDIR="$HOME/Library/Application Support/TextMate/R/help" 2 | 3 | if [ ! -e "$WDIR/command_args" ]; then 4 | mkdir -p "$WDIR/command_args" 5 | cp -R "$TM_BUNDLE_SUPPORT"/lib/command_args "$WDIR" 6 | fi -------------------------------------------------------------------------------- /Support/bin/insert_command_template.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby18 2 | require File.join(ENV['TM_SUPPORT_PATH'], "lib/exit_codes.rb") 3 | require File.join(ENV['TM_SUPPORT_PATH'], "lib/ui.rb") 4 | require File.join(ENV['TM_SUPPORT_PATH'], 'lib/current_word.rb') 5 | 6 | require File.join(ENV['TM_BUNDLE_SUPPORT'], 'lib/popen3.rb') 7 | 8 | word = Word.current_word('\w\.') 9 | 10 | stdin, stdout, stderr = popen3("R", "--vanilla", "--no-readline", "--slave", "--encoding=UTF-8") 11 | 12 | stdin.write(File.read(File.join(ENV['TM_BUNDLE_SUPPORT'], 'getSig.R'))) 13 | 14 | wordEsc = word.gsub("\\|'", "\\\\\\0") 15 | wordReg = Regexp.escape(word).gsub("\\|'", "\\\\\\0") 16 | stdin.puts("cat(paste(getSig(if ('#{wordEsc}' %in% (ary <- sort(apropos('^#{wordReg}', mode='function')))) '#{wordEsc}' else ary), collapse='\\n'))") 17 | stdin.close 18 | 19 | text = stdout.read() 20 | 21 | TextMate.exit_show_tool_tip("No function signature known for `#{word}'") if text.empty? 22 | 23 | functions = text.split("\n") 24 | if functions.size == 1 25 | function = functions.first 26 | else 27 | # term = TextMate::UI.request_item :title => "Snippet for Command", :prompt => "There were more than one matching commands found", :items => functions.collect { |f| f[0...f.index("(")] } 28 | idx = TextMate::UI.menu functions.collect { |f| f[0...f.index("(")] } 29 | TextMate.exit_discard if idx.nil? 30 | function = functions[idx] 31 | # function = functions.find("") { |f| f[0..term.length] == term + "(" } 32 | end 33 | 34 | TextMate.exit_discard if function.empty? 35 | 36 | if ENV['TM_SELECTED_TEXT'].nil? or ENV['TM_SELECTED_TEXT'].empty? 37 | # we didn't use selected text but instead pulled the word from the line 38 | # so lets only insert everything after the term 39 | print function[word.length..-1] 40 | NameError 41 | else 42 | print function 43 | end 44 | -------------------------------------------------------------------------------- /Support/bin/insert_function_param.sh: -------------------------------------------------------------------------------- 1 | 2 | [[ -n "$TM_SELECTED_TEXT" ]] && echo "Please unselect first." && exit 206 3 | 4 | #look for nested commands and set WORD to the current one 5 | WORD=$(perl -e ' 6 | $line=$ENV{"TM_CURRENT_LINE"}; 7 | $col=$ENV{"TM_LINE_INDEX"}; 8 | $line=substr($line,0,$col); 9 | $line=~s/ //g; 10 | @arr=split(//,$line);$c=0; 11 | for($i=$#arr;$i>-1;$i--){$c-- if($arr[$i] eq ")");$c++ if($arr[$i] eq "(");last if $c>0;} 12 | substr($line,0,$i)=~m/([\w\.:]+)$/; 13 | print $1 if defined($1); 14 | ') 15 | 16 | PKG="" 17 | if [ `echo "$WORD" | grep -Fc ':'` -gt 0 ]; then 18 | PKG=",package='${WORD%%:*}'" 19 | fi 20 | WORD="${WORD##*:}" 21 | OUT="" 22 | #check whether WORD is defined otherwise quit 23 | [[ -z "$WORD" ]] && echo "No keyword found" && exit 206 24 | 25 | #check for user-defined parameter list 26 | "$TM_BUNDLE_SUPPORT"/bin/initCommandArgsDir.sh 27 | if [ -e "$HOME/Library/Application Support/TextMate/R/help/command_args/$WORD" ]; then 28 | RES=$(cat "$HOME/Library/Application Support/TextMate/R/help/command_args/$WORD") 29 | else 30 | # Rdaemon 31 | RPID=$(ps aw | grep '[0-9] /.*TMRdaemon' | awk '{print $1;}' ) 32 | RD=$(echo -n "$TM_SCOPE" | grep -c -F 'source.rd.console') 33 | if [ ! -z "$RPID" -a "$RD" -gt 0 ]; then 34 | RDHOME="$HOME/Library/Application Support/Rdaemon" 35 | if [ "$TM_RdaemonRAMDRIVE" == "1" ]; then 36 | RDRAMDISK="/tmp/TMRramdisk1" 37 | else 38 | RDRAMDISK="$RDHOME" 39 | fi 40 | [[ -e "$RDRAMDISK"/r_tmp ]] && rm "$RDRAMDISK"/r_tmp 41 | 42 | # execute "args()" in Rdaemon 43 | TASK="@|sink('$RDRAMDISK/r_tmp');args($WORD)" 44 | echo "$TASK" > "$RDHOME"/r_in 45 | echo "@|sink(file=NULL)" > "$RDHOME"/r_in 46 | while [ 1 ] 47 | do 48 | RES=$(tail -c 2 "$RDRAMDISK"/r_out) 49 | [[ "$RES" == "> " ]] && break 50 | [[ "$RES" == ": " ]] && break 51 | [[ "$RES" == "+ " ]] && break 52 | sleep 0.03 53 | done 54 | sleep 0.001 55 | OUT=$(cat "$RDRAMDISK"/r_tmp | perl -e 'undef($/);$a=<>;$a=~s/NULL$//;$a=~s/^.*?\(/(/;$a=~s/"\t"/"\\t"/sg;$a=~s/"\n"/"\\n"/sg;$a=~s/\n//sg;print $a') 56 | [[ "$OUT" == "NULL" ]] && OUT="" 57 | fi 58 | 59 | if [ -z "$OUT" ]; then 60 | # Get URL for current function 61 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getHelpURL('$WORD'$PKG)" 62 | FILE=$(cat /tmp/textmate_Rhelper_out) 63 | if [ `cat /tmp/textmate_Rhelper_out | wc -l` -gt 1 ]; then 64 | echo -e "Function '$WORD' is ambiguous.\nFound in packages:" 65 | echo "$FILE" | perl -pe 's!.*?/library/(.*?)/.*?/.*!$1!' 66 | exit 206 67 | fi 68 | if [ ! -z "$FILE" -a "$FILE" != "NA" ]; then 69 | if [ "${FILE:0:1}" = "/" ]; then 70 | RES=$(cat "$FILE") 71 | else 72 | RES=$(curl -gsS "$FILE") 73 | fi 74 | OUT=$(echo -en "$RES" | "$TM_BUNDLE_SUPPORT/bin/parseHTMLForUsage.sh" "$WORD" 1) 75 | else 76 | # Parse R script for functions 77 | OUT=$(cat | "$TM_BUNDLE_SUPPORT/bin/parseDocForFunctions.sh" "$WORD" | perl -e 'undef($/);$a=<>;$a=~s/"\t"/"\\t"/sg;$a=~s/"\n"/"\\n"/sg;$a=~s/\n//sg;print $a') 78 | # Check for errors 79 | if [ `echo -n "$OUT" | grep -F 'declaration possibly erroneous:' | wc -l` -gt 0 ]; then 80 | echo "$WORD$OUT" && exit 206 81 | fi 82 | fi 83 | 84 | if [ -z "$OUT" ]; then 85 | echo "Nothing found" 86 | exit 206 87 | fi 88 | fi 89 | # Evaluate function arguments and get a list of them 90 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "for (i in names(formals(function $OUT {})->a)) {cat(i);cat(' = ');print(a[[i]])}" 91 | RES=$(cat /tmp/textmate_Rhelper_out | perl -e 'undef($/);$a=<>;$a=~s/ = \[1\] / = /g;$a=~s/\.\.\..*\n//g;$a=~s/\n +//g;print $a' ) 92 | 93 | fi 94 | 95 | #if no parameter quit 96 | if [ -z "$RES" ]; then 97 | echo -n "Nothing found" 98 | exit 206 99 | fi 100 | 101 | #show all parameters as inline menu and insert the parameter as snippet (if '=' is found only the value) 102 | ruby18 -- <<-SCRIPT 103 | # 2> /dev/null 104 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/exit_codes.rb") 105 | require "#{ENV["TM_SUPPORT_PATH"]}/lib/ui" 106 | word = "$WORD" 107 | text = %q[$RES] 108 | funs = text.split("\n") 109 | TextMate.exit_discard if funs.size < 1 110 | 111 | if funs.size == 1 112 | function = funs.first 113 | else 114 | funs.unshift("-") 115 | funs.unshift("All Parameters") 116 | idx = TextMate::UI.menu(funs) 117 | TextMate.exit_discard if idx.nil? 118 | function = funs[idx] 119 | end 120 | TextMate.exit_discard if function.empty? 121 | curword = ENV['TM_CURRENT_WORD'] 122 | comma="" 123 | line, col = ENV['TM_CURRENT_LINE'], ENV['TM_LINE_INDEX'].to_i 124 | left = line[0...col].to_s 125 | sp = left.match(/.$/).to_s 126 | left.gsub!(/ +$/,'') 127 | left = left.match(/.$/).to_s 128 | comma = "\${2:, }" if left != "(" && left != "," 129 | comma = " " + comma if sp == "," 130 | if function == "All Parameters" 131 | cnt=1 132 | com="" 133 | snip="" 134 | funs.slice!(0) 135 | funs.slice!(0) 136 | funs.each do |item| 137 | com = ", " if cnt > 1 138 | #if cnt%5 == 0 139 | # com = ",\n\t" 140 | #end 141 | if item.match("=") 142 | arr = item.gsub(/ = /, "=").match('([^=]+?)=(.*)') 143 | if arr[2].match('^\"') 144 | print "#{com}#{arr[1]} = \"\${" 145 | print cnt.to_s 146 | cnt+=1 147 | print ":#{arr[2].gsub(/^\"|\"$/, "").gsub(/=/, " = ")}}\"" 148 | else 149 | if arr[2].match('^c\(') 150 | print "#{com}#{arr[1]} = c(\${" 151 | print cnt.to_s 152 | cnt+=1 153 | print ":#{arr[2].gsub(/^c\(/, "").gsub(/\)\Z/,"").gsub(/=/, " = ")}})" 154 | else 155 | print "#{com}#{arr[1]} = \${" 156 | print cnt.to_s 157 | cnt+=1 158 | print ":#{arr[2].gsub(/=/, " = ")}}" 159 | end 160 | end 161 | else 162 | print "#{com}#{item} = \${" 163 | print cnt.to_s 164 | cnt+=1 165 | print ":}" 166 | end 167 | end 168 | print "\${#{cnt}:}" 169 | else 170 | if function.match("=") 171 | arr = function.gsub(/ = /, "=").match('([^=]+?)=(.*)') 172 | if arr[2].match('^\"') 173 | print "#{comma}#{arr[1]} = \"\${1:#{arr[2].gsub(/^\"|\"$/, "")}}\"\${3:}" 174 | else 175 | if arr[2].match('^c\(') 176 | subarr = arr[2].gsub(/^c\(/, "").gsub(/\)$/,"").gsub(/ /,"").split(",") 177 | for i in (0..(subarr.size - 1)) 178 | subarr[i] = "\${#{i+3}:#{subarr[i]}}" 179 | end 180 | print "#{comma}#{arr[1]} = \${1:c(#{subarr.join(", ")})}\${300:}" 181 | else 182 | print "#{comma}#{arr[1]} = \${1:#{arr[2].gsub(/=/, " = ")}}\${3:}" 183 | end 184 | end 185 | else 186 | print "#{comma}#{function} = \${1:}\${3:}" 187 | end 188 | end 189 | SCRIPT 190 | -------------------------------------------------------------------------------- /Support/bin/insert_package_name.sh: -------------------------------------------------------------------------------- 1 | 2 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "@getInstalledPackages()" 3 | 4 | cat "/tmp/textmate_Rhelper_out" | sort -f | ruby18 -e ' 5 | isDIALOG2 = ! ENV["DIALOG"].match(/2$/).nil? 6 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/ui.rb") 7 | require File.join(ENV["TM_SUPPORT_PATH"], "lib/exit_codes.rb") 8 | words = STDIN.read().split("\n") 9 | if isDIALOG2 10 | TextMate::UI.complete(words) 11 | else 12 | index=TextMate::UI.menu(words) 13 | end 14 | if index != nil 15 | print words[index] 16 | else 17 | TextMate.exit_discard() 18 | end 19 | exit 203 20 | ' -------------------------------------------------------------------------------- /Support/bin/parseDocForFunctions.sh: -------------------------------------------------------------------------------- 1 | 2 | USE=$(cat | egrep -A 10 "\b${1//./\\.}\b *<\-[ ]*\bfunction\b[ ]*\(" | perl -e ' 3 | undef($/); 4 | $a=<>; 5 | $a=~s/.*?<\-\s*\bfunction\b\s*(\(.*?\))\s*[\t\n\{\w].*/$1/gms; 6 | $a=~s/"\n"/"\\n"/g; 7 | $a=~s/\x27\n\x27/\x27\\n\x27/g; 8 | $a=~s/[\n\t]/ /g; 9 | $a=~s/ {2,}/ /g; 10 | $a=~s/^\(\s*/(/g; 11 | $a=~s/\s*\)$/)/g; 12 | $a=~s/\s*=\s*/ = /g; 13 | $a=~s/\s*,\s*/, /g; 14 | print $a 15 | ') 16 | 17 | # If Rhelper doesn't work, use the following line only 18 | # echo $USE | fmt | perl -e 'undef($/);$a=<>;$a=~s/\n/\n\t/g;$a=~s/\n\t$//;print $a' 19 | if [ ! -z "$USE" ]; then 20 | "$TM_BUNDLE_SUPPORT"/bin/askRhelperDaemon.sh "TM_Rdaemona<-function $USE {};args(TM_Rdaemona)" 21 | # sleep 0.01 22 | OUT=$(cat /tmp/textmate_Rhelper_out | sed '$d' | perl -pe 's/^function //;s/"\n"/"\\n"/g;s/"\t"/"\\t"/g') 23 | if [ -z "$OUT" -a ! -z "$USE" ]; then 24 | echo " declaration possibly erroneous: 25 | $USE" 26 | else 27 | echo -n "$OUT" 28 | fi 29 | fi -------------------------------------------------------------------------------- /Support/bin/parseHTMLForUsage.sh: -------------------------------------------------------------------------------- 1 | 2 | export WORD="$1" 3 | export FLAG="$2" 4 | 5 | # FLAG == 1 remove \n and function name for parameter parsing 6 | # FLAG == 0 show function usage 7 | 8 | cat | perl -e ' 9 | undef($/); 10 | $w=$ENV{"WORD"}; 11 | $f=$ENV{"FLAG"}; 12 | $a=<>; 13 | $a=~s!.*?Usage\s*
[^>]*?($w\([^>]*?\)).*?\n.*?
.*!$1!ms; 14 | $a=~s/"\t"/"\\t"/sg; 15 | $a=~s/"\n"/"\\n"/sg; 16 | if($f) { 17 | $a=~s/\n//sg; 18 | $a=~s/^$w//ms; 19 | $a="" if($a!~m/^\(.*\)$/); 20 | } 21 | if($a!~m/^ /dev/null & 17 | SAFECNT=0 18 | while [ 1 ] 19 | do 20 | SAFECNT=$(($SAFECNT+1)) 21 | if [ $SAFECNT -gt 5000 ]; then 22 | echo -en "Start failed! No response from R Helper server!" 23 | exit 206 24 | fi 25 | RES=$(tail -c 2 "$OUT") 26 | [[ "$RES" == "> " ]] && break 27 | sleep 0.03 28 | done 29 | sleep 0.3 30 | cat "" > /tmp/textmate_Rhelper_data.html 31 | fi 32 | -------------------------------------------------------------------------------- /Support/bin/startRhelperbuilder.sh: -------------------------------------------------------------------------------- 1 | 2 | 3 | ################################ 4 | ## NOT YET USED !!!!! 5 | ################################ 6 | 7 | 8 | WDIR="$TM_BUNDLE_SUPPORT"/bin 9 | HTMLROOTPATH="$HOME/Library/Application Support/TextMate/R/help/HTML" 10 | 11 | [[ ! -e "$HTMLROOTPATH" ]] && mkdir -p "$HTMLROOTPATH" 12 | 13 | cd "$WDIR" 14 | 15 | if [ ! -e /tmp/r_helper_dummy ]; then 16 | mkfifo /tmp/r_helper_dummy 17 | else 18 | if [ ! -p /tmp/r_helper_dummy ]; then 19 | rm /tmp/r_helper_dummy 20 | mkfifo /tmp/r_helper_dummy 21 | fi 22 | fi 23 | 24 | ruby18 Rhelperbuilder.rb &> /dev/null & 25 | 26 | ### wait for Rhelper 27 | #safety counter 28 | SAFECNT=0 29 | while [ ! -f /tmp/r_helper_dummy_out ] 30 | do 31 | SAFECNT=$(($SAFECNT+1)) 32 | if [ $SAFECNT -gt 50000 ]; then 33 | echo -en "Start failed! No response from Rhelper!" 34 | exit 206 35 | fi 36 | sleep 0.01 37 | done 38 | 39 | #wait for Rdaemon's output is ready 40 | SAFECNT=0 41 | while [ 1 ] 42 | do 43 | ST=$(tail -n 1 /tmp/r_helper_dummy_out ) 44 | [[ "$ST" == "> " ]] && break 45 | SAFECNT=$(($SAFECNT+1)) 46 | if [ $SAFECNT -gt 50000 ]; then 47 | echo -en "Start failed! No response from Rhelper!" 48 | exit 206 49 | fi 50 | sleep 0.05 51 | done 52 | 53 | exec<"$TM_BUNDLE_SUPPORT/helpshort.index" 54 | # SAFECNT=0 55 | export token=$("$DIALOG" -a ProgressDialog -p "{title=Rdaemon;isIndeterminate=1;summary='R Documentation';details='Create HTML help pages…';}") 56 | while read line 57 | do 58 | OLDIFS="$IFS" 59 | IFS="/" 60 | data=( $line ) 61 | # fun=$(echo -n $line | cut -d '/' -f2) 62 | # lib=$(echo -n $line | cut -d '/' -f1) 63 | [[ ! -e "$HTMLROOTPATH/${data[0]}" ]] && mkdir -p "$HTMLROOTPATH/${data[0]}" 64 | file="$HTMLROOTPATH/${data[0]}/${data[1]}.html" 65 | if [ ! -e "$file" ]; then 66 | curl -sS "http://127.0.0.1:30815/library/${data[0]}/html/${data[1]}.html" > "$file" 67 | fi 68 | # SAFECNT=$(($SAFECNT+1)) 69 | # [[ $SAFECNT -gt 50 ]] && break 70 | done 71 | "$DIALOG" -x $token 2&>/dev/null 72 | 73 | 74 | sleep .1 75 | echo "q('no')" > /tmp/r_helper_dummy 76 | rm /tmp/r_helper_dummy 77 | rm /tmp/r_helper_dummy_out 78 | -------------------------------------------------------------------------------- /Support/getSig.R: -------------------------------------------------------------------------------- 1 | getSig <- function (..., snippet=T) 2 | sapply(unlist(list(...)), function(name, snipIdx=0, argIdx=0) 3 | paste(c(name, "(", 4 | if (snippet && is.null(formals(name))) 5 | "$1" 6 | else 7 | lapply( 8 | lapply(names(f <- formals(name)), 9 | function (arg) 10 | if (is.symbol(f[[arg]]) && f[[arg]] == "") arg else list(arg, f[[arg]]) 11 | ), 12 | function (arg, escape=function(x) ifelse(snippet, gsub(" *\n +", " ", gsub("([\\$`}])", "\\\\\\1", x)), x)) 13 | if (is.list(arg)) 14 | paste(if (snippet) paste("${", snipIdx <<- snipIdx + 1, ":", sep=""), 15 | ifelse((argIdx <<- argIdx + 1) > 1, ", ", ""), 16 | escape(deparse(as.name(arg[[1]]), backtick=T)), 17 | "=", 18 | if (snippet) paste("${", snipIdx <<- snipIdx + 1, ":", sep=""), 19 | if (is.character(arg[[2]])) 20 | paste('"', 21 | if (snippet) paste('${', snipIdx <<- snipIdx + 1, ":", sep=""), 22 | escape(substr(deparse(arg[[2]]), 2, nchar(deparse(arg[[2]]),type="c")-1)), 23 | ifelse(snippet, '}', ""), 24 | '"', 25 | sep="" 26 | ) 27 | else 28 | escape(paste(deparse(arg[[2]], backtick=T, control="useSource"), collapse="\n")) 29 | , 30 | ifelse(snippet, "}}", ""), 31 | sep="") 32 | else 33 | paste(ifelse((argIdx <<- argIdx + 1) > 1, 34 | ifelse(snippet, paste("${", snipIdx <<- snipIdx + 1, ":, ", sep=""), ", "), 35 | ""), 36 | if (snippet) paste("${", snipIdx <<- snipIdx + 1, ":", sep=""), 37 | escape(arg), 38 | ifelse(snippet, ifelse(argIdx > 1, "}}", "}"), ""), 39 | sep="") 40 | ) 41 | , 42 | ")") 43 | , collapse="" 44 | ) 45 | ) 46 | -------------------------------------------------------------------------------- /Support/getSigTest.R: -------------------------------------------------------------------------------- 1 | # This file is just used for testing getSig.R 2 | # I committed it to the repo so it can be used for further maintenance of getSig.R 3 | # 4 | # Kevin Ballard 5 | 6 | source("./getSig.R") 7 | 8 | # function to use in testing symbols 9 | fubar <- function (x, y=`+`, z=if (T) "foo" else "bar", q="haha", `a a`=c("heavy", "medium", "light"), meth=mean) { 10 | do.call(y, as.list(x)) 11 | } 12 | 13 | # cat(paste(getSig(if ('p' %in% (ary <- sort(apropos('^p', mode='function')))) 'p' else ary), collapse='\n')) 14 | cat(paste(getSig("fubar"), collapse="\n")) 15 | -------------------------------------------------------------------------------- /Support/lib/command_args/dist: -------------------------------------------------------------------------------- 1 | x 2 | method="euclidean|maximum|manhattan|canberra|binary|minkowski" 3 | diag=FALSE 4 | upper=FALSE 5 | p = 2 -------------------------------------------------------------------------------- /Support/lib/command_args/getOption: -------------------------------------------------------------------------------- 1 | "add.smooth" 2 | "check.bounds" 3 | "continue" 4 | "defaultPackages" 5 | "deparse.max.lines" 6 | "digits" 7 | "digits.secs" 8 | "download.file.method" 9 | "echo" 10 | "encoding" 11 | "error" 12 | "expressions25...500000" 13 | "keep.source" 14 | "keep.source.pkgs" 15 | "mailer" 16 | "max.contour.segments" 17 | "max.print" 18 | "OutDec" 19 | "pager" 20 | "papersize" 21 | "printcmd" 22 | "prompt" 23 | "rl_word_breaks" 24 | "save.defaults" 25 | "save.image.defaults" 26 | "scipen" 27 | "showErrorCalls" 28 | "showWarnCalls" 29 | "showNCalls" 30 | "show.error.messages" 31 | "stringsAsFactors" 32 | "texi2dvi" 33 | "timeout" 34 | "topLevelEnvironment" 35 | "useFancyQuotes" 36 | "verbose" 37 | "warn" 38 | "warnPartialMatchArgs" 39 | "warnPartialMatchAttr" 40 | "warnPartialMatchDollar" 41 | "warning.expression" 42 | "warnings.length" 43 | "width" 44 | - 45 | "device" 46 | "locatorBell" 47 | "par.ask.default" 48 | "X11colortype" 49 | "X11fonts" 50 | "gamma" 51 | - 52 | "contrasts" 53 | "na.action" 54 | "show.coef.Pvalues" 55 | "show.signif.stars" 56 | "ts.eps" 57 | "ts.S.compat" 58 | - 59 | "browser" 60 | "de.cellwidth" 61 | "editor" 62 | "example.ask" 63 | "help.try.all.packages" 64 | "HTTPUserAgent" 65 | "internet.info" 66 | "menu.graphics" 67 | "pkgType" 68 | "repos" 69 | "SweaveHooks" 70 | "SweaveSyntax" 71 | "unzip" 72 | "- 73 | "dvipscmd" 74 | "latexcmd" 75 | "pdfviewer" -------------------------------------------------------------------------------- /Support/lib/command_args/lines: -------------------------------------------------------------------------------- 1 | type="p|l|b|c|o|h|s|S|n" -------------------------------------------------------------------------------- /Support/lib/command_args/mean: -------------------------------------------------------------------------------- 1 | trim=0 2 | na.rm=TRUE -------------------------------------------------------------------------------- /Support/lib/command_args/options: -------------------------------------------------------------------------------- 1 | add.smooth=TRUE 2 | check.bounds=FALSE 3 | continue="+ " 4 | defaultPackages=c("datasets", "utils", "grDevices", "graphics", "stats", "methods") 5 | deparse.max.lines=10 6 | digits=7 7 | digits.secs=0...6 8 | download.file.method="internal|wget|lynx|auto" 9 | echo=TRUE 10 | encoding="native.enc" 11 | error=NULL|fun 12 | expressions25...500000 13 | keep.source=TRUE 14 | keep.source.pkgs=FALSE 15 | mailer="none" 16 | max.contour.segments=250000 17 | max.print=99999 18 | OutDec="." 19 | pager="$R_HOME/bin/pager" 20 | papersize="" 21 | printcmd="" 22 | prompt="> " 23 | rl_word_breaks=" \t\n\"\\`><=%;,|&{()}" 24 | save.defaults=list(ascii=TRUE, safe=FALSE) 25 | save.image.defaults=list(ascii=TRUE, safe=FALSE) 26 | scipen=integer_positiveFixed|negativeScientific 27 | showErrorCalls=TRUE 28 | showWarnCalls=TRUE 29 | showNCalls=30...500 30 | show.error.messages=TRUE 31 | stringsAsFactors=TRUE 32 | texi2dvi="NULL|script" 33 | timeout=60 34 | topLevelEnvironment="" 35 | useFancyQuotes=TRUE 36 | verbose=TRUE 37 | warn=-1-ignore|0-default|1-as_occur|2-as_error 38 | warnPartialMatchArgs=TRUE 39 | warnPartialMatchAttr=TRUE 40 | warnPartialMatchDollar=TRUE 41 | warning.expression="func" 42 | warnings.length=100...8170 43 | width=10...10000 44 | - 45 | device="x11|quartz|postscript|pdf" 46 | locatorBell=TRUE 47 | par.ask.default=TRUE 48 | X11colortype="true" 49 | X11fonts=c("", "") 50 | gamma=1 51 | - 52 | contrasts=c("unordered", "ordered") 53 | na.action="func" 54 | show.coef.Pvalues=TRUE. 55 | show.signif.stars=TRUE 56 | ts.eps=1e-05 57 | ts.S.compat=TRUE 58 | - 59 | browser="Safari" 60 | de.cellwidth=|0|negative|NA 61 | editor="mate -w" 62 | example.ask=TRUE 63 | help.try.all.packages=TRUE 64 | HTTPUserAgent="NULL" 65 | internet.info=2|1|0 66 | menu.graphics=FALSE 67 | pkgType="source|mac.binary" 68 | repos=c(CRAN="@CRAN@") 69 | SweaveHooks="" 70 | SweaveSyntax="" 71 | unzip="internal|PATH" 72 | - 73 | dvipscmd="command" 74 | latexcmd="command" 75 | pdfviewer="" -------------------------------------------------------------------------------- /Support/lib/command_args/par: -------------------------------------------------------------------------------- 1 | adj=0-left|0.5-center|1-right 2 | ann=FALSE 3 | ask=TRUE 4 | bg="" 5 | bty="o|l|7|c|u|n|]" 6 | cex=1 7 | cex.axis=1 8 | cex.lab=1 9 | cex.main=1 10 | cex.sub=1 11 | col="red" 12 | col.axis="red" 13 | col.lab="red" 14 | col.main="red" 15 | col.sub="red" 16 | crt=0 17 | family="" 18 | fg="red" 19 | fig=c(1, 1, 1, 1) 20 | fin=c(width, height) 21 | font=1-plain|2-bold|3-italics|4-bolditalics 22 | font.axis=1-plain|2-bold|3-italics|4-bolditalics 23 | font.lab=1-plain|2-bold|3-italics|4-bolditalics 24 | font.main=1-plain|2-bold|3-italics|4-bolditalics 25 | font.sub=1-plain|2-bold|3-italics|4-bolditalics 26 | gamma=1 27 | lab=c(x, y, len) 28 | las=0-parallel|1-horizontal|2-perpendicular|3-vertical 29 | lend=0-round|1-butt|2-square 30 | lheight=1 31 | ljoin=0-round|1-mitre|2-bevel 32 | lmitre=10 33 | lty=0-blank|1-solid|2-dashed|3-dotted|4-dotdash|5-longdash|6-twodash 34 | lwd=1 35 | mai=c(bottom, left, top, right) 36 | mar=c(bottom, left, top, right) 37 | mex=1 38 | mfcol=c(nr, nc) 39 | mfg=c(i, j) 40 | mfrow=c(nr, nc) 41 | mgp=c(3, 1, 0) 42 | new=TRUE 43 | oma=c(bottom, left, top, right) 44 | omd=c(x1, x2, y1, y2) 45 | omi=c(bottom, left, top, right) 46 | pch="19-solidCircle|20-bullet|21-circle|22-square|23-diamond|24-triangleUp|25-triangleDown" 47 | pin=c(width, height) 48 | plt=c(x1, x2, y1, y2) 49 | ps=10 50 | pty="s|m" 51 | srt=0 52 | tck=1 53 | tcl=-0.5 54 | usr=c(x1, x2, y1, y2) 55 | xaxp=c(x1, x2, 1|2|3) 56 | xaxs="r|i|e|s|d" 57 | xaxt="n|s|l|t" 58 | xlog=TRUE 59 | xpd=TRUE|FALSE|NA 60 | yaxp=c(x1, x2, 1|2|3) 61 | yaxs="r|i|e|s|d" 62 | yaxt="n|s|l|t" 63 | ylog=TRUE -------------------------------------------------------------------------------- /Support/lib/command_args/plot: -------------------------------------------------------------------------------- 1 | asp="y/x aspect ratio" 2 | log="x|y|xy|yx" 3 | main="title" 4 | sub="subtitle" 5 | type="p|l|b|c|o|h|s|S|n" 6 | xlab="x-title" 7 | xlog=TRUE 8 | ylab="y-title" 9 | ylog=TRUE 10 | -------------------------------------------------------------------------------- /Support/lib/command_args/points: -------------------------------------------------------------------------------- 1 | type="p|l|b|c|o|h|s|S|n" -------------------------------------------------------------------------------- /Support/lib/help.markdown: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | R is a language and environment for statistical computing and graphics. It is a [GNU project](http://www.gnu.org/) which is similar to the S language and environment which was developed at Bell Laboratories (formerly AT&T, now Lucent Technologies) by John Chambers and colleagues. R can be considered as a different implementation of S. There are some important differences, but much code written for S runs unaltered under R. 4 | 5 | R provides a wide variety of statistical (linear and non-linear modeling, classical statistical tests, time-series analysis, classification, clustering, ...) and graphical techniques, and is highly extensible. The S language is often the vehicle of choice for research in statistical methodology, and R provides an Open Source route to participation in that activity. 6 | 7 | (Text taken from [What is R?](http://www.r-project.org/about.html)) 8 | 9 | More information about R can be found at [r-project.org](http://www.r-project.org/). 10 | 11 | ⇢ This bundle requires a R version >= R 3.2 12 | 13 | # Commands 14 | 15 | ## Run Selection/Document In R 16 | 17 | It executes the current document or selection (if the selection only contains out-commented R code the current document) in a self-sufficient environment of the command-line version of R and it displays the output in an HTML window. By default new plots use the "pdf" device and are placed in a temporary folder and displayed at the end of the HTML window. 18 | 19 | ## Execute Selection/Document In R (Insert/Pasteboard/Tooltip) 20 | 21 | It executes the current document or selection in a self-sufficient environment of the command-line version of R. The output will be inserted, or will be copied into the pasteboard, or will be shown as Tooltip or. 22 | 23 | ## Send Selection/Document to Rdaemon 24 | 25 | It sends the current document or selection line by line to the Rdaemon. If Rdaemon is installed and it is not yet running it will start it, it opens the Rsession project, and the file `~/Library/Application Support/Rdaemon/console.Rcon` will contain the output. 26 | 27 | ***Hint*** To use that command you have to install the Rdaemon Bundle in beforehand. 28 | 29 | ## Send Selection/Document to R.app 30 | 31 | It executes the current document or selection in R.app and switches to R.app's Console. 32 | 33 | ***Hint*** To use that command you have to install R.app in beforehand. 34 | 35 | ## Send Selection/Document to R.app & Step 36 | 37 | It executes the current line or selection in R.app and goes to the end of the next line. TextMate keeps its focus. 38 | 39 | ***Hint*** To use that command you have to install R.app in beforehand. 40 | 41 | ## Completion… 42 | 43 | Based on all installed packages and local function declarations within the current R script it shows an inline menu with completion suggestions for the current word or selection as  function [library]  or as  command …local…  indicating that `function` is defined within the current R script. 44 | 45 | If the “Completion…” command is invoked from a running Rdaemon document the notation  function {library}  indicates that the `library` is not loaded (or `function` is not found as valid function name in a loaded library) whereby the notation  function …library…  indicates that `library` is loaded. 46 | 47 | As default it also displays an inline menu if there is only one suggestion found in order to give you an hint about the required library. You can force TextMate to complete it without displaying that menu by setting the TextMate shell variable `TM_R_AUTOCOMPLETE` to `1`. 48 | 49 | ***Hint*** This command works case-sensitively. E.g. if you type `math` (without selection and there is no command beginning with `math`) and invoke this command it lists all case-insensitive matched commands like `Math.fraction`, etc. as a tooltip caused by the chosen "Insert as Snippet" mechanism. 50 | 51 | ## Show R Help for actual Word/Selection 52 | 53 | It shows an HTML document with the found R help for the current word or of that command in which the caret is located. If no help file is found it opens an HTML window with all found keywords beginning with the current word. Furthermore this help window offers a `Search for` field to enter a new search term (a regular expression). The check box `Begins with` adds a `^` at the beginning of the search term. The search makes usage of the R command `help.search(TERM)`. 54 | 55 | ***Hint*** The search function `help.search` allows to look for the entered term case-sensitively by using the regular expression flag `(?-i)` e.g. to look exactly for `T` type `“(?-i)^T$”` whereby ^ means look only from the beginning of an help entry and $ means to look until the end of an help entry. 56 | 57 | ## Show Function Usage 58 | 59 | Based on all installed packages and local function declarations it shows a tooltip with the function signature for the current word — or that command in which the caret is located in respect of nested parentheses — or of the selection. 60 | 61 | ## Show Function Usage + Insert “(” 62 | 63 | Based on all installed packages and local function declarations it shows a tooltip with the function signature for the current word and it inserts “()” or “(”. 64 | 65 | ***Hint*** This command will run in a background task to avoid waiting for unknown commands or if lots of packages are installed. This functionality can be switched off by deactivating the bound key equivalent within in the Bundle Editor. 66 | 67 | ## Function Parameter… 68 | 69 | It shows an inline menu with all available parameters and inserts a snippet with the chosen one(s). This command also tries to figure out whether it is necessary to insert a comma “, ”. If the inserted comma “, ” is set falsely one can press twice to highlight it. 70 | 71 | ***Hint*** It is possible to write its own parameter list for given functions. These lists have to be saved in `~/Library/Application Support/TextMate/R/lib/command_args` and the file name represents exactly the function name. Invoke simply the command `“R” → “Documentation” → “Edit user-defined Function Parameter”` to edit those parameter lists. 72 | 73 | See here an example for `$TM_BUNDLE_SUPPORT/lib/command_args/plot`: 74 | 75 | 86 | 87 | ## “par()” Parameters… 88 | 89 | It shows an inline menu with all parameters defined in `$TM_BUNDLE_SUPPORT/lib/command_args/par` and inserts a snippet with the chosen one(s). This command also tries to figure out whether it is necessary to insert a comma “, ”. If the inserted comma “, ” is set falsely one can press twice to highlight it. 90 | 91 | ## “require(xxx)” for current Function 92 | 93 | It looks for that package in which the current keyword — "()" will be recognized — is defined, and it inserts the R code to load that package `require(PACKAGE)` above the current line. 94 | 95 | ## Prefix Package Name to current Function 96 | 97 | It prefixes the current function with the found package name. Useful e.g. if a function occurs in more than one loaded package. 98 | 99 | ## Package Name… 100 | 101 | It shows all installed packages as an inline menu. 102 | 103 | ## Option List as Pull Down… / BoolToggler 104 | 105 | This is an auxiliary tool command with these two different tasks based on a selection: 106 | 107 | * It negates the logical value if the selection is "FALSE" or "TRUE" and "F" or "T" resp. 108 | * It shows an inline menu of all values which are selected and delimited by "|" and replaces the selection by the chosen one. 109 | 110 | For instance this is useful after inserting the parameter `method` of the R function `dist`.
The selected value is:
111 |    `euclidean|maximum|manhattan|canberra|binary|minkowski` 112 | 113 | or if the selected value (like for `par`, parameter `font.lab`) is:
114 |    `1-plain|2-bold|3-italics|4-bolditalics` 115 | 116 | it only inserts the according digits. 117 | 118 | ## Create Vector/Matrix from Selection 119 | 120 | It inserts a vector in the form of `x <- c(x1, x2, ...)` resp. `x <- matrix(c(x1, x2, ...))` as snippet taken from a selected string or the current content of the clipboard. Delimiters are " ", "↩", or "⇥". If an element doesn't consist of digits the element will be enclosed by double-quotes. It won't be checked for creating a matrix whether the length of the vector is a sub-multiple of the numbers of rows. 121 | 122 | ## Show File Header 123 | If one only selects a file path this command shows you the first three lines of that file as tooltip. Useful for the import of data files to determine the its structure or whether the data file has an header or not etc. 124 | 125 | ## Next/Previous List Element/Parameter Value 126 | 127 | It tries to highlight the next/previous element (if quoted only the content) of a list/vector or the value of function parameters. 128 | 129 | ## Tidy (removes all comments!) 130 | 131 | It tidies the selection or the entire document by deparsing them on-the-fly using the command-line version of R. General syntax errors will be displayed as tooltip and the caret will be moved to the first error. 132 |

133 | Attention: All comments will be deleted! 134 |


135 | ***Hint*** This command can also be used as a kind of `Syntax Checker`. It only checks the R code for general syntax error like missing brackets, or commas, etc. It does **not** check for semantic errors like if a variable was assigned correctly or not. 136 | 137 | ## Function Call 138 | 139 | It inserts:    sum(SELECTION/WORD) as snippet. The default function can be set via the shell variable `TM_R_WRAP_DEFAULT_FUNCTION`. 140 | 141 | ## Function Definition 142 | 143 | It inserts:
	x <- function(var) {
144 | 		SELECTION/WORD
145 | 	}
146 | 
as snippet. 147 | 148 | ## Drag&Drop Facilities 149 | - __load (*.Rdata)__ 150 | 151 | If a `*.Rdata` or `*.Rda` file is drag&dropped to a R/R console document it inserts: 152 | 153 | `load(FILE)`. 154 | 155 | By pressing SHIFT while dragging it inserts the absolute file path. 156 | 157 | - __source (*.R)__ 158 | 159 | If a `*.R` file is drag&dropped to a R/R console document it inserts: 160 | 161 | source(FILE, chdir = TRUE). 162 | 163 | By pressing SHIFT while dragging it inserts the absolute file path. 164 | 165 | - __read.csv (*.csv)__ 166 | 167 | If a `*.csv` file is drag&dropped to a R/R console document it inserts: 168 | 169 | read.csv(file = FILE, header = TRUE, stringsAsFactors = FALSE). 170 | 171 | By pressing SHIFT while dragging it inserts the absolute file path. 172 | 173 | - __read.table (*.tab)__ 174 | 175 | If a `*.tab` file is drag&dropped to a R/R console document it inserts: 176 | 177 | read.table(file = FILE, sep = \t, header = TRUE, stringsAsFactors = FALSE). 178 | 179 | By pressing SHIFT while dragging it inserts the absolute file path. 180 | 181 | # TextMate Shell Variables 182 | 183 | ## TM_R_AUTOCOMPLETE 184 | 185 | As default TextMate displays an inline menu if there is only one suggestion found in order to give you an hint for the required library. You can force TextMate to complete it without displaying that menu by setting the shell variable `TM_R_AUTOCOMPLETE` to `1`. See also [Completion…](#sect_2.5). 186 | 187 | ## TM_R_WRAP_DEFAULT_FUNCTION 188 | 189 | Set the default function for “Wrap Selection → Function Call” ^⇧W. If unset `sum` will be taken. 190 | 191 | ## TM_R_SHOW_ALWAYS_HELPSEARCH 192 | 193 | As default `Show R Help for actual Word` opens a single window without a search field if the actual word matches one keyword. To avoid this set that shell variable to “1”. 194 | 195 | ## TM_REXEC 196 | 197 | If not set a R session will be invoked by R --vanilla --slave --encoding=UTF-8 otherwise, if set e.g. to "R32", a R session will be invoked by R32 --vanilla --slave --encoding=UTF-8 in order to be able to start R explicitly in 64 ("R64") or 32 ("R32") bit mode. In addition it also allows to add more command line arguments like "R32 --verbose" will execute R32 --verbose --vanilla --slave --encoding=UTF-8. 198 | 199 | ## TM_RMATE_OUTPUT_FONT 200 | 201 | Set the font of Rmate's output window. Default is set to “Monaco”. 202 | 203 | ## TM_RMATE_OUTPUT_FONTSIZE 204 | 205 | Set the font size of Rmate's output window. Default is set to “10”. 206 | 207 | ## TM_RMATE_ENABLE_LINECOUNTER 208 | 209 | For debugging large R scripts it could be useful to have the chance to use the outputted leading prompt > as hyperlink to jump into the corresponding line of the R script. For that purpose you can set this shell variable to “1”. Please note that by enabling it the script **may not** contain multi-line string declarations, otherwise the string variables will be erroneous (these strings contain the internal string marker #§*). 210 | 211 | # Troubleshooting & FAQ 212 | 213 | - __`'re-encoding is not available on this system'` or `'object ".PSenv" not found'`__ 214 | 215 | If you see one of these messages then you are most likely using an older version of R. In this case you should upgrade to the latest (currently, version 2.6.1) by downloading the pre-built universal R.app installer from r-project.org. 216 | 217 | - __`115:116: syntax error: Expected end of line, etc. but found “. (-2741)`__ 218 | 219 | If you see such an error (or similar) while sending something to "R.app" it is very likely that you are also running the "Rdaemon" with loaded "CarbonEL". Unfortunately "CarbonEL" uses the same application name "R", thus the AppleScript will send the R code to it, not to "R.app". In such a case you have to quit the Rdaemon. 220 | 221 | - __.../R.tmbundle/Support/lib/popen3.rb:18: warning: Insecure world writable dir "DIR" in PATH, mode 040777__ 222 | 223 | If Rmate is outputting this warning message it is very likely that "DIR" has write permissions set to **group** and **others**. To change the permission for that "DIR" run this command from a Terminal window: 224 | 225 | `chmod og-w 'DIR'` 226 | 227 | - __`Text strings defined as multi-line declarations inside a R script contain " #§*"`__ 228 | 229 | Please disable TextMate's shell variable TM_RMATE_ENABLE_LINECOUNTER. 230 | 231 | # The bundle "R Console (Rdaemon)" 232 | 233 | In addition there is the bundle "R Console (Rdaemon)" available. This bundle allows to run the command-line version of R ***inside*** TextMate. A normal document window, which is set to the language "R Console (Rdaemon)", serves as R console. More details within this bundle. 234 | 235 | # The bundle "R Console (R.app)" 236 | 237 | In addition there is the bundle "R Console (R.app)" available. This bundle allows to remote the Mac OSX GUI "R.app". More details within this bundle. 238 | 239 | # Main Bundle Maintainer 240 | 241 | ***Date: May 14 2015*** 242 | 243 |
244 | -  Hans-Jörg Bibiko  bibiko@eva.mpg.de
245 | -  Charilaos Skiadas cskiadas@gmail.com
246 | 
247 | 248 | ## Credits 249 | 250 | Many thanks to 251 |
252 | - John Purnell
253 | - Balthasar Bickel
254 | - Jon Claydon
255 | - Berend Hasselman
256 | 
257 | 258 | for all the valuable suggestions and the exhausting tests. 259 | -------------------------------------------------------------------------------- /Support/lib/historyList.rb: -------------------------------------------------------------------------------- 1 | def extract_command(string) 2 | return "" if string.nil? 3 | return string.gsub(/^>\s*|\s*\z/,"") 4 | end 5 | class HistoryList 6 | attr_reader :list, :last_line, :text 7 | def initialize(text) 8 | @text = text.split("\n") 9 | @last_line = @text.pop 10 | @list = @text.grep(/^>(.*)$/).map{|m| extract_command(m)}.grep(/./) 11 | @list = @list.reverse.uniq.reverse 12 | end 13 | def next_item(command) 14 | cmd = extract_command(command) 15 | return @list[0] if cmd.empty? 16 | if i=@list.index(cmd) and i<=@list.length then 17 | return @list[i+1] 18 | end 19 | return nil 20 | end 21 | def previous_item(command) 22 | cmd = extract_command(command) 23 | return @list.last if cmd.empty? 24 | if i=@list.index(cmd) and i>=1 then 25 | return @list[i-1] 26 | end 27 | return nil 28 | end 29 | def text 30 | @text.join("\n") + "\n" 31 | end 32 | def add_line(line) 33 | self.text + "> #{extract_command(line)}" 34 | end 35 | def move_up 36 | add_line(previous_item(@last_line)) 37 | end 38 | def move_down 39 | add_line(next_item(@last_line)) 40 | end 41 | def self.move_up(text) 42 | self.new(text).move_up 43 | end 44 | def self.move_down(text) 45 | self.new(text).move_down 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /Support/lib/parsing.rb: -------------------------------------------------------------------------------- 1 | require ENV['TM_SUPPORT_PATH'] + "/lib/escape.rb" 2 | class Lexer 3 | Token = Struct.new(:name, :pattern) 4 | 5 | def initialize 6 | @tokens = Array.new 7 | end 8 | 9 | def add_token(*args) 10 | @tokens << Token.new(*args) 11 | end 12 | 13 | def lex(data) 14 | copy, result = data.dup, Array.new 15 | until copy.empty? 16 | @tokens.find { |t| 17 | copy.sub!(t.pattern, "") && (t.name.nil? || result << [t.name, $&]) 18 | } || raise(ArgumentError, "Malformed data could not be lexed correctly: #{data.inspect}. Copy is: #{copy.inspect.inspect}. Parsed is: #{result.inspect}") 19 | end 20 | result 21 | end 22 | end 23 | class CommandParser 24 | def self.snippet(str) 25 | self.parse(self.lex(str)) 26 | end 27 | def self.lex(str) 28 | lexer = Lexer.new 29 | [ [ :fun_begin, /\A(?:\w|\.)*\(/ ], 30 | [ :assignment, /\A[\w.]+\s*=?|==|~|%|;)\s*/ ], 38 | [ :number, /\A\d+(\.\d+)?/ ], 39 | [ :brace_begin, /\A\{/ ], 40 | [ :brace_end, /\A\}/ ], 41 | [ :bracket_begin, /\A\[/ ], 42 | [ :bracket_end, /\A\]/ ], 43 | [ :list_separator, /\A:/ ], 44 | [ nil, /\A\s+/ ] ].each do |name, regex| 45 | lexer.add_token(name, regex) 46 | end 47 | lexer.lex(str) 48 | end 49 | def self.parse(data) 50 | snippet = "" 51 | snippet_counter = -1 52 | stack = [] 53 | until data.empty? 54 | type,match = data.shift 55 | if !stack.empty? && stack.last == :assignment && type.to_s =~ /comma|end$/ then 56 | snippet << "}" 57 | stack.pop 58 | end 59 | case type 60 | when :fun_begin, :brace_begin, :bracket_begin 61 | stack << :group 62 | snippet << "${#{snippet_counter+=1}:#{e_sn match}${#{snippet_counter+=1}:" 63 | when :assignment 64 | stack << :assignment 65 | snippet << "#{e_sn match}${#{snippet_counter+=1}:" 66 | when :comma 67 | snippet << ("}${#{snippet_counter+=1}:" + e_sn(match)) 68 | when :brace_end, :bracket_end, :fun_end 69 | snippet << "}#{e_sn match}}" 70 | stack.pop 71 | when :quoted 72 | snippet << "${#{snippet_counter+=1}:#{match[0..0]}${#{snippet_counter+=1}:#{e_sn match[1..-2].gsub("}","\\}")}}#{match[-1..-1]}}" 73 | else 74 | snippet << e_sn(match) 75 | end 76 | end 77 | (pp stack;raise "Too many levels: #{snippet}. ") unless stack.length == 0 78 | snippet[4..-2] 79 | end 80 | end 81 | # This is for testing 82 | # require 'pp' 83 | # data=DATA.read.split("\n") 84 | # 5.times do 85 | # d = data[rand(2834)] 86 | # # i=0 87 | # # data.each do |d| 88 | # pp [d,CommandParser.snippet(d)] 89 | # # puts "Checking command no: #{i+=1}" 90 | # end -------------------------------------------------------------------------------- /Support/lib/popen3.rb: -------------------------------------------------------------------------------- 1 | # Open a sub-process and return 3 IO objects: stdin, stdout, stderr 2 | # Unlike Open3::popen3, it produces a child, not a grandchild 3 | def popen3(*args) 4 | stdin, stdout, stderr = [IO.pipe, IO.pipe, IO.pipe] 5 | fork do 6 | stdin[1].close 7 | STDIN.reopen(stdin[0]) 8 | stdin[0].close 9 | 10 | stdout[0].close 11 | STDOUT.reopen(stdout[1]) 12 | stdout[1].close 13 | 14 | stderr[0].close 15 | STDERR.reopen(stderr[1]) 16 | stderr[1].close 17 | 18 | exec(*args) 19 | end 20 | stdin[0].close 21 | stdout[1].close 22 | stderr[1].close 23 | [stdin[1], stdout[0], stderr[0]] 24 | end 25 | -------------------------------------------------------------------------------- /Support/pastel.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Blatantly copied from Ruby. Will need to find some uniform system. 4 | Charilaos Skiadas. 05-03-2006 5 | 6 | Stylesheet kindly borrowed from the PyMate command. Eventually I will coordinate something 7 | with the author, so we don't have several identical files around. 8 | By Sune Foldager. 9 | Version 1, 12-08-2005. 10 | 11 | */ 12 | 13 | body 14 | { 15 | font-family: "Lucida Grande"; 16 | font-size: FONTSIZEPLACEHOLDER; 17 | background-color: rgb(170, 200, 255); 18 | margin: 0; 19 | /* height: 100%; */ 20 | } 21 | 22 | p 23 | { 24 | margin: 0; 25 | padding: 2px 0 2px 0; 26 | } 27 | 28 | p#version 29 | { 30 | font-size: 10pt; 31 | font-weight: bold; 32 | color: #005C3E; 33 | } 34 | 35 | div.framed 36 | { 37 | border-style: dotted; 38 | border-width: 1px 0; 39 | border-color: #666; 40 | margin: 10px 0; 41 | padding: 10px 42 | } 43 | 44 | div#script_output 45 | { 46 | background-color: rgb(230, 240, 255); 47 | } 48 | 49 | pre 50 | { 51 | padding: 0; 52 | margin: 0; 53 | line-height: 1.5; 54 | font-family: FONTPLACEHOLDER; 55 | font-size: FONTSIZEPLACEHOLDER; 56 | } 57 | 58 | pre strong 59 | { 60 | /* used for messages */ 61 | font-weight: normal; 62 | color: #0000CC; 63 | } 64 | 65 | pre strong i 66 | { 67 | /* used for messages */ 68 | font-weight: normal; 69 | color: #AAAAAA; 70 | } 71 | 72 | pre em 73 | { 74 | /* used for stderr */ 75 | font-style: normal; 76 | color: #FF5600; 77 | } 78 | 79 | div#exception_report 80 | { 81 | background-color: rgb(210, 220, 255); 82 | } 83 | 84 | p#exception strong 85 | { 86 | color: #FF5600; 87 | } 88 | 89 | p#traceback 90 | { 91 | font-size: FONTSIZEPLACEHOLDER; 92 | } 93 | 94 | table 95 | { 96 | margin: 0; 97 | padding: 0; 98 | } 99 | 100 | td 101 | { 102 | margin: 0; 103 | padding: 2px 2px 2px 5px; 104 | font-size: FONTSIZEPLACEHOLDER; 105 | } 106 | 107 | a 108 | { 109 | color: #FF5600; 110 | } 111 | 112 | .hidden 113 | { 114 | display: none; 115 | } 116 | 117 | .prompt 118 | { 119 | color: darkcyan; 120 | text-decoration: none; 121 | } -------------------------------------------------------------------------------- /Support/tests/historytestFile.Rconsole: -------------------------------------------------------------------------------- 1 | > first command 2 | > second command 3 | > 4 | > 5 | not an item 6 | > first command 7 | > third command 8 | > -------------------------------------------------------------------------------- /Support/tests/testHistoryList.rb: -------------------------------------------------------------------------------- 1 | require 'test/unit' 2 | require '../lib/historyList.rb' 3 | class TestHistoryList < Test::Unit::TestCase 4 | def setup 5 | @sample = File.read("historyTestFile.Rconsole") 6 | test_init 7 | end 8 | def test_init 9 | assert_nothing_raised() { @list = HistoryList.new(@sample) } 10 | assert_not_nil(@list) 11 | assert_not_nil(@list.list) 12 | assert_not_nil(@list.last_line) 13 | assert_equal(@sample, @list.text + "> ") 14 | end 15 | def test_uniqueness 16 | assert_equal(3, @list.list.length) 17 | assert_equal(["second command","first command","third command"],@list.list) 18 | end 19 | def test_last_line 20 | assert_equal("> ",@list.last_line) 21 | end 22 | def test_add_line 23 | assert_equal(@sample + "hey", @list.add_line("> hey")) 24 | end 25 | def test_next_item 26 | assert_equal("first command", @list.next_item("second command")) 27 | assert_equal("first command", @list.next_item(">second command")) 28 | assert_equal("third command", @list.next_item("first command")) 29 | assert_equal("third command", @list.next_item("> first command")) 30 | assert_equal(nil, @list.next_item("third command")) 31 | assert_equal("second command", @list.next_item(" ")) 32 | assert_equal("second command", @list.next_item("> ")) 33 | assert_equal("second command", @list.next_item("")) 34 | assert_equal("second command", @list.next_item(nil)) 35 | end 36 | def test_previous_item 37 | assert_equal("second command", @list.previous_item("first command")) 38 | assert_equal("second command", @list.previous_item(">first command")) 39 | assert_equal("first command", @list.previous_item("third command")) 40 | assert_equal("first command", @list.previous_item("> third command")) 41 | assert_equal(nil, @list.previous_item("second command")) 42 | assert_equal("third command", @list.previous_item(" ")) 43 | assert_equal("third command", @list.previous_item("> ")) 44 | assert_equal("third command", @list.previous_item("")) 45 | assert_equal("third command", @list.previous_item(nil)) 46 | end 47 | def test_move_commands 48 | assert_equal(@sample + "second command", @list.move_down) 49 | assert_equal(@sample + "third command",@list.move_up) 50 | assert_equal(@sample,HistoryList.move_down(@list.move_up)) 51 | end 52 | end -------------------------------------------------------------------------------- /Support/tmR.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby18 2 | # 3 | # RMate v0.95, 2012-03-07. 4 | # Copied, by Charilaos Skiadas, from RubyMate by Sune Foldager. 5 | # v0.1 (2005-08-12): Initial version. 6 | # v0.9 Heavily modified by Kevin Ballard 7 | # v0.95 Heavily modified by by Hans-Jörg Bibiko 8 | 9 | require 'cgi' 10 | require 'fcntl' 11 | SUPPORT_LIB = ENV['TM_SUPPORT_PATH'] + '/lib/' 12 | 13 | cran = ARGV[0] 14 | isSelection = (ARGV[1] == "1") ? true : false 15 | 16 | # JavaScript to hide the start message on runtime 17 | hideStartMessageJS = %{} 18 | 19 | # line counter for hyperlinking R's prompt signs to jump back to the doc 20 | selectionlinestart = isSelection ? ENV['TM_INPUT_START_LINE'].to_i-1 : 0 21 | linecounter = selectionlinestart 22 | linecountermarker = " #§*" 23 | 24 | # HTML escaping function. 25 | def esc(str) 26 | CGI.escapeHTML(str) 27 | end 28 | 29 | def my_popen3(*cmd) # returns [stdin, stdout, strerr, pid] 30 | pw = IO::pipe # pipe[0] for read, pipe[1] for write 31 | pr = IO::pipe 32 | pe = IO::pipe 33 | 34 | # F_SETOWN = 6, ideally this would be under Fcntl::F_SETOWN 35 | pw[0].fcntl(6, ENV['TM_PID'].to_i) if ENV.has_key? 'TM_PID' 36 | 37 | pid = fork{ 38 | pw[1].close 39 | STDIN.reopen(pw[0]) 40 | pw[0].close 41 | 42 | pr[0].close 43 | STDOUT.reopen(pr[1]) 44 | pr[1].close 45 | 46 | pe[0].close 47 | STDERR.reopen(pe[1]) 48 | pe[1].close 49 | 50 | # maybe there is a way to support this in future ;) 51 | # tm_interactive_input = SUPPORT_LIB + '/tm_interactive_input.dylib' 52 | # if (File.exists? tm_interactive_input) 53 | # dil = ENV['DYLD_INSERT_LIBRARIES'] 54 | # ENV['DYLD_INSERT_LIBRARIES'] = (dil) ? "#{tm_interactive_input}:#{dil}" : tm_interactive_input unless (dil =~ /#{tm_interactive_input}/) 55 | # ENV['DYLD_FORCE_FLAT_NAMESPACE'] = "1" 56 | # ENV['TM_INTERACTIVE_INPUT'] = 'AUTO' 57 | # end 58 | 59 | exec(*cmd) 60 | } 61 | 62 | pw[0].close 63 | pr[1].close 64 | pe[1].close 65 | 66 | pw[1].sync = true 67 | 68 | [pw[1], pr[0], pe[0], pid] 69 | end 70 | 71 | 72 | def recursive_delete(path) 73 | %x{rm -rf #{path}} 74 | end 75 | 76 | # allow the user to define its own output font and size 77 | outputFont = (ENV['TM_RMATE_OUTPUT_FONT'] == nil) ? "Menlo" : ENV['TM_RMATE_OUTPUT_FONT'] 78 | outputFontSize = (ENV['TM_RMATE_OUTPUT_FONTSIZE'] == nil) ? "10pt" : "#{ENV['TM_RMATE_OUTPUT_FONTSIZE']}pt" 79 | 80 | # what comes in 81 | what = (isSelection) ? "document" : "selection" 82 | 83 | # Headers... 84 | print <<-EOS 85 | 86 | 87 | R TextMate Runtime 88 | 97 | 104 | 105 | 106 | 107 |
108 |
RMate. Executing #{what} in R. This may take a while...
109 |
110 | HTML 111 | 112 | tmpDir = File.join(ENV['TMP'] || "/tmp", "TM_R") 113 | recursive_delete(tmpDir) if File.exists?(tmpDir) # remove the temp dir if it's already there 114 | Dir::mkdir(tmpDir) 115 | 116 | if(%x{which #{(ENV['TM_REXEC']==nil) ? 'R' : ENV['TM_REXEC']}}.empty?) 117 | print "Please check TM_REXEC!
" 118 | end 119 | # Mechanism for dynamic reading 120 | stdin, stdout, stderr, pid = my_popen3("#{(ENV['TM_REXEC']==nil) ? 'R' : ENV['TM_REXEC']} --vanilla --slave --encoding=UTF-8 2>&1") 121 | # init the R slave 122 | stdin.puts(%{options(device="pdf")}) 123 | stdin.puts(%{options(repos="#{cran}")}) 124 | stdin.puts(%{formals(pdf)[c("file","onefile","width","height")] <- list("#{tmpDir}/Rplot%03d.pdf", FALSE, 8, 8)}) 125 | stdin.puts(%{if(getRversion()>="2.7") pdf.options(onefile=FALSE)}) 126 | stdin.puts(%{options(pager="/bin/cat")}) 127 | stdin.puts("options(echo=T)") 128 | 129 | # if a doc is too large give R the chance to execute code, otherwise the pipe stalls 130 | Thread.new { 131 | STDIN.each do |line| 132 | if(ENV['TM_RMATE_ENABLE_LINECOUNTER'] == '1') 133 | stdin.puts(line.chomp + "#{linecountermarker}") 134 | else 135 | stdin.puts(line.chomp) 136 | end 137 | end 138 | stdin.close 139 | } 140 | 141 | STDOUT.sync = true 142 | STDERR.sync = false 143 | 144 | descriptors = [stdout, stderr] 145 | descriptors.each do |fd| 146 | fd.fcntl(Fcntl::F_SETFL, Fcntl::F_GETFL | Fcntl::O_NONBLOCK) 147 | end 148 | 149 | until descriptors.empty? 150 | sleep 0.00001 151 | select(descriptors).shift.each do |io| 152 | begin 153 | str = io.readline 154 | rescue 155 | descriptors.delete io 156 | io.close 157 | break 158 | end 159 | if str.nil? or str.empty? 160 | descriptors.delete io 161 | io.close 162 | elsif io == stderr 163 | # just in case 164 | print hideStartMessageJS 165 | print %{#{esc str}} 166 | elsif io == stdout 167 | print hideStartMessageJS 168 | str.each_line do |line| 169 | # line counter for top level source 170 | if line.include?("#{linecountermarker}") 171 | linecounter += 1 172 | line.sub!("#{linecountermarker}", '') 173 | end 174 | # check for a comment sign at the beginning of a line 175 | if m=line.match(/(>|\+)(\s*#.*$)/) 176 | print "#{esc(m[1])}#{esc(m[2]).chomp}
" 177 | # check for a comment within a line - regexp should be improved yet! 178 | elsif m=line.match(/(.*?)(#[^"']*)$/) 179 | print esc(m[1]).gsub(/^(>|\+)/,'\1') 180 | print "#{esc(m[2]).chomp}
" 181 | # check for error messages 182 | elsif m=line.match(/(?i)^\s*(error|erreur|fehler|errore|erro)( |:)/) 183 | where = (isSelection) ? " of selection" : "" 184 | print "#{esc str.gsub(%r{(?m).*?#{m[1]}},m[1]).chomp}
RMate stopped at line #{linecounter-selectionlinestart}#{where}

".gsub(%r{source\("(.*?)"\)},'source("\1")') 185 | print "
" 186 | break 187 | # check for warnings 188 | elsif line.match(/^\s*(Warning|Warning messages?|Message d.avis|Warnmeldung|Messaggio di avvertimento|Mensagem de aviso):/) 189 | print "#{esc line}" 190 | # regular console output 191 | elsif line.match(/^[^>+].*$/) 192 | print "#{esc line}" 193 | # print line simply with hyperlinked prompt if given 194 | elsif line.match(/_\x8./) 195 | print "#{line.gsub(/_\x8(.)/,'\1')}" 196 | else 197 | print esc(line).gsub(/^[\x0-\x9]?(>|\+)/,'\1') 198 | end 199 | end 200 | end 201 | end 202 | end 203 | 204 | STDOUT.flush 205 | 206 | # check for generated plots; if yes, embed them into the HTML output as PDF images 207 | if !Dir::glob("#{tmpDir}/*.pdf").empty? 208 | width = (Dir::glob("#{tmpDir}/*.pdf").size > 1) ? "50%" : "100%" 209 | puts "
Click at image to open it.
" 210 | counter = 0 211 | Dir::glob("#{tmpDir}/*.pdf") { |f| 212 | counter += 1 213 | rndn = Time.now.to_i # random number needed to enforce reloading of cached images 214 | print "
" 215 | print "" 216 | print "
" 217 | print "
" if (counter % 2 == 0) 218 | } 219 | puts "
   
" 220 | end 221 | 222 | puts '
' 223 | 224 | # Footer. 225 | print <<-HTML 226 | 227 | 228 | HTML 229 | -------------------------------------------------------------------------------- /Syntaxes/R.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | R 8 | r 9 | s 10 | S 11 | Rprofile 12 | 13 | keyEquivalent 14 | ^~R 15 | name 16 | R 17 | patterns 18 | 19 | 20 | captures 21 | 22 | 1 23 | 24 | name 25 | comment.line.pragma.r 26 | 27 | 2 28 | 29 | name 30 | entity.name.pragma.name.r 31 | 32 | 33 | match 34 | ^(#pragma[ \t]+mark)[ \t](.*) 35 | name 36 | comment.line.pragma-mark.r 37 | 38 | 39 | begin 40 | (^[ \t]+)?(?=#) 41 | beginCaptures 42 | 43 | 1 44 | 45 | name 46 | punctuation.whitespace.comment.leading.r 47 | 48 | 49 | end 50 | (?!\G) 51 | patterns 52 | 53 | 54 | begin 55 | # 56 | beginCaptures 57 | 58 | 0 59 | 60 | name 61 | punctuation.definition.comment.r 62 | 63 | 64 | end 65 | \n 66 | name 67 | comment.line.number-sign.r 68 | 69 | 70 | 71 | 72 | match 73 | \b(logical|numeric|character|complex|matrix|array|data\.frame|list|factor)(?=\s*\() 74 | name 75 | storage.type.r 76 | 77 | 78 | match 79 | \b(function|if|break|next|repeat|else|for|return|switch|while|in|invisible)\b 80 | name 81 | keyword.control.r 82 | 83 | 84 | match 85 | \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(i|L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b 86 | name 87 | constant.numeric.r 88 | 89 | 90 | match 91 | \b(T|F|TRUE|FALSE|NULL|NA|Inf|NaN)\b 92 | name 93 | constant.language.r 94 | 95 | 96 | match 97 | \b(pi|letters|LETTERS|month\.abb|month\.name)\b 98 | name 99 | support.constant.misc.r 100 | 101 | 102 | match 103 | (\-|\+|\*|\/|%\/%|%%|%\*%|%in%|%o%|%x%|\^) 104 | name 105 | keyword.operator.arithmetic.r 106 | 107 | 108 | match 109 | (=|<-|<<-|->|->>) 110 | name 111 | keyword.operator.assignment.r 112 | 113 | 114 | match 115 | (==|!=|<>|<|>|<=|>=) 116 | name 117 | keyword.operator.comparison.r 118 | 119 | 120 | match 121 | (!|&{1,2}|[|]{1,2}) 122 | name 123 | keyword.operator.logical.r 124 | 125 | 126 | match 127 | (\.\.\.|\$|@|:|\~) 128 | name 129 | keyword.other.r 130 | 131 | 132 | begin 133 | " 134 | beginCaptures 135 | 136 | 0 137 | 138 | name 139 | punctuation.definition.string.begin.r 140 | 141 | 142 | end 143 | " 144 | endCaptures 145 | 146 | 0 147 | 148 | name 149 | punctuation.definition.string.end.r 150 | 151 | 152 | name 153 | string.quoted.double.r 154 | patterns 155 | 156 | 157 | match 158 | \\. 159 | name 160 | constant.character.escape.r 161 | 162 | 163 | 164 | 165 | begin 166 | ' 167 | beginCaptures 168 | 169 | 0 170 | 171 | name 172 | punctuation.definition.string.begin.r 173 | 174 | 175 | end 176 | ' 177 | endCaptures 178 | 179 | 0 180 | 181 | name 182 | punctuation.definition.string.end.r 183 | 184 | 185 | name 186 | string.quoted.single.r 187 | patterns 188 | 189 | 190 | match 191 | \\. 192 | name 193 | constant.character.escape.r 194 | 195 | 196 | 197 | 198 | captures 199 | 200 | 1 201 | 202 | name 203 | entity.name.function.r 204 | 205 | 2 206 | 207 | name 208 | keyword.operator.assignment.r 209 | 210 | 3 211 | 212 | name 213 | keyword.control.r 214 | 215 | 216 | match 217 | ((?:`[^`\\]*(?:\\.[^`\\]*)*`)|(?:[[:alpha:].][[:alnum:]._]*))\s*(<?<-|=(?!=))\s*(function) 218 | name 219 | meta.function.r 220 | 221 | 222 | captures 223 | 224 | 1 225 | 226 | name 227 | entity.name.tag.r 228 | 229 | 4 230 | 231 | name 232 | entity.name.type.r 233 | 234 | 235 | match 236 | (setMethod|setReplaceMethod|setGeneric|setGroupGeneric|setClass)\s*\(\s*([[:alpha:]\d]+\s*=\s*)?("|\x{27})([a-zA-Z._\[\$@][a-zA-Z0-9._\[]*?)\3.* 237 | name 238 | meta.method.declaration.r 239 | 240 | 241 | match 242 | ((?:`[^`\\]*(?:\\.[^`\\]*)*`)|(?:[[:alpha:].][[:alnum:]._]*))\s*\( 243 | 244 | 245 | captures 246 | 247 | 1 248 | 249 | name 250 | variable.parameter.r 251 | 252 | 2 253 | 254 | name 255 | keyword.operator.assignment.r 256 | 257 | 258 | match 259 | ([[:alpha:].][[:alnum:]._]*)\s*(=(?!=)) 260 | 261 | 262 | match 263 | \b([\d_][[:alnum:]._]+)\b 264 | name 265 | invalid.illegal.variable.other.r 266 | 267 | 268 | match 269 | \b([[:alnum:]_]+)(?=::) 270 | name 271 | entity.namespace.r 272 | 273 | 274 | match 275 | ((?:`[^`\\]*(?:\\.[^`\\]*)*`)|(?:[[:alpha:].][[:alnum:]._]*)) 276 | name 277 | variable.other.r 278 | 279 | 280 | begin 281 | \{ 282 | beginCaptures 283 | 284 | 0 285 | 286 | name 287 | punctuation.section.block.begin.r 288 | 289 | 290 | end 291 | \} 292 | endCaptures 293 | 294 | 0 295 | 296 | name 297 | punctuation.section.block.end.r 298 | 299 | 300 | name 301 | meta.block.r 302 | patterns 303 | 304 | 305 | include 306 | source.r 307 | 308 | 309 | 310 | 311 | scopeName 312 | source.r 313 | uuid 314 | B2E6B78D-6E70-11D9-A369-000D93B3A10E 315 | 316 | 317 | -------------------------------------------------------------------------------- /Syntaxes/Rd (R Documentation).tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | rd 8 | Rd 9 | 10 | keyEquivalent 11 | ^~R 12 | name 13 | Rd (R Documentation) 14 | patterns 15 | 16 | 17 | begin 18 | ((\\)(?:alias|docType|keyword|name|title|description|value|note|concept|keyword|details|format|references|source|arguments|seealso|author))(\{) 19 | beginCaptures 20 | 21 | 1 22 | 23 | name 24 | keyword.other.section.rd 25 | 26 | 2 27 | 28 | name 29 | punctuation.definition.function.rd 30 | 31 | 3 32 | 33 | name 34 | punctuation.definition.arguments.begin.rd 35 | 36 | 37 | contentName 38 | entity.name.tag.rd 39 | end 40 | (\}) 41 | endCaptures 42 | 43 | 1 44 | 45 | name 46 | punctuation.definition.arguments.end.rd 47 | 48 | 49 | name 50 | meta.section.rd 51 | patterns 52 | 53 | 54 | include 55 | $self 56 | 57 | 58 | 59 | 60 | begin 61 | ((\\)(?:usage))(\{)(?:\n)? 62 | beginCaptures 63 | 64 | 1 65 | 66 | name 67 | keyword.other.usage.rd 68 | 69 | 2 70 | 71 | name 72 | punctuation.definition.function.rd 73 | 74 | 3 75 | 76 | name 77 | punctuation.definition.arguments.begin.rd 78 | 79 | 80 | contentName 81 | source.r.embedded 82 | end 83 | (\}) 84 | endCaptures 85 | 86 | 1 87 | 88 | name 89 | punctuation.definition.arguments.end.rd 90 | 91 | 92 | name 93 | meta.usage.rd 94 | patterns 95 | 96 | 97 | include 98 | source.r 99 | 100 | 101 | 102 | 103 | begin 104 | ((\\)(?:examples))(\{)(?:\n)? 105 | beginCaptures 106 | 107 | 1 108 | 109 | name 110 | keyword.other.examples.rd 111 | 112 | 2 113 | 114 | name 115 | punctuation.definition.function.rd 116 | 117 | 3 118 | 119 | name 120 | punctuation.definition.arguments.begin.rd 121 | 122 | 123 | contentName 124 | source.r.embedded 125 | end 126 | (^\}$) 127 | endCaptures 128 | 129 | 1 130 | 131 | name 132 | punctuation.definition.arguments.end.rd 133 | 134 | 135 | name 136 | meta.examples.rd 137 | patterns 138 | 139 | 140 | include 141 | source.r 142 | 143 | 144 | 145 | 146 | begin 147 | ((\\)(?:author))(\{)(?:\n)? 148 | beginCaptures 149 | 150 | 1 151 | 152 | name 153 | keyword.other.author.rd 154 | 155 | 2 156 | 157 | name 158 | punctuation.definition.function.rd 159 | 160 | 3 161 | 162 | name 163 | punctuation.definition.arguments.begin.rd 164 | 165 | 166 | end 167 | (\}) 168 | endCaptures 169 | 170 | 1 171 | 172 | name 173 | punctuation.definition.arguments.end.rd 174 | 175 | 176 | name 177 | meta.author.rd 178 | 179 | 180 | include 181 | text.tex.latex 182 | 183 | 184 | scopeName 185 | text.tex.latex.rd 186 | uuid 187 | 80A00288-FE7E-4E66-B5BF-4948A2828203 188 | 189 | 190 | -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | contactEmailRot13 6 | znvy@ovovxb.qr 7 | contactName 8 | Hans-Jörg Bibiko 9 | deleted 10 | 11 | 4BA62013-146D-4FB2-9F41-37C286654831 12 | 8F97C05F-4118-41B9-93E4-5FD28395477C 13 | 613CDD87-1F8B-484E-B741-74B95F3C878B 14 | 2CE460A3-ADAE-47B6-8A89-EE142C714CC2 15 | C1302FC5-FDC8-4560-8DFF-2CEC85EFCD19 16 | F629C7F3-823B-4A4C-8EEE-9971490C5710 17 | 1C8D0B95-3CE9-4081-BD37-A085E0A288E0 18 | B8902A32-4E8C-4A20-ABB5-7563B908A30B 19 | 31784999-64B3-4F63-AF32-1FECA9784AF3 20 | D8F58163-9075-4E6E-A34C-E3766B0484DA 21 | B2E95E6F-6B18-4F9A-988A-0A9DDAE45E66 22 | 99A12100-EC5C-472D-9B6A-41A73D8EEA55 23 | D977E5CA-C8BD-414E-AF8B-98279DF571DC 24 | BB5525B8-6276-412E-9CFB-4187E3C06FF9 25 | AD965C07-D521-42B0-8F21-F5780406E9EC 26 | 11ADAF20-8C9D-4BB0-B37E-DEB0E9620095 27 | 65475CEE-F527-4A32-B3B5-387C73186F8E 28 | 29 | description 30 | <a href="https://www.r-project.org/">R</a> is a free software environment for statistical computing and graphics. This bundle includes a command that sends current line to the R.app environment or to the Rdaemon. 31 | mainMenu 32 | 33 | excludedItems 34 | 35 | 280CC3F2-8A69-446D-89A2-2886D3DF9495 36 | 37 | items 38 | 39 | F5D7F00C-6DEE-469E-AFEE-6E4B7CDD4148 40 | A661B95E-72F5-4A15-893F-82EC8A5CA5EC 41 | 2A3B8527-3670-45E1-9356-DF018F397553 42 | 0D02B91A-F3A7-4C44-849C-185D56DC5713 43 | ------------------------------------ 44 | 8A17F5A3-7E52-4C6D-AA70-99476FB82625 45 | 8E2C627D-A9E7-4D7C-9744-F9CD6639A972 46 | B94585D0-C85F-4BD8-AED1-7A26B65144D2 47 | 49FD111D-386E-4076-AB39-85DB253E98D1 48 | AA14B2D1-7906-4F9B-9A55-956C27D7AD56 49 | 13178AED-9A29-4544-A973-B1C16EF21CE5 50 | 5023269F-9BC5-45A2-A411-E42C429BD970 51 | 3E148105-968D-401E-B0E7-63EE90A364FD 52 | 076C9388-66AC-43C1-B2EC-B456C1749878 53 | A59DA3DA-866C-4A05-9CAF-D986D67B4B33 54 | D782BAF8-D4D7-47FA-9BA1-38222FD26571 55 | B970D389-FD53-46ED-BA8B-6D3F880328F8 56 | ------------------------------------ 57 | D8605B14-1865-4315-B7E0-7CF6E22AB363 58 | ------------------------------------ 59 | 3A526F78-B82D-41BD-9799-CA5F846401DC 60 | ------------------------------------ 61 | 8A8B6803-AF20-47EC-9382-62E1EBA76B4A 62 | 63 | submenus 64 | 65 | 076C9388-66AC-43C1-B2EC-B456C1749878 66 | 67 | items 68 | 69 | C2ADF348-D6FE-45B5-8BCC-A62B912A881B 70 | 2EBC36A2-A927-4AEC-99A1-9F06C88B6844 71 | FA279758-BC29-4BE9-AFD6-045DB6A17711 72 | 63A97132-D522-48D9-937A-6A1F04E45F7D 73 | 69D9877A-4A4C-4DC7-97E5-392B45941A82 74 | 02F9D19E-BE8F-4BAA-99EB-2A304BB873FE 75 | D7A7E674-E2E6-4454-BA78-952A129FB1E2 76 | C7D7C1F9-E2F7-4B09-8C1A-AD66C19E9CB3 77 | ------------------------------------ 78 | 06BD4251-25D5-4BA0-99BC-5D3061E64128 79 | 80 | name 81 | Language Features 82 | 83 | 0D02B91A-F3A7-4C44-849C-185D56DC5713 84 | 85 | items 86 | 87 | ED52D514-DDB8-4D8C-BE0C-F791C70F530A 88 | 89 | name 90 | Send Selection/Line to 91 | 92 | 13178AED-9A29-4544-A973-B1C16EF21CE5 93 | 94 | items 95 | 96 | 5F49FB43-86AA-4352-AECB-CA573E9DC7E8 97 | 481CC207-5003-4AAE-8202-E353889470C9 98 | 99 | name 100 | Data Frame 101 | 102 | 2A3B8527-3670-45E1-9356-DF018F397553 103 | 104 | items 105 | 106 | DC1EC8A4-BC20-4D1C-91B6-328CEC2CA228 107 | 15FF2003-99F5-464C-A0C2-BAFED7AD73EB 108 | 109 | name 110 | Send Selection/Document to 111 | 112 | 3E148105-968D-401E-B0E7-63EE90A364FD 113 | 114 | items 115 | 116 | C70D177F-E5D6-4628-807D-C9EFADECB050 117 | 118 | name 119 | Graphs 120 | 121 | 49FD111D-386E-4076-AB39-85DB253E98D1 122 | 123 | items 124 | 125 | 6BC03260-79E4-47B6-87CE-020BD066E0FB 126 | 6A931F29-5A2B-4CCB-A958-0A0A9A3F2BEF 127 | 90EA3ACF-121E-4BBA-B1EB-3F461BCBDC8D 128 | 129 | name 130 | Commands 131 | 132 | 5023269F-9BC5-45A2-A411-E42C429BD970 133 | 134 | items 135 | 136 | 5A0EA5CD-5767-4D11-AF9A-C4447A8EA4B4 137 | ------------------------------------ 138 | D8F85702-E792-4856-8D16-54E4EB2F9483 139 | 140 | name 141 | Input/Output 142 | 143 | 8E2C627D-A9E7-4D7C-9744-F9CD6639A972 144 | 145 | items 146 | 147 | 3F849C03-8BFC-4A54-B985-09BB453AF679 148 | 797A6B84-49BB-4BBD-8F51-9A225433CA9C 149 | ------------------------------------ 150 | 4DCF1FF7-D104-43C3-B0E3-8333A50CA5AA 151 | B26AF49E-C737-41D4-990F-5BBB138B3FCD 152 | F6F4215A-5543-42B3-8EBD-C8C7C9F190C9 153 | 2A3C3EF9-2043-4304-81EC-EA3309286F98 154 | ------------------------------------ 155 | BED22435-E025-4C52-9CC5-08B4296F524F 156 | ------------------------------------ 157 | 90C73568-B9B1-4D3D-BAC5-5C2999BE39BC 158 | 159 | name 160 | Documentation 161 | 162 | A59DA3DA-866C-4A05-9CAF-D986D67B4B33 163 | 164 | items 165 | 166 | 769AC12C-9EDF-4089-8834-062A301907ED 167 | 4C1A1536-31FF-4FF5-B0C5-CD47D21CFD52 168 | 169 | name 170 | Wrap Selection in 171 | 172 | A661B95E-72F5-4A15-893F-82EC8A5CA5EC 173 | 174 | items 175 | 176 | 99E59A8E-A7DC-4CB0-AA51-6305921D3411 177 | C666D732-9E4D-49C7-BEEC-BC20590414BF 178 | E3EAFF15-1B8D-4E74-8649-2A3CADC0A119 179 | 180 | name 181 | Execute Selection/Document In R and 182 | 183 | AA14B2D1-7906-4F9B-9A55-956C27D7AD56 184 | 185 | items 186 | 187 | F61688AA-C298-4D58-A9DE-87891797B2F9 188 | BC6C2055-67E1-4902-98B0-AACDFEE031BB 189 | ------------------------------------ 190 | 4852C9E0-D22C-4FA2-8C85-628B97F6C3B2 191 | ------------------------------------ 192 | A9D21636-8157-4C3B-967B-B0E24595AA86 193 | 0D80E89D-F95D-4C5E-B174-342B245CD56B 194 | 217EE449-B990-4FDA-A897-F7063022241E 195 | ------------------------------------ 196 | CE3CB75A-3283-4BF0-BDD8-FF8F50F61762 197 | 9BB0E6BD-62E9-4D5A-A1B6-6A5545F58EFD 198 | 93D9F298-A5FF-4935-A906-1C1E31AF451A 199 | 200 | name 201 | Vector/Matrix 202 | 203 | B94585D0-C85F-4BD8-AED1-7A26B65144D2 204 | 205 | items 206 | 207 | E16BBBCF-CDD5-49DB-9626-1125A97C4D89 208 | 38BD6CA7-0916-43BD-88C9-CBFC4ED17FDE 209 | ------------------------------------ 210 | 8D7F64A5-B2C5-4BF1-B7C5-352CF6AAEF28 211 | 7657BD74-1736-49B9-9AB1-4A10E256D484 212 | 18B3BAF5-A2E0-43A6-9017-56E1D365A055 213 | ------------------------------------ 214 | B2612EB0-22A3-4D09-A851-721EA294DF13 215 | 216 | name 217 | Insert 218 | 219 | B970D389-FD53-46ED-BA8B-6D3F880328F8 220 | 221 | items 222 | 223 | AE350C40-DA76-4BDD-AAD0-27F7247511EB 224 | EB595EE3-9439-4AC6-8352-1EC7CAC9B05E 225 | 226 | name 227 | Rd Documentation 228 | 229 | C70D177F-E5D6-4628-807D-C9EFADECB050 230 | 231 | items 232 | 233 | EB449D09-F66E-4C1B-BFAF-B9FA27DB991C 234 | A4E14B93-E8D0-4C8E-AB8E-CCB029E170F0 235 | 236 | name 237 | Add-ons 238 | 239 | D782BAF8-D4D7-47FA-9BA1-38222FD26571 240 | 241 | items 242 | 243 | 381D1464-6F33-41E3-A938-C10FAB619C24 244 | 245 | name 246 | Auxiliaries 247 | 248 | D8605B14-1865-4315-B7E0-7CF6E22AB363 249 | 250 | items 251 | 252 | C28E338D-7E5F-4E3C-9603-70C22912166D 253 | C4BEAEEF-970A-40DC-B511-5C4B2C0AB43E 254 | 255 | name 256 | GoTo 257 | 258 | 259 | 260 | name 261 | R 262 | ordering 263 | 264 | 280CC3F2-8A69-446D-89A2-2886D3DF9495 265 | E16BBBCF-CDD5-49DB-9626-1125A97C4D89 266 | C28E338D-7E5F-4E3C-9603-70C22912166D 267 | C4BEAEEF-970A-40DC-B511-5C4B2C0AB43E 268 | F5D7F00C-6DEE-469E-AFEE-6E4B7CDD4148 269 | E3EAFF15-1B8D-4E74-8649-2A3CADC0A119 270 | C666D732-9E4D-49C7-BEEC-BC20590414BF 271 | 99E59A8E-A7DC-4CB0-AA51-6305921D3411 272 | DC1EC8A4-BC20-4D1C-91B6-328CEC2CA228 273 | 15FF2003-99F5-464C-A0C2-BAFED7AD73EB 274 | ED52D514-DDB8-4D8C-BE0C-F791C70F530A 275 | F61688AA-C298-4D58-A9DE-87891797B2F9 276 | BC6C2055-67E1-4902-98B0-AACDFEE031BB 277 | C2ADF348-D6FE-45B5-8BCC-A62B912A881B 278 | 2EBC36A2-A927-4AEC-99A1-9F06C88B6844 279 | 8D7F64A5-B2C5-4BF1-B7C5-352CF6AAEF28 280 | 7657BD74-1736-49B9-9AB1-4A10E256D484 281 | 3F849C03-8BFC-4A54-B985-09BB453AF679 282 | F6F4215A-5543-42B3-8EBD-C8C7C9F190C9 283 | 2A3C3EF9-2043-4304-81EC-EA3309286F98 284 | 4DCF1FF7-D104-43C3-B0E3-8333A50CA5AA 285 | B26AF49E-C737-41D4-990F-5BBB138B3FCD 286 | 797A6B84-49BB-4BBD-8F51-9A225433CA9C 287 | 18B3BAF5-A2E0-43A6-9017-56E1D365A055 288 | 8A17F5A3-7E52-4C6D-AA70-99476FB82625 289 | 38BD6CA7-0916-43BD-88C9-CBFC4ED17FDE 290 | BED22435-E025-4C52-9CC5-08B4296F524F 291 | B2612EB0-22A3-4D09-A851-721EA294DF13 292 | 3A526F78-B82D-41BD-9799-CA5F846401DC 293 | 6BC03260-79E4-47B6-87CE-020BD066E0FB 294 | 90EA3ACF-121E-4BBA-B1EB-3F461BCBDC8D 295 | 6A931F29-5A2B-4CCB-A958-0A0A9A3F2BEF 296 | 769AC12C-9EDF-4089-8834-062A301907ED 297 | 4C1A1536-31FF-4FF5-B0C5-CD47D21CFD52 298 | 8A8B6803-AF20-47EC-9382-62E1EBA76B4A 299 | 06BD4251-25D5-4BA0-99BC-5D3061E64128 300 | 381D1464-6F33-41E3-A938-C10FAB619C24 301 | AE350C40-DA76-4BDD-AAD0-27F7247511EB 302 | EB595EE3-9439-4AC6-8352-1EC7CAC9B05E 303 | 90C73568-B9B1-4D3D-BAC5-5C2999BE39BC 304 | EB449D09-F66E-4C1B-BFAF-B9FA27DB991C 305 | 5F49FB43-86AA-4352-AECB-CA573E9DC7E8 306 | 9BB0E6BD-62E9-4D5A-A1B6-6A5545F58EFD 307 | 93D9F298-A5FF-4935-A906-1C1E31AF451A 308 | 481CC207-5003-4AAE-8202-E353889470C9 309 | 217EE449-B990-4FDA-A897-F7063022241E 310 | 0D80E89D-F95D-4C5E-B174-342B245CD56B 311 | 02F9D19E-BE8F-4BAA-99EB-2A304BB873FE 312 | CE3CB75A-3283-4BF0-BDD8-FF8F50F61762 313 | 5A0EA5CD-5767-4D11-AF9A-C4447A8EA4B4 314 | A4E14B93-E8D0-4C8E-AB8E-CCB029E170F0 315 | 4852C9E0-D22C-4FA2-8C85-628B97F6C3B2 316 | A9D21636-8157-4C3B-967B-B0E24595AA86 317 | D7A7E674-E2E6-4454-BA78-952A129FB1E2 318 | D8F85702-E792-4856-8D16-54E4EB2F9483 319 | 63A97132-D522-48D9-937A-6A1F04E45F7D 320 | C7D7C1F9-E2F7-4B09-8C1A-AD66C19E9CB3 321 | 69D9877A-4A4C-4DC7-97E5-392B45941A82 322 | FA279758-BC29-4BE9-AFD6-045DB6A17711 323 | B2E6B78D-6E70-11D9-A369-000D93B3A10E 324 | 80A00288-FE7E-4E66-B5BF-4948A2828203 325 | F38E1657-C2D9-48CE-9FFD-3EEA36D8B320 326 | 0AE8C5E0-C202-4965-B877-4CD0B9420A7D 327 | 5DBBC018-D895-4A52-91D4-60196BC76B49 328 | BC3C944A-A0D9-4438-A9CF-C813970DD533 329 | 7AA6473C-4B13-4252-8773-9B08675048FB 330 | FF242DDB-CDE9-4FC0-8AC7-3345E49FBACA 331 | 59C40B86-99F3-4713-9C88-C3AD7CE0C821 332 | 333 | uuid 334 | B29D7850-6E70-11D9-A369-000D93B3A10E 335 | 336 | 337 | --------------------------------------------------------------------------------