mteb/BrightProStackoverflowRetrieval huggingface dataset:
[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ base  (version  3.6.2  ) ](/packages/base/versions/3.6.2)

#  nrow: The Number of Rows/Columns of an Array

##  Description

` nrow ` and ` ncol ` return the number of rows or columns present in ` x ` .
` NCOL ` and ` NROW ` do the same treating a vector as 1-column matrix, even a
0-length vector, compatibly with ` [ as.matrix
](/link/as.matrix?package=base&version=3.6.2) () ` or ` [ cbind
](/link/cbind?package=base&version=3.6.2) () ` , see the example.

##  Usage

    
    
    nrow(x)
    ncol(x)
    NCOL(x)
    NROW(x)

##  Arguments

x

a vector, array, data frame, or ` [ NULL
](/link/NULL?package=base&version=3.6.2) ` .

##  Value

an ` [ integer ](/link/integer?package=base&version=3.6.2) ` of length 1 or `
[ NULL ](/link/NULL?package=base&version=3.6.2) ` , the latter only for ` ncol
` and ` nrow ` .

##  References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S Language_ .
Wadsworth & Brooks/Cole ( ` ncol ` and ` nrow ` .)

##  See Also

` [ dim ](/link/dim?package=base&version=3.6.2) ` which returns _all_
dimensions; ` [ array ](/link/array?package=base&version=3.6.2) ` , ` [ matrix
](/link/matrix?package=base&version=3.6.2) ` .

##  Examples

[ Run this code
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fnrow&utm_source=r-docs&utm_medium=docs&utm_term=nrow&utm_content=run_example_in_workspace)

    
    
    # NOT RUN {
    ma <- matrix(1:12, 3, 4)
    nrow(ma)   # 3
    ncol(ma)   # 4
    
    ncol(array(1:24, dim = 2:4)) # 3, the second dimension
    NCOL(1:12) # 1
    NROW(1:12) # 12
    
    ## as.matrix() produces 1-column matrices from 0-length vectors,
    ## and so does cbind() :
    dim(as.matrix(numeric())) # 0 1
    dim(    cbind(numeric())) # ditto
    ## consequently, NCOL(.) gives 1, too :
    NCOL(numeric()) # 1 and hence
    NCOL(NULL)      # 1
    # }
    

Run the code above in your browser using  [ DataCamp Workspace
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fnrow&utm_source=r-docs&utm_medium=docs&utm_term=nrow&utm_content=run_example_in_workspace)

Powered by  [ DataCamp ](https://www.datacamp.com/)
[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ base  (version  3.6.2  ) ](/packages/base/versions/3.6.2)

#  octmode: Display Numbers in Octal

##  Description

Convert or print integers in octal format, with as many digits as are needed
to display the largest, using leading zeroes as necessary.

##  Usage

    
    
    as.octmode(x)
    
    # S3 method for octmode
    as.character(x, …)
    
    # S3 method for octmode
    format(x, width = NULL, …)
    
    # S3 method for octmode
    print(x, …)

##  Arguments

x

An object, for the methods inheriting from class ` "octmode" ` .

width

` NULL ` or a positive integer specifying the minimum field width to be used,
with padding by leading zeroes.

…

further arguments passed to or from other methods.

##  Details

Class ` "octmode" ` consists of integer vectors with that class attribute,
used merely to ensure that they are printed in octal notation, specifically
for Unix-like file permissions such as ` 755 ` . Subsetting ( ` [ [
](/link/%5B?package=base&version=3.6.2) ` ) works too.

If ` width = NULL ` (the default), the output is padded with leading zeroes to
the smallest width needed for all the non-missing elements.

` as.octmode ` can convert integers (of [ type
](/link/type?package=base&version=3.6.2) ` "integer" ` or ` "double" ` ) and
character vectors whose elements contain only digits ` 0-7 ` (or are ` NA ` )
to class ` "octmode" ` .

There is a ` [ ! ](/link/!?package=base&version=3.6.2) ` method and methods for ` [ | ](/link/%7C?package=base&version=3.6.2) ` and ` [ & ](/link/%26amp%3B?package=base&version=3.6.2) ` :  these recycle their arguments to the length of the longer and then apply the operators bitwise to each element. 

##  See Also

These are auxiliary functions for ` [ file.info
](/link/file.info?package=base&version=3.6.2) ` .

` [ hexmode ](/link/hexmode?package=base&version=3.6.2) ` , ` [ sprintf
](/link/sprintf?package=base&version=3.6.2) ` for other options in converting
integers to octal, ` [ strtoi ](/link/strtoi?package=base&version=3.6.2) ` to
convert octal strings to integers.

##  Examples

[ Run this code
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Foctmode&utm_source=r-docs&utm_medium=docs&utm_term=octmode&utm_content=run_example_in_workspace)

    
    
    # NOT RUN {
    (on <- as.octmode(c(16, 32, 127:129))) # "020" "040" "177" "200" "201"
    unclass(on[3:4]) # subsetting
    
    ## manipulate file modes
    fmode <- as.octmode("170")
    (fmode | "644") & "755"
    # }
    # NOT RUN {
    umask <- Sys.umask(NA) # depends on platform
    c(fmode, "666", "755") & !umask
    # }
    

Run the code above in your browser using  [ DataCamp Workspace
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Foctmode&utm_source=r-docs&utm_medium=docs&utm_term=octmode&utm_content=run_example_in_workspace)

Powered by  [ DataCamp ](https://www.datacamp.com/)
[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ micropan  (version  1.0  ) ](/packages/micropan/versions/1.0)

#  plot.Fasta: Plotting and printing ` Fasta ` objects

##  Description

Generic functions for plotting and printing the content of a ` Fasta ` object.

##  Usage

    
    
    "plot"(x, col="tan4", border="tan4", ...)
    "summary"(object, ...)
    "str"(object, ...)

##  Arguments

x

A ` Fasta ` object, see below.

col

Color of bar interiors.

border

Color of bar borders.

object

A ` Fasta ` object, see below.

...

Optional graphical arguments.

##  Details

A ` Fasta ` object contains biological sequences in the FASTA format. It is a
small (S3) extension to a ` data.frame ` . It is actually a ` data.frame `
containing at least two text columns named  Header  and  Sequence  . The
Header  column contains the headerlines for each sequence, and the  Sequence
columns the sequences themselves. A ` Fasta ` object is typically created by
reading a FASTA formatted file into R by ` [ readFasta
](/link/readFasta?package=micropan&version=1.0) ` . A ` Fasta ` object can be
treated as a ` data.frame ` , which makes it quick and easy to search both
Header  and  Sequence  for specific regular expressions, sort or re-arrange
the ordering of the sequences, extract subsets or add new data to an existing
` Fasta ` object. The ` [ plot.Fasta
](/link/plot.Fasta?package=micropan&version=1.0) ` function will display the
content of the ` Fasta ` object as a bar chart over the lengths of the
sequences. The bars are displayed horizontally, and the first sequence is on
top, just like in the FASTA file. The ` [ summary.Fasta
](/link/summary.Fasta?package=micropan&version=1.0) ` function will display a
text giving the number of sequences and the alphabet, i.e. listing all unique
symbols found in the file. The ` [ str.Fasta
](/link/str.Fasta?package=micropan&version=1.0) ` function will simply print
the number of sequences in the ` Fasta ` object.

##  See Also

` [ readFasta ](/link/readFasta?package=micropan&version=1.0) ` , ` [
writeFasta ](/link/writeFasta?package=micropan&version=1.0) ` .

##  Examples

[ Run this code
](https://www.datacamp.com/datalab/preview?_tag=rdocs&rdocsPath=packages%2Fmicropan%2Fversions%2F1.0%2Ftopics%2Fplot.Fasta&utm_source=r-docs&utm_medium=docs&utm_term=plot.Fasta&utm_content=run_example_in_datalab)

    
    
    # See the examples in the Help-file for readFasta/writeFasta
    

Run the code above in your browser using  [ DataLab
](https://www.datacamp.com/datalab/preview?_tag=rdocs&rdocsPath=packages%2Fmicropan%2Fversions%2F1.0%2Ftopics%2Fplot.Fasta&utm_source=r-docs&utm_medium=docs&utm_term=plot.Fasta&utm_content=run_example_in_datalab)

Powered by  [ DataCamp ](https://www.datacamp.com/)
[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ base  (version  3.6.2  ) ](/packages/base/versions/3.6.2)

#  CallExternal: Modern Interfaces to C/C++ code

##  Description

Functions to pass  R  objects to compiled C/C++ code that has been loaded into
R  .

##  Usage

    
    
    .Call(.NAME, …, PACKAGE)
    .External(.NAME, …, PACKAGE)

##  Arguments

.NAME

a character string giving the name of a C function, or an object of class ` "
[ NativeSymbolInfo ](/link/NativeSymbolInfo?package=base&version=3.6.2) " ` ,
` " [ RegisteredNativeSymbol
](/link/RegisteredNativeSymbol?package=base&version=3.6.2) " ` or ` " [
NativeSymbol ](/link/NativeSymbol?package=base&version=3.6.2) " ` referring to
such a name.

…

arguments to be passed to the compiled code. Up to 65 for ` .Call ` .

PACKAGE

if supplied, confine the search for a character string ` .NAME ` to the DLL
given by this argument (plus the conventional extension, ` .so ` , ` .dll ` ,
…).

This argument follows ` ... ` and so its name cannot be abbreviated.

This is intended to add safety for packages, which can ensure by using this
argument that no other package can override their external symbols, and also
speeds up the search (see ‘Note’).

##  Value

An  R  object constructed in the compiled code.

##  Header files for external code

Writing code for use with these functions will need to use internal  R
structures defined in ` Rinternals.h ` and/or the macros in ` Rdefines.h ` .

##  Details

The functions are used to call compiled code which makes use of internal  R
objects, passing the arguments to the code as a sequence of  R  objects. They
assume C calling conventions, so can usually also be used for C++ code.

For details about how to write code to use with these functions see the
chapter on ‘System and foreign language interfaces’ in the ‘Writing  R
Extensions’ manual. They differ in the way the arguments are passed to the C
code: ` .External ` allows for a variable or unlimited number of arguments.

These functions are [ primitive ](/link/primitive?package=base&version=3.6.2)
, and ` .NAME ` is always matched to the first argument supplied (which should
not be named). For clarity, avoid using names in the arguments passed to ` … `
that match or partially match ` .NAME ` .

##  References

Chambers, J. M. (1998) _Programming with Data. A Guide to the S Language_ .
Springer. ( ` .Call ` .)

##  See Also

` [ dyn.load ](/link/dyn.load?package=base&version=3.6.2) ` , ` [ .C
](/link/.C?package=base&version=3.6.2) ` , ` [ .Fortran
](/link/.Fortran?package=base&version=3.6.2) ` .

The ‘Writing R Extensions’ manual.

Powered by  [ DataCamp ](https://www.datacamp.com/)
[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ base  (version  3.6.2  ) ](/packages/base/versions/3.6.2)

#  all: Are All Values True?

##  Description

Given a set of logical vectors, are all of the values true?

##  Usage

    
    
    all(…, na.rm = FALSE)

##  Arguments

…

zero or more logical vectors. Other objects of zero length are ignored, and
the rest are coerced to logical ignoring any class.

na.rm

logical. If true ` NA ` values are removed before the result is computed.

##  Value

The value is a logical vector of length one.

Let ` x ` denote the concatenation of all the logical vectors in ` ... `
(after coercion), after removing ` NA ` s if requested by ` na.rm = TRUE ` .

The value returned is ` TRUE ` if all of the values in ` x ` are ` TRUE `
(including if there are no values), and ` FALSE ` if at least one of the
values in ` x ` is ` FALSE ` . Otherwise the value is ` NA ` (which can only
occur if ` na.rm = FALSE ` and ` … ` contains no ` FALSE ` values and at least
one ` NA ` value).

##  S4 methods

This is part of the S4 ` [ Summary
](/link/Summary?package=base&version=3.6.2&to=%3DS4groupGeneric) ` group
generic. Methods for it must use the signature ` x, …, na.rm ` .

##  Details

This is a generic function: methods can be defined for it directly or via the
` [ Summary ](/link/Summary?package=base&version=3.6.2&to=%3DS3groupGeneric) `
group generic. For this to work properly, the arguments ` … ` should be
unnamed, and dispatch is on the first argument.

Coercion of types other than integer (raw, double, complex, character, list)
gives a warning as this is often unintentional.

This is a [ primitive ](/link/primitive?package=base&version=3.6.2) function.

##  References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S Language_ .
Wadsworth & Brooks/Cole.

##  See Also

` [ any ](/link/any?package=base&version=3.6.2) ` , the ‘complement’ of ` all
` , and ` [ stopifnot ](/link/stopifnot?package=base&version=3.6.2) (*) `
which is an ` all(*) ` ‘insurance’.

##  Examples

[ Run this code
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fall&utm_source=r-docs&utm_medium=docs&utm_term=all&utm_content=run_example_in_workspace)

    
    
    # NOT RUN {
    range(x <- sort(round(stats::rnorm(10) - 1.2, 1)))
    if(all(x < 0)) cat("all x values are negative\n")
    
    all(logical(0))  # true, as all zero of the elements are true.
    # }
    

Run the code above in your browser using  [ DataCamp Workspace
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fall&utm_source=r-docs&utm_medium=docs&utm_term=all&utm_content=run_example_in_workspace)

Powered by  [ DataCamp ](https://www.datacamp.com/)
[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ base  (version  3.6.2  ) ](/packages/base/versions/3.6.2)

#  comment: Query or Set a ` "comment" ` Attribute

##  Description

These functions set and query a _comment_ attribute for any  R  objects. This
is typically useful for ` [ data.frame
](/link/data.frame?package=base&version=3.6.2) ` s or model fits.

Contrary to other ` [ attributes
](/link/attributes?package=base&version=3.6.2) ` , the ` comment ` is not
printed (by ` [ print ](/link/print?package=base&version=3.6.2) ` or ` [
print.default ](/link/print.default?package=base&version=3.6.2) ` ).

Assigning ` NULL ` or a zero-length character vector removes the comment.

##  Usage

    
    
    comment(x)
    comment(x) <- value

##  Arguments

x

any  R  object

value

a ` character ` vector, or ` NULL ` .

##  See Also

` [ attributes ](/link/attributes?package=base&version=3.6.2) ` and ` [ attr
](/link/attr?package=base&version=3.6.2) ` for other attributes.

##  Examples

[ Run this code
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fcomment&utm_source=r-docs&utm_medium=docs&utm_term=comment&utm_content=run_example_in_workspace)

    
    
    # NOT RUN {
    x <- matrix(1:12, 3, 4)
    comment(x) <- c("This is my very important data from experiment #0234",
                    "Jun 5, 1998")
    x
    comment(x)
    # }
    

Run the code above in your browser using  [ DataCamp Workspace
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fcomment&utm_source=r-docs&utm_medium=docs&utm_term=comment&utm_content=run_example_in_workspace)

Powered by  [ DataCamp ](https://www.datacamp.com/)
[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ base  (version  3.6.2  ) ](/packages/base/versions/3.6.2)

#  mapply: Apply a Function to Multiple List or Vector Arguments

##  Description

` mapply ` is a multivariate version of ` [ sapply
](/link/sapply?package=base&version=3.6.2) ` . ` mapply ` applies ` FUN ` to
the first elements of each … argument, the second elements, the third
elements, and so on. Arguments are recycled if necessary.

##  Usage

    
    
    mapply(FUN, …, MoreArgs = NULL, SIMPLIFY = TRUE,
           USE.NAMES = TRUE)

##  Arguments

FUN

function to apply, found via ` [ match.fun
](/link/match.fun?package=base&version=3.6.2) ` .

…

arguments to vectorize over (vectors or lists of strictly positive length, or
all of zero length). See also ‘Details’.

MoreArgs

a list of other arguments to ` FUN ` .

SIMPLIFY

logical or character string; attempt to reduce the result to a vector, matrix
or higher dimensional array; see the ` simplify ` argument of ` [ sapply
](/link/sapply?package=base&version=3.6.2) ` .

USE.NAMES

logical; use names if the first … argument has names, or if it is a character
vector, use that character vector as the names.

##  Value

A list, or for ` SIMPLIFY = TRUE ` , a vector, array or list.

##  Details

` mapply ` calls ` FUN ` for the values of ` … ` (re-cycled to the length of
the longest, unless any have length zero), followed by the arguments given in
` MoreArgs ` . The arguments in the call will be named if ` … ` or ` MoreArgs
` are named.

Arguments with classes in ` … ` will be accepted, and their subsetting and `
length ` methods will be used.

##  See Also

` [ sapply ](/link/sapply?package=base&version=3.6.2) ` , after which `
mapply() ` is modelled.

` [ outer ](/link/outer?package=base&version=3.6.2) ` , which applies a
vectorized function to all combinations of two arguments.

##  Examples

[ Run this code
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fmapply&utm_source=r-docs&utm_medium=docs&utm_term=mapply&utm_content=run_example_in_workspace)

    
    
    # NOT RUN {
    mapply(rep, 1:4, 4:1)
    
    mapply(rep, times = 1:4, x = 4:1)
    
    mapply(rep, times = 1:4, MoreArgs = list(x = 42))
    
    mapply(function(x, y) seq_len(x) + y,
           c(a =  1, b = 2, c = 3),  # names from first
           c(A = 10, B = 0, C = -10))
    
    word <- function(C, k) paste(rep.int(C, k), collapse = "")
    utils::str(mapply(word, LETTERS[1:6], 6:1, SIMPLIFY = FALSE))
    # }
    

Run the code above in your browser using  [ DataCamp Workspace
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fmapply&utm_source=r-docs&utm_medium=docs&utm_term=mapply&utm_content=run_example_in_workspace)

Powered by  [ DataCamp ](https://www.datacamp.com/)
[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ base  (version  3.6.2  ) ](/packages/base/versions/3.6.2)

#  withVisible: Return both a Value and its Visibility

##  Description

This function evaluates an expression, returning it in a two element list
containing its value and a flag showing whether it would automatically print.

##  Usage

    
    
    withVisible(x)

##  Arguments

x

an expression to be evaluated.

##  Value

value

    

The value of ` x ` after evaluation.

visible

    

logical; whether the value would auto-print.

##  Details

The argument, _not_ an ` [ expression
](/link/expression?package=base&version=3.6.2) ` object, rather an
(unevaluated function) ` [ call ](/link/call?package=base&version=3.6.2) ` ,
is evaluated in the caller's context.

This is a [ primitive ](/link/primitive?package=base&version=3.6.2) function.

##  See Also

` [ invisible ](/link/invisible?package=base&version=3.6.2) ` , ` [ eval
](/link/eval?package=base&version=3.6.2) ` ; ` [ withAutoprint
](/link/withAutoprint?package=base&version=3.6.2) () ` calls ` [ source
](/link/source?package=base&version=3.6.2) () ` which itself uses `
withVisible() ` in order to correctly “auto print”.

##  Examples

[ Run this code
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2FwithVisible&utm_source=r-docs&utm_medium=docs&utm_term=withVisible&utm_content=run_example_in_workspace)

    
    
    # NOT RUN {
    x <- 1
    withVisible(x <- 1) # *$visible is FALSE
    x
    withVisible(x)      # *$visible is TRUE
    
    # Wrap the call in evalq() for special handling
    
    df <- data.frame(a = 1:5, b = 1:5)
    evalq(withVisible(a + b), envir = df)
    # }
    

Run the code above in your browser using  [ DataCamp Workspace
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2FwithVisible&utm_source=r-docs&utm_medium=docs&utm_term=withVisible&utm_content=run_example_in_workspace)

Powered by  [ DataCamp ](https://www.datacamp.com/)
Look arounds  regexp  |  matches  |  example  |  example output   
(highlighted characters are in <>)  
---|---|---|---  
` a(?=c) ` |  followed by  |  ` look("a(?=c)") ` | 
    
    
    b<a>cad  
  
` a(?!c) ` |  not followed by  |  ` look("a(?!c)") ` | 
    
    
    bac<a>d  
  
` (?<=b)a ` |  preceded by  |  ` look("(?<=b)a") ` | 
    
    
    b<a>cad  
  
` (?<!b)a ` |  not preceded by  |  ` look("(?<!b)a") ` | 
    
    
    bac<a>d  
  
###  Quantifiers

` quant <- function(rx) str_view(".a.aa.aaa", rx) `