About me | pbdR Tech | HPSC | Phyloclustering | R_note |

R_note -- The Exploration of Statistical Software R (統計軟體 R 深度歷險)
About R_note
Reference
MS Windows

Batch jobs
Function
Data/MySQL
Plot
String/Parse

Remark Lines
Classes/S3
S4 Methods
Batch more
Environment

Good Coding
Fast Loop
LAM/MPI/Rmpi
Recursion

PHP Call R
Basic C
R Call Fortran/C
R Call GSL
C Call R API
C Call R Objects
Standalone

Make Packages
C Pointer
Debug




Section: Remark Lines

How do I remark multiple lines of code? The following is a dirty trick. This is not only for remarking code, but also for notations.


Examples:

  1.     
    remark <- function(){       ### This is as "/*" in C.
    
    #  1. Put everything here whatever you want to remark.
    #  2. Name the function "remark" you never ever want to use anywhere
    #     out of this bracket scope.
    #  3. Common mistake: Don't leave this function at the end of other
    #                     functions as returns!! This is a fatal consequence.
    #                     A better habit is to use return().
    
    }                           ### This is as "*/" in C.
    


  2.     
    a <- function(){
      bb <- 1:5
      bb
    }
    
    ### This is not correct, function "remark()" is returned.
    a <- function(){
      bb <- 1:5
      remark <- function(){
        bb
      }
    }
    
    ### This is correct, "bb" is returned.
    a <- function(){
      bb <- 1:5
      remark <- function(){
        bb
      }
      bb
    }
    


[ Go to top ]

Maintained: Wei-Chen Chen
E-Mail: wccsnow @ gmail.com
Last Revised: Dec 12 2016, 09:44 (CST Taipei, Taiwan)
Created: Oct 06 2003
free counters Best Resolution
IE6.0
1280x1024
small font