I've kind of solved the issue.

dat$Time <- paste(dat[,2], dat[,1], sep=" ")
head(dat)
dat[,c(1,2)] <- NA
head(dat)

> head(dat)
Year Month Number Time
1 NA NA 0 Jan 2002
2 NA NA 0 Feb 2002
3 NA NA 0 March 2002
4 NA NA 1 April 2002
5 NA NA 0 May 2002
6 NA NA 0 June 2002

unfortunately, can I delete the Year and Month Columns.
Once that's done, I can reconfigure the columns

Abraham

On Thu, Apr 28, 2011 at 11:00 AM, Abraham Mathew <abmathe...@gmail.com>wrote:

>
> Hi folks, I have a simple question that I just can't solve.
>
> I'm trying to merge two columns in my data frame.
>
> > sessionInfo()
> R version 2.13.0 (2011-04-13)
> Platform: i686-pc-linux-gnu (32-bit)
>
> > head(dat)
> Year   Month Number
> 2002   Jan       0
> 2002   Feb       0
> 2002   March    0
> 2002   April      1
> 2002   May      0
> 2002   June     0
>
> I tried to do the following, but it doesn't work.
>
> dat$Time <- merge(dat[,1], dat[,2])
> head(dat)
>
>
> Help, Abraham.
>
>
>
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to