Skip to content

Multiple regressions with changing dependent variable and time span

1 message · arun

#
Hi,
Try:
dat1 <- read.table(text="A??? B???? C???? D
r.1? x1??? x2?? x3
r.1? x4??? x5??? x6
r.2? x7??? x8??? x9
r.2? x10? x11 x12
r.3? x13? x14 x15
r.3? x16? x17 x18",header=TRUE,stringsAsFactors=FALSE)

?dat2 <- do.call(cbind,split(dat1,dat1$A))
colnames(dat2) <- gsub(".*\\.","",colnames(dat2))
A.K.
On Sunday, December 1, 2013 6:32 PM, nooldor <nooldor at gmail.com> wrote:
Hi,

could you also tell me how to reshape the res1 matrix like that:

[now]

A??? B???? C???? D
r.1? x1??? x2?? x3
r.1? x4 ?? x5??? x6
r.2? x7 ?? x8??? x9r.2? x10? x11 x12r.3? x13? x14 x15r.3? x16? x17 x18


[after]:
A??? B???? C???? D????? A??? B???? C???? D???? ? A??? B???? C???? D
r.1? x1??? x2?? x3? ? ? r.2? x7 ?? x8??? x9????? r.3? x13? x14 x15
r.1? x4 ?? x5?? x6? ? ? r.2? x10? x11 x12????? r.3? x16? x17 x18



big thanks!
On 30 November 2013 23:28, arun <smartpink111 at yahoo.com> wrote:
Hi,