Dear R help, I have a doubt regarding the write.csv function.? When I save a file (write.csv(res1,"res1.csv")), it is saving with the read-only permission.? I tried to change the permission as a root user with chmod u+x.? Though, it says that "-rwxr--r--? 1 root root???? 164 2012-05-27 10:18 res1.csv", when I open the file it is still read-only.? Is there any way to save the file with no restrictions on permission?? I use the R? console as a root user (sudo R). Thanking you, A.K.
Take a look at ?Sys.chmod -- I haven't used it myself, but it does seem to be what your looking for and, in particular, the default ("777") seems to be what you want. Michael On Sun, May 27, 2012 at 10:36 AM, arun <smartpink111 at yahoo.com> wrote:> Dear R help, > > I have a doubt regarding the write.csv function.? When I save a file (write.csv(res1,"res1.csv")), it is saving with the read-only permission.? I tried to change the permission as a root user with chmod u+x.? Though, it says that "-rwxr--r--? 1 root root???? 164 2012-05-27 10:18 res1.csv", when I open the file it is still read-only.? Is there any way to save the file with no restrictions on permission?? I use the R? console as a root user (sudo R). > > Thanking you, > A.K. > > ______________________________________________ > R-help at r-project.org mailing list > 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.
It is bad practice to do ANYTHING in R as the root user, except possibly install libraries. This is true for any real work in any application in general... root is only for installing software or modifying the system configuration. The very fact that you are doing analysis in R and saving results is part of your problem... files created by that user are by default not readable by other users. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. arun <smartpink111 at yahoo.com> wrote:>Dear R help, > >I have a doubt regarding the write.csv function.? When I save a file >(write.csv(res1,"res1.csv")), it is saving with the read-only >permission.? I tried to change the permission as a root user with chmod >u+x.? Though, it says that "-rwxr--r--? 1 root root???? 164 2012-05-27 >10:18 res1.csv", when I open the file it is still read-only.? Is there >any way to save the file with no restrictions on permission?? I use the >R? console as a root user (sudo R). > >Thanking you, >A.K. > >______________________________________________ >R-help at r-project.org mailing list >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.
Thanks Jeff,Michael for your replies. A.K. ----- Original Message ----- From: Jeff Newmiller <jdnewmil at dcn.davis.CA.us> To: arun <smartpink111 at yahoo.com>; R help <r-help at r-project.org> Cc: Sent: Sunday, May 27, 2012 3:34 PM Subject: Re: [R] write.csv permissions It is bad practice to do ANYTHING in R as the root user, except possibly install libraries.? This is true for any real work in any application in general... root is only for installing software or modifying the system configuration. The very fact that you are doing analysis in R and saving results is part of your problem... files created by that user are by default not readable by other users. --------------------------------------------------------------------------- Jeff Newmiller? ? ? ? ? ? ? ? ? ? ? ? The? ? .....? ? ? .....? Go Live... DCN:<jdnewmil at dcn.davis.ca.us>? ? ? ? Basics: ##.#.? ? ? ##.#.? Live Go... ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Live:? OO#.. Dead: OO#..? Playing Research Engineer (Solar/Batteries? ? ? ? ? ? O.O#.? ? ? #.O#.? with /Software/Embedded Controllers)? ? ? ? ? ? ? .OO#.? ? ? .OO#.? rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. arun <smartpink111 at yahoo.com> wrote:>Dear R help, > >I have a doubt regarding the write.csv function.? When I save a file >(write.csv(res1,"res1.csv")), it is saving with the read-only >permission.? I tried to change the permission as a root user with chmod >u+x.? Though, it says that "-rwxr--r--? 1 root root???? 164 2012-05-27 >10:18 res1.csv", when I open the file it is still read-only.? Is there >any way to save the file with no restrictions on permission?? I use the >R? console as a root user (sudo R). > >Thanking you, >A.K. > >______________________________________________ >R-help at r-project.org mailing list >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.