<commit_before>package nl.mpi.kinnate.export;

import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import nl.mpi.kinnate.SavePanel;
import nl.mpi.kinnate.ui.MainFrame;

/**
 *  Document   : ExportToR
 *  Created on : May 30, 2011, 2:30:34 PM
 *  Author     : <NAME>
 */
public class ExportToR {

    public void doExport(MainFrame mainFrame, SavePanel savePanel) {
        JFileChooser fc = new JFileChooser();
        fc.addChoosableFileFilter(new FileFilter() {

            @Override
            public boolean accept(File file) {
                if (file.isDirectory()) {
                    return true;
                }
                return (file.getName().toLowerCase().endsWith(".csv"));
            }

            @Override
            public String getDescription() {
                return "Data Frame (CSV)";
            }
        });

        int returnVal = fc.showSaveDialog(mainFrame);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
//            int tabIndex = Integer.valueOf(evt.getActionCommand());
//            savePanel.saveToFile(file);
        } else {
            // todo: warn user that no file selected and so cannot save
        }
    }
}<commit_msg>Started to add R and SPSS export functions.<commit_after>package nl.mpi.kinnate.export;

import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import nl.mpi.kinnate.SavePanel;
import nl.mpi.kinnate.ui.MainFrame;

/**
 *  Document   : ExportToR
 *  Created on : May 30, 2011, 2:30:34 PM
 *  Author     : <NAME>
 */
public class ExportToR {

    public void doExport(MainFrame mainFrame, SavePanel savePanel) {
        JFileChooser fc = new JFileChooser();
        fc.addChoosableFileFilter(new FileFilter() {

            @Override
            public boolean accept(File file) {
                if (file.isDirectory()) {
                    return true;
                }
                return (file.getName().toLowerCase().endsWith(".csv"));
            }

            @Override
            public String getDescription() {
                return "Data Frame (CSV)";
            }
        });

        int returnVal = fc.showSaveDialog(mainFrame);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
//            int tabIndex = Integer.valueOf(evt.getActionCommand());
//            savePanel.saveToFile(file);
        } else {
            // todo: warn user that no file selected and so cannot save
        }
    }
    // example usage:
//    install.packages()
//    pid	id	momid	dadid	sex	affected
//    24	1	0	0	1	1
//    24	2	0	0	2	1
//    24	3	1	2	1	2
//    24	4	0	0	2	2
//    24	5	3	4	1	3
//
//    dataFrame <- read.table("https://192.168.1.24/gallery/kinship-r.csv",header=T)
//    # url not required: dataFrame <- read.table(url("http://192.168.1.24/gallery/kinship-r.csv"),header=T)
//    dataFrame <- read.table("~/kinship-r.csv",header=T)
//    library(kinship)
//    attach(dataFrame)
//    pedigreeObj <- pedigree(id,momid,dadid,sex, affected)
//    plot(pedigreeObj)

}
{'fraction_non_alphanumeric': 0.12084783296425182, 'fraction_numerical': 0.023726668775703893, 'mean_word_length': 1.9774011299435028, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1364760', 'n_tokens_mistral': 1061, 'n_tokens_neox': 985, 'n_words': 227}