Or better:
reshape(cbind(DF, value = 1), v.names = 'value', idvar = 'V1', timevar
= 'V2', direction = 'wide')
On Tue, Mar 2, 2010 at 3:49 PM, Henrique Dallazuanna wrote:
> Try this:
>
> DF <- read.table(textConnection("1 this
> 1 is
> 1 the
> 1 first
> 1 row
> 2 this
> 2 is
> 2 the
> 2 send
> 2
Jan -
Here's one way:
tbl = data.frame(id=c(1,1,1,1,1,2,2,2,2,2),
text=c('this','is','the','first','row','this','is','the','second','row'))
xtabs(~id+text,tbl)
text
id first is row second the this
1 1 1 1 0 11
2 0 1 1 1 11
It'
Try this:
DF <- read.table(textConnection("1 this
1 is
1 the
1 first
1 row
2 this
2 is
2 the
2 send
2 row"))
reshape(DF, v.names = 'V2', idvar = 'V1', timevar = 'V2', direction = 'wide')
On Tue, Mar 2, 2010 at 3:35 PM, Jan Hornych wrote:
> Hi all,
>
> I have a table in database that is very long
how do i calculate the p-value of trend test
Hello,
I have two data.
x<-c(1, 2, 1, 3, 2)
y<-c(3, 1, 2, 3, 5)
1. How do i create matrix from this two.
what i want is this
x y
1 1 3
2 2 1
3 1 2
4 3 3
5 2 5
2. what is the best way to use chisq.test to get the p.value
t
Here is how you can apply the mat function mentioned by Cassardi,
x<-c(1, 2, 1, 3, 2)
y<-c(3, 1, 2, 3, 5)
mat<-matrix(c(x,y),5,2) ##the first parameter gives the data vector
wich is filled columnwise in the matrix, then comes the row and column
dimensions)
colnames(mat)<-c("x","y")
yo
See ?cbind and ?matrix.
Gabor
On Sat, May 10, 2008 at 03:21:26PM -0700, Claire_6700 wrote:
>
> Hello,
>
> I have two data.
>
> x<-c(1, 2, 1, 3, 2)
> y<-c(3, 1, 2, 3, 5)
>
> How do i create matrix from this two.
>
> what i want is this
>
> x y
> 1 1 3
> 2 2 1
> 3 1 2
> 4 3
6 matches
Mail list logo