Skip to content

syntax #5

@rscharpf

Description

@rscharpf

<- is preferred over =

For subsetting matrices, use drop=FALSE:

##useM=as(Ms[chr %in% samplechr,],"matrix")
useM <- Ms[chr %in% samplechr,, drop=FALSE]

  • to comment something, use ## . Then tab will give the comment the appropriate indentation

For proper indentation, add this to your .emacs:

(add-to-list 'auto-mode-alist '(".rd'" . Rd-mode))
;;; ESS From Writing R extensions manual
(add-hook 'ess-mode-hook
(lambda ()
(ess-set-style 'C++ 'quiet)
;; Because
;; DEF GNU BSD K&R C++
;; ess-indent-level 2 2 8 5 4
;; ess-continued-statement-offset 2 2 8 5 4
;; ess-brace-offset 0 0 -8 -5 -4
;; ess-arg-function-offset 2 4 0 0 0
;; ess-expression-offset 4 2 8 5 4
;; ess-else-offset 0 0 0 0 0
;; ess-close-brace-offset 0 0 0 0 0
(add-hook 'local-write-file-hooks
(lambda ()
(ess-nuke-trailing-whitespace)))))
;;(setq ess-nuke-trailing-whitespace-p 'ask)
;; or even
(setq ess-nuke-trailing-whitespace-p t)
;;; Perl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions