Export data to R

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

Dag Kolsrud
Posts: 5
Joined: Mon Jul 17, 2017 3:49 am

Export data to R

Postby Dag Kolsrud » Wed Feb 06, 2019 6:51 am

I want to use the prophet package in R from EViews. Exporting data I have problems getting rid of dates.
My EViews code is

smpl 2000 2018
xopen(type=r)
xput(rtype=data.frame, name=df) @strdate("mm/dd/yyyy") a55
xon 'Turn on external R programming mode
names(df)<-c("ds","y")
print(df)

which yield a data frame in R that starts like

ds y
2000Q1 1/1/2000 257.89279
2000Q2 4/1/2000 166.89793
2000Q3 7/1/2000 203.12648
2000Q4 10/1/2000 449.24030
2001Q1 1/1/2001 334.18130
2001Q2 4/1/2001 232.18542
:

The quarter entry first in the ds column (e.g. 2000q1) seems to stick with every EViews object.How can I avoid it or get rid of it?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12155
Joined: Tue Sep 16, 2008 5:38 pm

Re: Export data to R

Postby EViews Gareth » Wed Feb 06, 2019 8:32 am

From an EViews side, I don't think you can (other than not putting it as a data.frame). Within R you might be able to remove a column from a data.frame.
Follow us on Twitter @IHSEViews

mamo
Posts: 122
Joined: Wed Nov 07, 2012 9:11 am

Re: Export data to R

Postby mamo » Thu Feb 07, 2019 5:33 am

Hi,

"2000Q1" 2000Q2" ... you see in the output from the print command are just the row names of the R-dataframe and not one of the variables generated with the xput command.

Why would the row-names bother you?

A way to removing the row names from the R-data.frame would be inserting

Code: Select all

rownames(dfs)<-NULL

as the 2nd-but last line in your code.

Best, mamo


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 5 guests