Re: [R] Filling array: No recycling

From: Petr Klasterecky <klaster_at_karlin.mff.cuni.cz>
Date: Thu, 03 May 2007 12:15:06 +0200

First make your vectors to have the same length and then put them to the array.

 > x <- c(1,2)
 > x
[1] 1 2
 > length(x) <- 5
 > x
[1] 1 2 NA NA NA

Petr

Felix Wave napsal(a):
> Hello,
> is it possible to fill an array with no using of the recycling rule?
> My problem. I want to fill an array but my values have not always
> the same length.
> My aim. I want to fill the array only ONE TIME. All vacent places
> should be written with NA.
>
>
>
> Thank's a lot.
> Felix
>
>
> Example:
> --------
>
> #Write 1 to 3 only one time. The last
> #5 place should be NA.
>
> dim(as.array(letters))
> array(1:3, c(2,4) )
>
> #na.strings = "NA"
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 03 May 2007 - 10:25:18 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 May 2007 - 10:31:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.