Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4532044
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T13:58:47+00:00 2026-05-21T13:58:47+00:00

I have used R in the past to do very basic calls to the

  • 0

I have used R in the past to do very basic calls to the commmand line. The example can be found here.

This time around, I am looking to mimic this code which runs successfully from the command line in Windows:

> cd C:\Documents and Settings\BTIBERT\My Documents\My Dropbox\Eclipse\Projects\R\MLB\retrosheet\rawdata
> bgame -y 2010 2010bos.eva >2010bos.txt

This is the code I am trying to run inside of R. I have already set the working directory inside of R.

dir <- paste("cd", getwd(), sep=" ")
system(dir)
system("bgame -y 2010 2010bos.eva >2010bos.txt")

I am sure this is user error, but what am I doing wrong? It appears to work initially, but returns the following error. I very well could be doing something wrong, but I believe I am using the same commands.

Expanded game descriptor, version 109(185) of 05/08/2008.
  Type 'bgame -h' for help.
Copyright (c) 2001 by DiamondWare.
[Processing file 2010bos.eva.]
>2010bos.txt: can't open.
Warning message:
running command 'bgame -y 2010 2010bos.eva >2010bos.txt' had status 2 

Any help you can provide will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T13:58:48+00:00Added an answer on May 21, 2026 at 1:58 pm

    You need to issue all commands in one system() call:

    system(paste("cd",getwd() "&& bgame -y 2010 2010bos.eva >2010bos.txt",sep=" "))
    

    You should already be in your working directory, so I’m not sure the cd getwd() is necessary. And you may need quotes around your path because it contains spaces. The error may be resolved by putting spaces around >.

    If I were in your shoes, I would try this:

    system("bgame -y 2010 2010bos.eva > 2010bos.txt")
    

    UPDATE:

    And you should probably heed this advice in the “Differences between Unix and Windows” section of ?system that says you should use shell:

        • The most important difference is that on a Unix-alike
          ‘system’ launches a shell which then runs ‘command’.  On
          Windows the command is run directly - use ‘shell’ for an
          interface which runs ‘command’ _via_ a shell (by default the
          Windows shell ‘cmd.exe’, which has many differences from the
          POSIX shell).
    
          This means that it cannot be assumed that redirection or
          piping will work in ‘system’ (redirection sometimes does, but
          we have seen cases where it stopped working after a Windows
          security patch), and ‘system2’ (or ‘shell’) must be used on
          Windows.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Excuse my limited knoweldge here. In the past I have used Steve Sanderson's method
I have worked with Sql Server in past and used it's very nice feature
I've not used C++ very much in the past, and have recently been doing
There is this simple function which I have used with C++ in the past
In the past I have used MAPISendMail to launch Outlook (or whatever the desired
In the past I have used Managed Direct X and DirectShow.Net to play a
I have used JMS in the past to build application and it works great.
I have used Hibernate in the past and I share many people's frustration with
I have used valgrinds massif tool to monitor memory usage in the past. Does
I have used the code supplied in the following CodeProject article in the past

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.