Hello, I have a quick question about the ?file=? specification for the command write.csv. When I run this command in Rstudio I do not need the ?file=? specified. For example the below command works just fine. write.csv(data,?/home/data.csv?) However when I am running an Rscript from the terminal and putting it in the background I need to specify ?file=?. So for the example above I need to instead have write.csv(data,file=?/home/data.csv?) Any ideas why this is the case? Writing file= isn?t a problem, just trying to get an idea of how R works better. Thanks!
write.csv file= question
8 messages · John Kane, Brittany Demmitt, Ista Zahn +2 more
You probably need to ask this on a RStudio forum but my guess is it is just a little 'refinement' that the RStudio people added. Similar in concept o the the matching "". John Kane Kingston ON Canada
-----Original Message----- From: demmitba at gmail.com Sent: Tue, 4 Aug 2015 08:51:24 -0600 To: r-help at r-project.org Subject: [R] write.csv file= question Hello, I have a quick question about the ?file=? specification for the command write.csv. When I run this command in Rstudio I do not need the ?file=? specified. For example the below command works just fine. write.csv(data,?/home/data.csv?) However when I am running an Rscript from the terminal and putting it in the background I need to specify ?file=?. So for the example above I need to instead have write.csv(data,file=?/home/data.csv?) Any ideas why this is the case? Writing file= isn?t a problem, just trying to get an idea of how R works better. Thanks!
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________ Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account.
Thanks!
On Aug 4, 2015, at 9:04 AM, John Kane <jrkrideau at inbox.com> wrote: You probably need to ask this on a RStudio forum but my guess is it is just a little 'refinement' that the RStudio people added. Similar in concept o the the matching "". John Kane Kingston ON Canada
-----Original Message----- From: demmitba at gmail.com Sent: Tue, 4 Aug 2015 08:51:24 -0600 To: r-help at r-project.org Subject: [R] write.csv file= question Hello, I have a quick question about the ?file=? specification for the command write.csv. When I run this command in Rstudio I do not need the ?file=? specified. For example the below command works just fine. write.csv(data,?/home/data.csv?) However when I am running an Rscript from the terminal and putting it in the background I need to specify ?file=?. So for the example above I need to instead have write.csv(data,file=?/home/data.csv?) Any ideas why this is the case? Writing file= isn?t a problem, just trying to get an idea of how R works better. Thanks!
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________ Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account. Check it out at http://mysecurelogon.com/password-manager
On Tue, Aug 4, 2015 at 11:04 AM, John Kane <jrkrideau at inbox.com> wrote:
You probably need to ask this on a RStudio forum but my guess is it is just a little 'refinement' that the RStudio people added. Similar in concept o the the matching "".
Really? write.csv(data,?/home/data.csv?) works for me in Rstudio, ESS, Terminal, Rscript etc.
John Kane Kingston ON Canada
-----Original Message----- From: demmitba at gmail.com Sent: Tue, 4 Aug 2015 08:51:24 -0600 To: r-help at r-project.org Subject: [R] write.csv file= question Hello, I have a quick question about the ?file=? specification for the command write.csv. When I run this command in Rstudio I do not need the ?file=? specified. For example the below command works just fine. write.csv(data,?/home/data.csv?) However when I am running an Rscript from the terminal and putting it in the background I need to specify ?file=?. So for the example above I need to instead have write.csv(data,file=?/home/data.csv?) Any ideas why this is the case? Writing file= isn?t a problem, just trying to get an idea of how R works better. Thanks!
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________ Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account. ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Call getwd() in both terminal and your RStudio environments and compare results Il 04/ago/2015 16:53, "Brittany Demmitt" <demmitba at gmail.com> ha scritto:
Hello, I have a quick question about the ?file=? specification for the command write.csv. When I run this command in Rstudio I do not need the ?file=? specified. For example the below command works just fine. write.csv(data,?/home/data.csv?) However when I am running an Rscript from the terminal and putting it in the background I need to specify ?file=?. So for the example above I need to instead have write.csv(data,file=?/home/data.csv?) Any ideas why this is the case? Writing file= isn?t a problem, just trying to get an idea of how R works better. Thanks!
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
I cannot reproduce your problem on a Windows 8 machine with R version 3.2.1. It is working fine for me without "file=" when I source() a script file from the console.
Open a script file and add the following commands:
test <- data.frame(x=rnorm(15, 10, 2), y=rnorm(15, 15, 3))
write.csv(test, "test.csv")
file.info("Test.csv")
Save it as test.R and then source it:
source("Test.R", echo=TRUE)
test <- data.frame(x=rnorm(15, 10, 2), y=rnorm(15, 15, 3))
write.csv(test, "test.csv")
file.info("Test.csv")
size isdir mode mtime ctime
Test.csv 600 FALSE 666 2015-08-04 10:13:23 2015-08-04 10:11:56
atime exe
Test.csv 2015-08-04 10:11:56 no
-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352
-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Brittany Demmitt
Sent: Tuesday, August 4, 2015 9:51 AM
To: r-help at r-project.org
Subject: [R] write.csv file= question
Hello,
I have a quick question about the ?file=? specification for the command write.csv. When I run this command in Rstudio I do not need the ?file=? specified. For example the below command works just fine.
write.csv(data,?/home/data.csv?)
However when I am running an Rscript from the terminal and putting it in the background I need to specify ?file=?. So for the example above I need to instead have
write.csv(data,file=?/home/data.csv?)
Any ideas why this is the case? Writing file= isn?t a problem, just trying to get an idea of how R works better.
Thanks!
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
On Tue, Aug 4, 2015 at 11:12 AM, Ista Zahn <istazahn at gmail.com> wrote:
On Tue, Aug 4, 2015 at 11:04 AM, John Kane <jrkrideau at inbox.com> wrote:
You probably need to ask this on a RStudio forum but my guess is it is just a little 'refinement' that the RStudio people added. Similar in concept o the the matching "".
Really? write.csv(data,?/home/data.csv?) works for me in Rstudio, ESS, Terminal, Rscript etc.
Well, actually I misspoke. I don't actually have permission to write to "/home" on my system. But write.csv(data, "~/data.csv") works.
John Kane Kingston ON Canada
-----Original Message----- From: demmitba at gmail.com Sent: Tue, 4 Aug 2015 08:51:24 -0600 To: r-help at r-project.org Subject: [R] write.csv file= question Hello, I have a quick question about the ?file=? specification for the command write.csv. When I run this command in Rstudio I do not need the ?file=? specified. For example the below command works just fine. write.csv(data,?/home/data.csv?) However when I am running an Rscript from the terminal and putting it in the background I need to specify ?file=?. So for the example above I need to instead have write.csv(data,file=?/home/data.csv?) Any ideas why this is the case? Writing file= isn?t a problem, just trying to get an idea of how R works better. Thanks!
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________ Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account. ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
The trial ?test? script worked, as well as adding getwd() to my current script also fixed the problem. So it seems ?file=? isn?t necessary after all to run from the terminal. Thanks everyone for your help! :-)
On Aug 4, 2015, at 9:20 AM, Ista Zahn <istazahn at gmail.com> wrote: On Tue, Aug 4, 2015 at 11:12 AM, Ista Zahn <istazahn at gmail.com> wrote:
On Tue, Aug 4, 2015 at 11:04 AM, John Kane <jrkrideau at inbox.com> wrote:
You probably need to ask this on a RStudio forum but my guess is it is just a little 'refinement' that the RStudio people added. Similar in concept o the the matching "".
Really? write.csv(data,?/home/data.csv?) works for me in Rstudio, ESS, Terminal, Rscript etc.
Well, actually I misspoke. I don't actually have permission to write to "/home" on my system. But write.csv(data, "~/data.csv") works.
John Kane Kingston ON Canada
-----Original Message----- From: demmitba at gmail.com Sent: Tue, 4 Aug 2015 08:51:24 -0600 To: r-help at r-project.org Subject: [R] write.csv file= question Hello, I have a quick question about the ?file=? specification for the command write.csv. When I run this command in Rstudio I do not need the ?file=? specified. For example the below command works just fine. write.csv(data,?/home/data.csv?) However when I am running an Rscript from the terminal and putting it in the background I need to specify ?file=?. So for the example above I need to instead have write.csv(data,file=?/home/data.csv?) Any ideas why this is the case? Writing file= isn?t a problem, just trying to get an idea of how R works better. Thanks!
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________ Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account. ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.