like: Create a copy of given data and possibly change some...

Description Usage Arguments Examples

View source: R/like.R

Description

Create a copy of given data and possibly change some attributes of the new instance.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
like(...)

## S3 method for class 'matrix'
like(
  m,
  data = .empty,
  nrow = .empty,
  ncol = .empty,
  byrow = FALSE,
  dimnames = .empty
)

## S3 method for class 'array'
like(a, data = .empty, dim = .empty, dimnames = .empty)

Arguments

m

A matrix to be copied

data

New data to be stored in the new copy

nrow

The new number of rows of the copied matrix

ncol

The new number of columns of the copied matrix

byrow

Whehter the data of the copied matrix has to be assigned by row first

dimnames

THe dimension names of the new copy

a

An array to be copied

dim

The dimensions of the new copied array

Examples

1
2
3
4
m <- matrix(1:6, nrow=3)

# create a new matrix of the same dimensions as m, but different data
m2 <- like(m, data=0)

beerda/hexmatrix documentation built on May 2, 2021, 4:15 a.m.