[R] multiple assignments ?

Joshua Wiley jwiley.psych at gmail.com
Tue Aug 24 17:12:14 CEST 2010


Hi,

This is one way (I chose integer but it can be any mode):

vec1 <- vec2 <- vec3 <- vector("integer", 5)

Best regards,

Josh

On Tue, Aug 24, 2010 at 4:58 AM, Maas James Dr (MED) <J.Maas at uea.ac.uk> wrote:
> Simple one, have read and googled, still no luck!
>
> I want to create several empty vectors all of the same length.
>
> I would like multiple empty vectors (vec1, vec2, vec3) and want to create them all in one line.
>
> I've tried
>
> vec1,vec2,vec3 <- vector(length=5)
> and
> c(vec1,vec2,vec3) <- vector(length=5)
>
> and several other attempts but nothing seems to work ... suggestions?
>
> Thanks
>
> Jim
>
> ===============================
> Dr. Jim Maas
> University of East Anglia
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list