I'm a master student and I'm having a course in statistics with the program STATISTICA. I am rather familiar with R and would like to stick to it. So I am planning to do the provided exercises in R. However the data to work with is in the format *.sta... is there a way to import such a file into R? Any workaround is also fine, as long as it doesn't compromise the data.
I actually found the same question 2 years ago here but there was no answer to it.
I'd be very happy for any suggestions!
Thanks
Lukas
If R does not support importing Statistica Spreadsheet files (.sta files), Statistica supports exporting data to .xlsx, .csv, and SPSS and SAS format files. I would think that one of those would be able to be handled by R natively.
If you enable Statistica-R integration through Statistica, a package called COMadaptR will be installed to R.
Once that is done, you have a couple of options:
You can run your R script inside of Statistica using the extensions (provided by Statistica) ActiveDataSet or Spreadsheet to access the Statistica spreadsheet as an R data frame.
You can create an R node in a workspace; connect the Statistica spreadsheet to the R node in the workspace; and then run your R script through the node. ActiveDataSet and Spreadsheet will be available in the R node context as well.
You could write a small R script (and use ActiveDataSet or Spreadsheet) and run it in Statistica; the R integration features will translate the Statistica spreadsheet to an R data frame. You could then in your script store it to disk and work with it later.
The COMadaptR package will allow you to interact with Statistica through COM from within R; you could use that approach to read data from the Statistica spreadsheet.
Hope this helps.
Related
I'm trying to use R as data source for Tableau.
Meaning - my script generates a data set and I'd like to run this script in Tableau to generate the data source instead of connecting to csv file.
This can be easily done by Power BI, yet don't see this kind of option in Tableau.
There's the option of using R script in calculations but that's only once data set is already loaded.
Is there a way or a workaround?
Thank you in advance,
Alex
I am trying to automate some of my tests in R to produce a static report in Excel. I have created a template in Excel which has a few charts and tables(sheet 1).
Now I run my R code to generate the data to fill in the same excel template file on Sheet 2.
I am using Openxlsx package to loadworkbook(excel template), next I overwrite data in sheet 2 by deleting the sheet and recreating it again with the new data so that the excel template has data for new test runs.
This runs without any error. But when I open my excel back the charts disappear with the !REF# error whereas as the tables are overwritten properly in the template(sheet1).
Has anyone come across such a scenario? The method I am using is a bit weird but can't think of any other alternative.
Thanks in advance!!
This definitely sounds weird. Something seems off, but I'm sorry I can't tell you what the issue may be. Anyway, I would say, just use R to generate the data and dump everything into Excel. Then, run some VBA in Excel to create the charts. I have no idea what your VBA skills are like, but I'm guessing it would be much easier to crate charts in Excel using VBA, rather than trying to do all of this with R.
Here are a few resources that you may find useful.
https://www.thespreadsheetguru.com/blog/2015/3/1/the-vba-coding-guide-for-excel-charts-graph
https://analysistabs.com/excel-vba/chart-examples-tutorials/
http://www.sthda.com/english/wiki/r-xlsx-package-a-quick-start-guide-to-manipulate-excel-files-in-r
Finally, you can learn a lot by recording Macros and hitting F8 to step-through the code to see how everything works.
I have to fetch data from Reuters and they provide an excel plugin for that. The problem is that my excel is crashing if I try to fetch too many variables at the same time. I was wondering whether I can do it from R via some excel connection.
In general I want to give the command to excel (from R), fetch data and get the data back in R for analysis. The process has to be repeated a number of times.
=TR("SCREEN(U(IN(Equity(active,public,primary))/*UNV:Public*/))",A1:K10,"PERIOD:FY2015 NULL:-- curn=USD RH=In CH=Fd",A6)
I get the variable name from (A1:K10) and then the output is stored from cell A6 onwards.
The answer https://stackoverflow.com/a/43222477/1389469 here points to RDCOMClient library but I am not able to run the macro from R as described there.
Another guide here https://cran.r-project.org/web/packages/excel.link/excel.link.pdf talks about how to read/write data from an open excel workbook but doesn't tell how to execute commands in excel from R.
I have some SPSS metadata files (*.mdd). However, I do not have SPSS installed on my computer and I do not know how to use SPSS. I want to open the files in either Stata, SAS, R or Excel. Stat-Transfer only allows for SAV and portable files to be converted, and I am not familiar with MySQL either. Any help is appreciated!
mdd files are produced by SPSS Data Collection, not by SPSS Statistics or Modeler. There is an OLEDB driver for these, but you would need to contact the new owner of Data Collection, UNICOM Systems, Inc., a Division of UNICOM Global, or unicomsi.com to see about availability. Of course, you would need an app that supports OLEDB.
To expand on what #JKP stated, .mdd files are really only useful if you're trying to import data collected by a SPSS data collection server, and it's in a non-flat file. I worked on a Data Collection Server for 3 years and the only time I needed an .mdd file in SPSS statistics was to import a file into SPSS statistics that was set up incorrectly on the server.
The script(s) languages used in the .mdd are proprietary, so there isn't much use for them ouside of either SPSS statistics or SPSS Data collection.
I have plenty of .rda and .RData files from R statistical packageand would like to read them into SAS. Is there an (easy) way to do this?
If you can get R installed, then you could execute R code within PROC IML (assuming your SAS installation is configured properly, which can be a problem), read the results into e.g. a R data.frame and get the results back as described in the SAS documentation examples. If you do not have the SAS/IML license but have R, write the output out from R into some format SAS reads easily (e.g. csv). If you cannot get R installed on your system, can someone else with R installed do that for you?
Otherwise, you may have to write a SAS program that can parse the RData format. However, that would be a measure of desperation. I believe you would find the documentation of the format here and some discussion of the not so clear documentation here (see also)