Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

Import xpd to R file

Hi,
I have some issues about import xpd file to R data file which is fine in csv extension. I have been tried many solutions but none of it works.

`Expyriment 0.9.0 (Python 2.7.14)

** Expyriment Data Preprocessor **
found 1 subject_data sets
found 7 variables: ['subject', 'blok', 'emotion_id', 'keypres', 'respon_ok', 'RT', 'accuracy']
reading Totally_New_01_01.xpd
write file: c:\users\user\appdata\local\temp\tmprkpkeo (105 cells in 15 rows)

Traceback (most recent call last):
File "C:\Users\USER\Documents\data_processing.py", line 12, in
delimiter=',',to_R_data_frame=True)
File "C:\Python27\lib\site-packages\expyriment\misc\data_preprocessing.py", line 198, in write_concatenated_data
.write_concatenated_data_to_R_data_frame(output_file=output_file)
File "C:\Python27\lib\site-packages\expyriment\misc\data_preprocessing.py", line 1066, in write_concatenated_data_to_R_data_frame
na.strings=c("NA", "None"))'''.format(tmp_file_name))
File "C:\Python27\lib\site-packages\rpy2\robjects__init__.py", line 320, in call
p = _rparse(text=StrSexpVector((string,)))
RRuntimeError: Error: '\u' used without hex digits in character string starting ""c:\u`

and this my data preprocessing syntax

`from expyriment.misc import data_preprocessing

folder = "C:/Users/USER/Documents/data"
data_preprocessing.write_concatenated_data(folder, 'Totally_New_01',
output_file='Adata',
delimiter=',',to_R_data_frame=True)`

I tried to change the backslash "\" with "/" and escape with "\" and change os.chdir for write file
Also, I've already installed the rpy2, but still doesn't work.
Thanks before.

Comments

  • fladdfladd Posts: 96

    This seems to be a bug. Thanks for reporting it.

    It is not entirely clear why this happens, as mkstemp on my machine does correctly return a string with escaped backslashes. We will look into it. In the meantime, could you give us some more information about your system? The output of expyriment.misc.get_system_info() would be helpful.

    Also, could you maybe let me know what the output of the following is on your machine:

    import tempfile
    print(tempfile.mkstemp())
    

    Florian Krause (Developer)
    http://www.expyriment.org

  • TantoTanto Posts: 7

    Thanks for the response and here some information about my machine. I hope this helpful.

    {'python_expyriment_build_date': 'Thu Mar 9 13:48:59 2017 +0100', 'python_version': '2.7.14', 'python_expyriment_revision': 'c4963ac', 'hardware_internet_connection': 'Yes', 'python_expyriment_version': '0.9.0', 'python_pyserial_version': '', 'hardware_memory_total': '4007 MB', 'os_platform': 'Windows', 'hardware_disk_space_free': '37758 MB', 'hardware_memory_free': '1671 MB', 'python_numpy_version': '1.14.0', 'os_version': '10.0.10240', 'hardware_disk_space_total': '76437 MB', 'hardware_video_card': 'Intel(R) HD Graphics', 'os_name': 'Windows', 'hardware_cpu_details': 'Intel(R) Celeron(R) CPU N3060 @ 1.60GHz', 'hardware_cpu_type': 'Intel64 Family 6 Model 76 Stepping 4, GenuineIntel', 'python_pyopengl_version': '3.1.0', 'python_pygame_version': '1.9.3', 'os_architecture': '64bit', 'hardware_cpu_architecture': 'AMD64', 'os_details': '', 'hardware_ports_parallel_driver': None, 'python_pyparallel_version': '', 'hardware_audio_card': '', 'hardware_ports_parallel': [], 'python_mediadecoder_version': '', 'os_release': '10', 'python_pil_version': '', 'hardware_ports_serial': [], 'settings_folder': None, 'python_sounddevice_version': ''}

    import tempfile
    print(tempfile.mkstemp())
    (3, 'c:\users\tanto\appdata\local\temp\tmp4hs1b6')

  • TantoTanto Posts: 7

    And Fladd why did not you make some tutorial Expyriment for beginner to advanced user. I think its very useful and I would like to join the course. Just my opinion :)

  • fladdfladd Posts: 96

    Mmh, I am still a bit puzzled about why this happens. We will look closer into it.

    Thanks for the suggestion of a tutorial for more advanced users. This is certainly a good idea.

    Florian Krause (Developer)
    http://www.expyriment.org

Sign In or Register to comment.