R/writeCOMMENT.R

Defines functions writeCOMMENT

Documented in writeCOMMENT

writeCOMMENT<-function(temp, space=" ", letspace="", MSUB="0", prefix="", suffix=""  )
  {
    if(missing(space)) space=" "
    if(missing(letspace)) letspace=""
    if(missing(MSUB))  MSUB=NA
    if(missing(prefix))  prefix="" 
    if(missing(suffix))  suffix="" 

########  line comment in R

MYLETTERS = c(LETTERS, letters, as.character(0:9) ,
  "?", "!", ".", "-", "+", "*", "/", "=", ")", "(", "_")

    
    BLETS = list()


    BLETS[[1]]=
      c(paste(sep="", "    ", "#", "    "),
       paste(sep="", "   ", "# #", "   ") ,
        "  #   #  ",
        " ####### ",
        "#       #",
        "#       #",
        "#       #"

        ) 

    BLETS[[2]]=
      c(
        "###### ",
        "#     #",
        "#     #",
        "###### ",
        "#     #",
        "#     #",
        "###### ")



    BLETS[[3]]=
      c(
        "#######",
        "#     #",
        "#      ",
        "#      ",
        "#      ",
        "#     #",
        "#######")

    BLETS[[4]]=
      c(
        "#####  ",
        "#    # ",
        "#     #",
        "#     #",
        "#     #",
        "#    # ",
        "#####  ")


    BLETS[[5]]=
      c(    
        "#######",
        "#      ",
        "#      ",
        "#######",
        "#      ",
        "#      ",
        "#######")


    BLETS[[6]]=
      c(    
        "#######",
        "#      ",
        "#      ",
        "#######",
        "#      ",
        "#      ",
        "#      ")

    BLETS[[7]]=
      c(    
        "######",
        "#     ", 
        "#     ", 
        "#  ###",    
        "#  # #",    
        "#    #",
        "######")

    BLETS[[8]]=
      c(
        
        "#     #",
        "#     #",
        "#     #",
        "#######",
        "#     #",
        "#     #",
        "#     #")


    BLETS[[9]]=
      c(    
        " ##### ",
        "   #   ",
        "   #   ",
        "   #   ",
        "   #   ",
        "   #   ",
        " ##### ")


    BLETS[[10]]=
      c(    
        " #####",
        "   #  ",    
        "   #  ",
        "   #  ",
        "#  #  ",
        "#  #  ",
        "####  ")


    BLETS[[11]]=
      c(
        "#    #",
        "#   # ",
        "# #   ",
        "##    ",
        "# #   ",
        "#  #  ",
        "#   ##")

    BLETS[[12]]=
      c(    
        "#     ",
        "#     ",
        "#     ",
        "#     ",
        "#     ",   
        "#     ", 
        "######")

    BLETS[[13]]=
      c(
        "#     #",
        "##   ##",
        "# ### #",
        "#  #  #",
        "#     #",    
        "#     #",    
        "#     #")

    BLETS[[14]]=
      c(    
        "#     #",
        "##    #",
        "# #   #",
        "#  #  #",
        "#   # #",    
        "#    ##",   
        "#     #")

    BLETS[[15]]=
      c(    
        "#######",
        "#     #",
        "#     #",
        "#     #",
        "#     #",
        "#     #",
        "#######")


    BLETS[[16]]=
      c(
        "#######",
        "#     #",
        "#     #",
        "#######",
        "#      ", 
        "#      ",
        "#      ")

    BLETS[[17]]=
      c(
        " #####  ",
        "#     # ",
        "#     # ",
        "#     # ",
        "#   # # ",
        "#    ## ",
        " #######")

    BLETS[[18]]=
      c(   
        "#######",
        "#     #",
        "#     #",
        "#######",
        "#  ##  ", 
        "#   ## ",  
        "#    ##")

    BLETS[[19]]=
      c(
        "#######",
        "##   ##",
        " ##    ",  
        "  ##   ",
        "    ## ",
        "##   ##",
        "#######")

    BLETS[[20]]=
      c(
        "#######",
        "   #   ",
        "   #   ",
        "   #   ",
        "   #   ",
        "   #   ",
        "   #   ")

    BLETS[[21]]=
      c(
        "#     #",
        "#     #",
        "#     #",
        "#     #",
        "#     #",
        "#     #",
        "#######")

    BLETS[[22]]=
      c(
        "#     #",
        "#     #",
        "#     #",
        "#     #",
        " #   # ",
        "  # #  ",
        "   #   ")

    BLETS[[23]]=
      c(
        "#     #",   
        "#     #",
        "#     #",
        "#  #  #",
        "# # # #",
        "# # # #",
        "### ###")

    BLETS[[24]]=
      c(    
        "#     #", 
        " #   # ", 
        "  # #  ", 
        "   #   ", 
        "  # #  ",  
        " #   # ", 
        "#     #") 

    BLETS[[25]]=
      c(
        "#     #",
        " #   # ",
        "  # #  ",
        "   #   ",
        "   #   ",
        "   #   ",
        "   #   ")

    BLETS[[26]]=
      c(
        "#######",
        "#    ##",
        "   ##  ",  
        "  ##   ",
        " ##    ",
        "##    #",
        "#######")
i=26
    i = i+1

  BLETS[[i]]=
      c(
  
"     ",
"     ",
" ### ",
"#   #",
"  ###",
" #  #",
" ####")

         i = i+1

  BLETS[[i]]=
      c(
  

"#    ",
"#    ",
"#####",
"#   #",
"#   #",
"#   #",
"#####")

        
     i = i+1

  BLETS[[i]]=
      c(
  
"     ",
"     ",
"#####",
"#    ",
"#    ",
"#    ",
"#####")

     i = i+1

  BLETS[[i]]=
      c(
  
"    #",
"    #",
"    #",
"#####",
"#   #",
"#   #",
"#####")

     i = i+1

  BLETS[[i]]=
      c(
  
"     ",
"     ",
"#####",  
"#   #",
"#####",
"#    ",
"#####")

     i = i+1

  BLETS[[i]]=
      c(
  

"  ###",
" #   ",
"#    ",  
"#### ",
"#    ",
"#    ",
"#    ")

             i = i+1

  BLETS[[i]]=
      c(
  
"  ###",
" #  #",
"#   #",  
"#####",
"    #",
"    #",
"#### ")

             i = i+1

  BLETS[[i]]=
      c(
  
"#    ",
"#    ",
"#    ",  
"#### ",
"#   #",
"#   #",
"#   #")

        
     i = i+1

  BLETS[[i]]=
      c(
  
"     ",
"  #  ",
"     ",  
"  #  ",
"  #  ",
"  #  ",
"  #  ")

        
     i = i+1

  BLETS[[i]]=
      c(
  
"  #  ",
"     ",
"  #  ",  
"  #  ",
"  #  ",
"# #  ",
"###  ")


        
     i = i+1

  BLETS[[i]]=
      c(
  
"     ",
"     ",
"#    ",
"#  # ",
"###  ",
"# #  ",
"#  # ")
        
     i = i+1

  BLETS[[i]]=
      c(
  
"  ",
"# ",
"# ",
"# ",
"# ",
"# ",
"##")

     i = i+1

  BLETS[[i]]=
      c(
  
"       ",
"       ",
"#      ",
"### ## ",
"#  #  #",
"#  #  #",
"#  #  #")

       i = i+1

  BLETS[[i]]=
      c(
    
"    ",
"    ",
"#   ",
"### ",
"#  #",   
"#  #",
"#  #")

        
     i = i+1

  BLETS[[i]]=
      c(
  
"     ",
"     ",
"     ",
" ### ",
"#   #",
"#   #",
" ### ")
    
     i = i+1

  BLETS[[i]]=
      c(
  
"     ",
" ### ",
"#   #",
"#   #",
"#### ",
"#    ",
"#    ")

     i = i+1

  BLETS[[i]]=
      c(
"     ",
" ### ",
"#   #",
"#   #",
" ### ",
"  #  ",
"   ##")

             i = i+1

  BLETS[[i]]=
      c(
  
"    ",
"    ",
"    ",
"# ##",
"##  ",
"#   ",
"#   ")

        
     i = i+1

  BLETS[[i]]=
      c(
  
"    ",
"    ",
" ###",
"#   ",
"####",
"   #",
"### ")

        
     i = i+1

  BLETS[[i]]=
      c(
  
"   ",
"#  ",
"#  ",
"## ",
"#  ",
"#  ",
"###")

        
     i = i+1

  BLETS[[i]]=
      c(
  
"     ",
"     ",
"#   #",
"#   #",
"#   #",
"#   #",
" ### ")


        
     i = i+1

  BLETS[[i]]=
      c(
  
"     ",
"     ",
"#   #",
"#   #",
"#   #",
" # # " ,
"  #  ")


           i = i+1

  BLETS[[i]]=
      c(
"         ",
"         ",
"#   #   #",
"#   #   #",
"#   #   #",
"#   #   #",
" ### ### ")

     i = i+1

  BLETS[[i]]=
      c(
  
"     ",
"     ",
"#   #",
" # # ",
"  #  ",
" # # ",
"#   #")

     i = i+1

  BLETS[[i]]=
      c(
"    ",
"    ",
" # #",
" # #",
" # #",
"  ##",
"####")

     i = i+1

  BLETS[[i]]=
      c(
"     ",
"     ",
"#####",
"   # ",
"  #  ",
" #   ",
"#####")   
    
     i = i+1

  BLETS[[i]]=
      c(

"#######",
"#    ##",        
"#   # #",
"#  #  #",
"# #   #",
"##    #",
"#######")


 
     i = i+1

  BLETS[[i]]=
      c(
"   #   ",
"   #   ",
"  ##   ",
" # #   ",
"   #   ",
"   #   ",
"   #   ")

     i = i+1

  BLETS[[i]]=
      c(

" ##### ",
"#     #",        
"#     #",
"  #### ",
" #     ",
" #     ",
" ######")
  i = i+1

  BLETS[[i]]=
      c(

" ##### ",
"#     #",
"     # ",
"   ##  ",
"     # ",
"#     #",
" ##### ")
  i = i+1
  BLETS[[i]]=
      c(

"#   #  ",
"#   #  ",
"#   #  ",
"#######",
"    #  ",
"    #  ",
"    #  ")


  i = i+1
  BLETS[[i]]=
      c(
"#######",
"#      ",
"#      ",
"#######",
"      #",
"      #",
"###### ")
  i = i+1

  BLETS[[i]]=
      c(
"###### ",
"#     #",
"#      ",
"#######",
"#     #",
"#     #",
"#######")
  i = i+1

  BLETS[[i]]=
      c(

" ######",
"#     #",
"     # ",
"    #  ",
"   #   ",
"  #    ",
"  #    ")


  i = i+1
  BLETS[[i]]=
      c(

" ##### ",
"#     #",
" #   # ",
"  ###  ",
" #   # ",
"#     #",
" ##### ")
     i = i+1
      BLETS[[i]]=
      c(

"#######",
"#     #",
"#     #",
"#######",
"      #",
"      #",
"      #")
   

  i = i+1
  BLETS[[i]]=
      c(
" ##### ",
"#     #",
"     # ",
"   #   ",
"   #   ",
"       ",
"   #   ")

  i = i+1
  BLETS[[i]]=
      c(
"   #   ",
"   #   ",
"   #   ",
"   #   ",
"   #   ",
"       ",
"   #   ")

  i = i+1
  BLETS[[i]]=
      c(
"  ",
"  ",
"  ",
"  ",
"  ",
"##",
"##")


  i = i+1
  BLETS[[i]]=
      c(
"     ",
"     ",
"     ",
"#####",
"     ",
"     ",
"     ")


  i = i+1
  BLETS[[i]]=
      c(
"     ",
"  #  ",
"  #  ",
"#####",
"  #  ",
"  #  ",
"     ")

   
   i = i+1

  BLETS[[i]]=
      c(    
        "#     #", 
        " #   # ", 
        "  # #  ", 
        "#######", 
        "  # #  ",  
        " #   # ", 
        "#     #") 


     i = i+1

  BLETS[[i]]=
      c(

"      #",
"     # ",        
"    #  ",
"   #   ",
"  #    ",
" #     ",
"#      ")

    

  i = i+1
  BLETS[[i]]=
      c(
"    ",
"    ",
"    ",
"####",
"####",
"    ",
"    ")    


  i = i+1
  BLETS[[i]]=
      c(
"#   ",
"  # ",
"   #",
"   #",
"   #",
"  # ",
"#   ")    

  i = i+1
  BLETS[[i]]=
      c(
"  #",
" # ",
"#  ",
"#  ",
"#  ",
" # ",
"  #")    

  i = i+1
  BLETS[[i]]=
      c(
"     ",
"     ",
"     ",
"     ",
"     ",
"     ",
"#####")    



    
    
        
    NumLines = 7


    if(!is.na(MSUB))
      {
        
        for(i in 1:length(BLETS))
          {
            
            if(identical(MSUB, "ALL"))  { replet = MYLETTERS[i] }
            else
              {
                replet = MSUB
              }
            
            BLETS[[i]] = gsub("#", replet ,  BLETS[[i]] )
            
          }

        
      }


    
    

    #  temp = toupper(temp)

    K = length(temp)
    
    wletts=match(unlist( strsplit(temp, split="") )   , MYLETTERS)

    n = length(wletts)

    

    for(j in 1:NumLines)
      {
        H = prefix
        for(k in 1:n)
          {
            if(is.na(wletts[k]))
              {
                H = paste(sep="", H,  space)
              }
            else
              {
                A = BLETS[[wletts[k]]]
                B = A[j]
                H = paste(sep=" ", H, B, letspace)
              }
          }

        if(!identical(suffix, ""))
          {
            H = paste(sep="", H, suffix)
          }
        
        cat(H, sep="\n")
      }

    if(FALSE)
      {
        ################ source("/home/lees/R_PAX/JMLUTIL/R/writeCOMMENT.R")

        
        for(i in seq(start=1, to=26, by=5))
          {
            k = seq(from=i, to=min(c(i+5, 26)), by=1)
            writeCOMMENT(LETTERS[k], space=" ", letspace="   " )


          }




      }


    invisible(BLETS)
    
  }

Try the RPMG package in your browser

Any scripts or data that you put into this service are public.

RPMG documentation built on Jan. 20, 2018, 9:04 a.m.