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 8227477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:08:23+00:00 2026-06-07T16:08:23+00:00

I did look in here: http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-Programming Wikipedia shows how to write an on the

  • 0

I did look in here: http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-Programming

Wikipedia shows how to write an on the fly R program: http://en.wikipedia.org/wiki/Hello_world_program_examples#R_2

But how to execute this from a file?
What extension needs to be given?
How to compile the file then?

on Linux.


I created a file mow.R containing the following code:
cat ('Hello world!')

R says:

> source mow.R
Error: unexpected symbol in "source mow.R"
  • 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-06-07T16:08:24+00:00Added an answer on June 7, 2026 at 4:08 pm

    I general you want to give your R files the .R extension.

    To run a program you can start R (by typing “R” at the command prompt) and once inside the program/interpreter, you can execute your program (let’s call it "so.R") with the source command. E.g.,

    > source('so.R')
    

    yields:

    Hello World 
    

    You can run the program from the Unix shell with

    R CMD BATCH so.R
    

    it will generate a file named "so.Rout" that will contain the output of your program run, especially if it contains non-trivial amounts of output. If there is a problem with the program run, the error messages etc will also be in this file so it’s a good diagnostic tool. An alternative is the Rscript command which sends its output to stdout, in which case if it’s long you need to capture it yourself.

    There is a very useful trick, when googling for R related topics it can be tricky because R is a single character. To be effective, pre-pend “r-help:” to your search terms. E.g.,

    r-help:Running a program

    Here are two manuals that might be useful/help you get started:

    • Introduction to R
    • Programming in R

    and also take a look at The R Manuals.

    More information/FAQs, etc., can be found at the R web site itself. I have found that there is a lot of information on R (esp tutorials etc), but it can be tricky to find them. The “r-help” google trick really helps with this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wanting to create a remote NuGet server. I've followed the instructions here: http://docs.nuget.org/docs/creating-packages/hosting-your-own-nuget-feeds
I want to make something like this: http://puu.sh/1b5jU So I did something here, but
First of, I'm fairly new to Qt. I did look for the answer but
First of all I did gave a look at this one. But I didn't
Did any one have luck recently register Visual studio 2008 express C# product? Look
Did some searches here & on the 'net and haven't found a good answer
I did look at all the suggestions which I could get my hand on
I am at my wits end here. I've been trying to look at all
here is the html code that is giving me problem in IE7 <div style=position:absolute;top:276px;left:194px;
website: http://www.telugumovieshub.com/ I followed this tutorial here (except for creating a child theme): http://50dollarblogs.net/wordpress-menus-support/

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.