Please cc the list on all correspondence. The easiest way to get data in/out of Excel will likely be to use read.zoo and write.zoo: see the accompanying vignette for details. For more information, see the R Import/Export manual
M On Tue, Feb 21, 2012 at 9:35 PM, jpm miao <miao...@gmail.com> wrote: > I mean: I want to view the data in this format so that the data and the > dates can be pasted into Excel directly. If I type the name of the zoo > object in the console window, I can see the data but they are not in the > Excel format. Once I paste them into Excel, the (all elements in ) the > first row goes to A1, ( all elements in ) the second goes to A2. What I > want is to let each element goes to one cell in Excel. > > > > CPI CPIZF UNR UNRSA 1978 Q1 NA NA 1.87 1.97 1978 Q2 NA NA 1.643333 > 1.786667 1978 Q3 NA NA 1.87 1.606667 1978 Q4 NA NA 1.283333 1.303333 1979 > Q1 NA NA 1.26 1.366667 1979 Q2 NA NA 1.133333 1.303333 1979 Q3 NA NA > 1.496667 1.246667 1979 Q4 NA NA 1.2 1.196667 1980 Q1 NA NA 1.036667 > 1.133333 1980 Q2 NA NA 1.14 1.326667 1980 Q3 NA NA 1.5 1.246667 1980 Q4 > NA NA 1.236667 1.223333 1981 Q1 62.9 66.77333 1.16 1.246667 1981 Q2 > 63.73 66.77333 1.066667 1.276667 > 2012/2/22 R. Michael Weylandt <michael.weyla...@gmail.com> > >> What is "the excel format" in R? From what you put below, it sure >> looks like the date is visible...perhaps you want time()? >> >> Michael >> >> On Tue, Feb 21, 2012 at 9:01 PM, jpm miao <miao...@gmail.com> wrote: >> > Hello, >> > >> > I have built a zoo object. I try to see it in a tabular form. Is there >> > any way to view the date and the data in the excel format? If I use >> > as.matrix, I can only see the data but not the date. >> > >> >> x2zooq CPI CPIZF UNR UNRSA >> > 1978 Q1 NaN NaN 1.870000 1.970000 >> > 1978 Q2 NaN NaN 1.643333 1.786667 >> > 1978 Q3 NaN NaN 1.870000 1.606667 >> > 1978 Q4 NaN NaN 1.283333 1.303333 >> > 1979 Q1 NaN NaN 1.260000 1.366667 >> > 1979 Q2 NaN NaN 1.133333 1.303333 >> > 1979 Q3 NaN NaN 1.496667 1.246667 >> > 1979 Q4 NaN NaN 1.200000 1.196667 >> > 1980 Q1 NaN NaN 1.036667 1.133333 >> > 1980 Q2 NaN NaN 1.140000 1.326667 >> > 1980 Q3 NaN NaN 1.500000 1.246667 >> > 1980 Q4 NaN NaN 1.236667 1.223333 >> > 1981 Q1 62.90000 66.77333 1.160000 1.246667 >> > 1981 Q2 63.73000 66.77333 1.066667 1.276667 >> > 1981 Q3 64.97333 67.11333 1.653333 1.383333 >> > 1981 Q4 65.02000 67.83000 1.533333 1.500000 >> > 1982 Q1 65.15333 68.55667 1.433333 1.523333 >> > 1982 Q2 65.67333 69.06667 1.806667 2.036667 >> > >> > >> >> temp<-as.matrix(x2zooq) >> > >> > >> > Then I see a table >> > >> row.namesCPICPIZFUNRUNRSA11NaNNaN1.8700001.97000024NaNNaN1.6433331.78666737 >> > >> NaNNaN1.8700001.606667410NaNNaN1.2833331.303333513NaNNaN1.2600001.366667616 >> > >> NaNNaN1.1333331.303333719NaNNaN1.4966671.246667822NaNNaN1.2000001.196667925 >> > >> NaNNaN1.0366671.1333331028NaNNaN1.1400001.3266671131NaNNaN1.5000001.24666712 >> > 34NaNNaN1.2366671.223333133762.9000066.773331.1600001.246667144063.73000 >> > 66.773331.0666671.276667154364.9733367.113331.6533331.383333164665.02000 >> > 67.830001.5333331.500000174965.1533368.556671.4333331.523333185265.67333 >> > 69.066671.8066672.036667195566.9766769.333332.5133332.240000205866.40333 >> > 69.570002.7566672.723333216166.9433369.786673.0300003.120000226467.50667 >> > 69.733332.5133332.763333236766.9700069.570002.8300002.540000247066.39333 >> > 69.683332.4666672.430000257366.1466770.100002.3933332.496667267667.13333 >> > 70.666672.1166672.366667277967.4300070.776672.8566672.520000288267.02667 >> > 70.626672.4100002.386667298567.0800070.486672.2233332.343333308866.77333 >> > 70.110002.4600002.700000319166.8733369.483333.7200003.386667329466.58667 >> > 69.793333.2133333.203333 >> > >> > 2012/2/17 jpm miao <miao...@gmail.com> >> > >> >> Hello, >> >> >> >> I have a question on how to tabulate the time series data. I use >> >> RStudio, but if can be done in any other R editor, it should work in >> >> RStudio as well. >> >> >> >> > a1<-11:22 >> >> >> >> > a1ts<-ts(a1, frequency=4, start=c(1978,1)) >> >> >> >> > a1ts Qtr1 Qtr2 Qtr3 Qtr4 >> >> 1978 11 12 13 14 >> >> 1979 15 16 17 18 >> >> 1980 19 20 21 22 >> >> >> >> >> >> If I click the variable "a1ts" on the workspace, I see >> >> >> >> structure(11:22, .Tsp = c(1978, 1980.75, 4), class = "ts") >> >> >> >> If I coerce the variable to become a matrix, >> >> >> >> > a1tsm<-as.matrix(a1ts) >> >> >> >> >> >> and click the variable "a1tsm", I see the vector in a tabular form >> and >> >> can paste it into Excel , but I don't see the dates at all >> >> V1 >> >> 1 11 >> >> 2 12 >> >> 3 13 >> >> 4 14 >> >> 5 15 >> >> 6 16 >> >> 7 17 >> >> 8 18 >> >> 9 19 >> >> 10 20 >> >> 11 21 >> >> 12 22 >> >> >> >> How could I see both the dates and the data in a tabular form? >> >> >> >> The second question is that if I have another data sequence, how >> can >> >> I combine the two and see both data in a tabular form? >> >> >> >> > a2<-101:116> a2ts<-ts(a2, frequency=4, start=c(1979,1))> a2ts >> Qtr1 Qtr2 Qtr3 Qtr4 >> >> 1979 101 102 103 104 >> >> 1980 105 106 107 108 >> >> 1981 109 110 111 112 >> >> 1982 113 114 115 116 >> >> >> >> > >> >> Thank you, >> >> >> >> Miao >> >> >> >> >> > >> > [[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. >> > > [[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.