Re: [R] macro function

2012-02-28 Thread David Winsemius
On Feb 28, 2012, at 12:10 PM, mrzung wrote: I really appreciate to your attention. I want to change the data form "A" into "B" http://r.789695.n4.nabble.com/file/n4428807/1.png http://r.789695.n4.nabble.com/file/n4428807/2.png Please use text copied versions of dput(a) and dput(b) rathe

Re: [R] macro function

2012-02-28 Thread Rui Barradas
Hello, Is it just a columns names issue? Try (DF is your data, 'A' or other data.frame) # colNames <- colnames(DF) colNames <- c("name", "publish day", "2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04", "2011-01-05") x <- as.Date(colNames[-(1:2)]) x [1] "2011-01-01" "2011-01-02" "20

Re: [R] macro function

2012-02-28 Thread mrzung
I really appreciate to your attention. I want to change the data form "A" into "B" http://r.789695.n4.nabble.com/file/n4428807/1.png http://r.789695.n4.nabble.com/file/n4428807/2.png In fact, there are 1095 column in data "A". Specifically, variable "publish_day" is when some book in the

Re: [R] macro function

2012-02-28 Thread Petr PIKAL
Hi Your mail is quite messy. what is ***? How your data are structured? str(your.data) Please submit part of your data by dput(your.data) and show what the output shall be. Regards Petr > > Actually, what I really want to do is that, > > > <<"annual productivity data(2011)">> > >

Re: [R] macro function

2012-02-28 Thread mrzung
Actually, what I really want to do is that, <<"annual productivity data(2011)">> firts date 2011-01-01 2011-01-02 2011-01-03 2011-01-04

Re: [R] macro function

2012-02-28 Thread Joshua Wiley
Hi, There is not anything really like macro functions in R (and honestly, that is probably a good thing). Most the times I have seen people generating thousands of variables (vectors in your case) it is due to a lack of understanding how lists can be utilized to simplify code. If you give us some

Re: [R] macro function

2012-02-27 Thread Bert Gunter
On Mon, Feb 27, 2012 at 9:56 AM, mrzung wrote: > hi, > > I know how to use the "for" loop function like: > > for(i in 1:ncol(mat)){ > mat[i]<-b[i,2] > } > > but, in this case > > r1<-b[1,1] > r2<-b[2,1] > r3<-b[3,1] > r4<-b[4,1] > > * > * > * > > r3002<-b[3002,1] > r3003<-b[3003,1] > > - must make