Skip to content
Back to formatted view

Raw Message

Message-ID: <3ED77F8B.7060606@statistik.uni-dortmund.de>
Date: 2003-05-30T15:58:03Z
From: Uwe Ligges
Subject: conversao para matriz
In-Reply-To: <200305301527.h4UFRtu9023012@hypatia.math.ethz.ch>

Danilo Tadashi Tagami Kamimura wrote:
> ol?,
> estou tentando converter a vari?vel b (abaixo) em uma matriz com duas
> colunas, sem muito sucesso, algu?m teria alguma sugest?o?
> 
> muito obrigado,
> 
> a<-outer(1:5,1:7,FUN="paste")
> b<- sample(a,10)
>  [1] "4 2" "5 7" "3 3" "4 1" "4 5" "3 5" "5 2" "2 1" "3 7" "1 4"
> 
> Matriz desejada:
> 
>  4   2
>  5   7
>  ......
>  3  7
>  1  4 
> 

On this list in english, please.
I guess you are going to do something like

   matrix(as.numeric(unlist(strsplit(b, " "))), ncol = 2, byrow = TRUE)

[I don't get the point why you use a character vector for those values.]

Uwe Ligges