Displaying 6 results from an estimated 6 matches for "site_2".
Did you mean:
site2
2018 May 01
2
how can I convert a long to wide matrix?
...;ID",
"EventDate", "timeGroup", "SITE"), class = "data.frame", row.names = c(NA,
-5L))
library(prettyR)
stretch_df(dat,idvar="ID",to.stretch=c("EventDate","SITE"))
ID timeGroup EventDate_1 EventDate_2 EventDate_3 SITE_1 SITE_2 SITE_3
1 id_X B1 9/8/16 9/9/16 9/15/17 A A B
2 id_Y B1 9/7/16 9/15/16 <NA> A B <NA>
>
Basically I am looking for like following table
ID timeGroup EventDate_1 EventDate_2 EventDate_3 SITE_1 SITE_2
1 id_X...
2018 May 01
0
how can I convert a long to wide matrix?
...timeGroup", "SITE"), class = "data.frame", row.names = c(NA,
>
> -5L))
>
> library(prettyR)
>
> stretch_df(dat,idvar="ID",to.stretch=c("EventDate","SITE"))
>
>
> ID timeGroup EventDate_1 EventDate_2 EventDate_3 SITE_1 SITE_2 SITE_3
> 1 id_X B1 9/8/16 9/9/16 9/15/17 A A B
> 2 id_Y B1 9/7/16 9/15/16 <NA> A B <NA>
>>
>
> Basically I am looking for like following table
>
> ID timeGroup EventDate_1 EventDate_2 EventDat...
2018 May 01
2
how can I convert a long to wide matrix?
...data.frame", row.names =
> c(NA,
> >
> > -5L))
> >
> > library(prettyR)
> >
> > stretch_df(dat,idvar="ID",to.stretch=c("EventDate","SITE"))
> >
> >
> > ID timeGroup EventDate_1 EventDate_2 EventDate_3 SITE_1 SITE_2 SITE_3
> > 1 id_X B1 9/8/16 9/9/16 9/15/17 A A B
> > 2 id_Y B1 9/7/16 9/15/16 <NA> A B <NA>
> >>
> >
> > Basically I am looking for like following table
> >
> > ID timeGro...
2018 May 01
0
how can I convert a long to wide matrix?
...(NA,
>> >
>> > -5L))
>> >
>> > library(prettyR)
>> >
>> > stretch_df(dat,idvar="ID",to.stretch=c("EventDate","SITE"))
>> >
>> >
>> > ID timeGroup EventDate_1 EventDate_2 EventDate_3 SITE_1 SITE_2 SITE_3
>> > 1 id_X B1 9/8/16 9/9/16 9/15/17 A A
>> > B
>> > 2 id_Y B1 9/7/16 9/15/16 <NA> A B
>> > <NA>
>> >>
>> >
>> > Basically I am looking for like follo...
2018 May 01
0
how can I convert a long to wide matrix?
Hi Marna,
Try this:
library(prettyR)
stretch_df(dat,idvar="ID",to.stretch=c("EventDate","SITE"))
Jim
On Wed, May 2, 2018 at 8:24 AM, Marna Wagley <marna.wagley at gmail.com> wrote:
> Hi R user,
> I was trying to convert a long matrix to wide? I have an example and would
> like to get a table (FinalData1):
>
>
> FinalData1
> B1
2018 May 01
2
how can I convert a long to wide matrix?
Hi R user,
I was trying to convert a long matrix to wide? I have an example and would
like to get a table (FinalData1):
FinalData1
B1 B2
id_X "A" "B"
id_Y "A" "B"
but I got the following table using the following code.
FinalData1
B1 B2
id_X "A" "A"
id_Y "A" "B"
the code and the