[R] inserting an extra row into an array

Spencer Graves spencer.graves at pdf.com
Thu Feb 20 16:59:06 CET 2003


How about

	  mat[c(1:5, 5:8),]?

Then change mat[6,] to whatever you want.

Spencer Graves

Petr Pikal wrote:
> Hi
> 
> On 20 Feb 2003 at 10:53, Wayne Jones wrote:
> 
> 
>>Does anyone know a simple way to insert an extra row into a matrix or
>>data frame, thus increasing the dimensions. 
> 
> 
> something like
> 
> rbind(mat[1:5,],0,mat[6:8,])
> 
> if mat is matrix it should be OK but if it is data.frame you has 
> either to add a correct sequence (factors, numbers, character 
> values...) or to change a generated NA's to appropriate values.
> 
> 
>>
>>Wayne
>>
>>
>>
>>KSS Ltd
>>A division of Knowledge Support Systems Group plc
>>Seventh Floor  St James's Buildings  79 Oxford Street  Manchester  M1
>>6SS  England Company Registration Number 2800886 (Limited) 3449594
>>(plc) Tel: +44 (0) 161 228 0040	Fax: +44 (0) 161 236 6305
>>mailto:kssg at kssg.com		http://www.kssg.com
>>
>>
>>The information in this Internet email is confidential and may be
>>legally privileged. It is intended solely for the addressee(s). Access
>>to this Internet email by anyone else is unauthorised.
>>
>>If you are not the intended recipient, any disclosure, copying,
>>distribution or any action taken or omitted to be taken in reliance on
>>it, is prohibited and may be unlawful. When addressed to our clients
>>any opinions or advice contained in this Internet email are subject to
>>the terms and conditions expressed in the governing engagement letter
>>or contract.
>>
>>This email message and any attached files have been scanned for the
>>presence of computer viruses.  However you are advised that you open
>>any attachments at your own risk.
>>
>>
>> [[alternate HTML version deleted]]
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>http://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> 
> Best regardsPetr Pikal
> Precheza a.s., Nabř.Dr.E.BeneÜe 24, 750 62 Přerov
> tel: +420581 252 257 ; 724 008 364
> petr.pikal at precheza.cz; p.pik at volny.cz
> fax +420581 252 561
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list