When I try to save a file, I get "Permission denied". Can someone let me know why this happens? I am running under Windows 7, Rstudio> save(TheResults,file="c:\\data")Error in gzfile(file, "wb") : cannot open the connection In addition: Warning message: In gzfile(file, "wb") : cannot open compressed file 'c:\data', probable reason 'Permission denied'> save(TheResults,file="c:/data")Error in gzfile(file, "wb") : cannot open the connection In addition: Warning message: In gzfile(file, "wb") : cannot open compressed file 'c:/data', probable reason 'Permission denied'> sessionInfo()R version 3.1.0 (2014-04-10) Platform: i386-w64-mingw32/i386 (32-bit)> library(rstudio) > versionInfo()$version [1] ?0.98.953? $mode [1] "desktop" Thank you John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Confidentiality Statement: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
On 31/12/2014 6:29 PM, John Sorkin wrote:> When I try to save a file, I get "Permission denied". > Can someone let me know why this happens? > > > I am running under Windows 7, Rstudio > > >> save(TheResults,file="c:\\data") > Error in gzfile(file, "wb") : cannot open the connection > In addition: Warning message: > In gzfile(file, "wb") : > cannot open compressed file 'c:\data', probable reason 'Permission > denied' > > >> save(TheResults,file="c:/data") > Error in gzfile(file, "wb") : cannot open the connection > In addition: Warning message: > In gzfile(file, "wb") : > cannot open compressed file 'c:/data', probable reason 'Permission > denied'Can you save to the file "c:\data" from within Notepad? (You may need the quotes to stop it from adding .txt on the end.) Duncan Murdoch
On Dec 31, 2014, at 3:29 PM, John Sorkin wrote:> When I try to save a file, I get "Permission denied".Because your OS does not allow you to save things there. Since you are specifying an absolute path, R is not using your working directory. You may want to read the help pages for: ?normalizePath ?getwd> Can someone let me know why this happens? > > > I am running under Windows 7, Rstudio > > >> save(TheResults,file="c:\\data") > Error in gzfile(file, "wb") : cannot open the connection > In addition: Warning message: > In gzfile(file, "wb") : > cannot open compressed file 'c:\data', probable reason 'Permission > denied' >Permissions are not available on your machine at the Windows equivalent of the "root". You should educate yourself about your operating system.> >> save(TheResults,file="c:/data") > Error in gzfile(file, "wb") : cannot open the connection > In addition: Warning message: > In gzfile(file, "wb") : > cannot open compressed file 'c:/data', probable reason 'Permission > denied' > > >> sessionInfo() > R version 3.1.0 (2014-04-10) > Platform: i386-w64-mingw32/i386 (32-bit) > >> library(rstudio) >> versionInfo() > $version > [1] ?0.98.953? > > $mode > [1] "desktop" > > > Thank you > John > > > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > snippedDavid Winsemius Alameda, CA, USA
Because the root directory is not a place for saving your files in. Put your files in your Documents directory. --------------------------------------------------------------------------- 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. On December 31, 2014 3:29:05 PM PST, John Sorkin <JSorkin at grecc.umaryland.edu> wrote:>When I try to save a file, I get "Permission denied". >Can someone let me know why this happens? > > >I am running under Windows 7, Rstudio > > >> save(TheResults,file="c:\\data") >Error in gzfile(file, "wb") : cannot open the connection >In addition: Warning message: >In gzfile(file, "wb") : > cannot open compressed file 'c:\data', probable reason 'Permission >denied' > > >> save(TheResults,file="c:/data") >Error in gzfile(file, "wb") : cannot open the connection >In addition: Warning message: >In gzfile(file, "wb") : > cannot open compressed file 'c:/data', probable reason 'Permission >denied' > > >> sessionInfo() >R version 3.1.0 (2014-04-10) >Platform: i386-w64-mingw32/i386 (32-bit) > >> library(rstudio) >> versionInfo() >$version >[1] ?0.98.953? > >$mode >[1] "desktop" > > >Thank you >John > > >John David Sorkin M.D., Ph.D. >Professor of Medicine >Chief, Biostatistics and Informatics >University of Maryland School of Medicine Division of Gerontology and >Geriatric Medicine >Baltimore VA Medical Center >10 North Greene Street >GRECC (BT/18/GR) >Baltimore, MD 21201-1524 >(Phone) 410-605-7119 >(Fax) 410-605-7913 (Please call phone number above prior to faxing) > > > > > >John David Sorkin M.D., Ph.D. >Professor of Medicine >Chief, Biostatistics and Informatics >University of Maryland School of Medicine Division of Gerontology and >Geriatric Medicine >Baltimore VA Medical Center >10 North Greene Street >GRECC (BT/18/GR) >Baltimore, MD 21201-1524 >(Phone) 410-605-7119 >(Fax) 410-605-7913 (Please call phone number above prior to faxing) > > >Confidentiality Statement: >This email message, including any attachments, is for t...{{dropped:12}}
David, I checked getwd() and tried to save to the directory. It did not work:> getwd()[1] "C:/Users/John/Documents"> save(TheResults,file="c:\\users\\john\\documents")Error in gzfile(file, "wb") : cannot open the connection In addition: Warning message: In gzfile(file, "wb") : cannot open compressed file 'c:\users\john\documents', probable reason 'Permission denied'>Any thoughts? Thanks, John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing)>>> David Winsemius <dwinsemius at comcast.net> 12/31/14 8:52 PM >>>On Dec 31, 2014, at 3:29 PM, John Sorkin wrote:> When I try to save a file, I get "Permission denied".Because your OS does not allow you to save things there. Since you are specifying an absolute path, R is not using your working directory. You may want to read the help pages for: ?normalizePath ?getwd> Can someone let me know why this happens? > > > I am running under Windows 7, Rstudio > > >> save(TheResults,file="c:\\data") > Error in gzfile(file, "wb") : cannot open the connection > In addition: Warning message: > In gzfile(file, "wb") : > cannot open compressed file 'c:\data', probable reason 'Permission > denied' >Permissions are not available on your machine at the Windows equivalent of the "root". You should educate yourself about your operating system.> >> save(TheResults,file="c:/data") > Error in gzfile(file, "wb") : cannot open the connection > In addition: Warning message: > In gzfile(file, "wb") : > cannot open compressed file 'c:/data', probable reason 'Permission > denied' > > >> sessionInfo() > R version 3.1.0 (2014-04-10) > Platform: i386-w64-mingw32/i386 (32-bit) > >> library(rstudio) >> versionInfo() > $version > [1] ?0.98.953? > > $mode > [1] "desktop" > > > Thank you > John > > > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > snippedDavid Winsemius Alameda, CA, USA Confidentiality Statement: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
On Wed, 31 Dec 2014 18:29:05 -0500 "John Sorkin" <JSorkin at grecc.umaryland.edu> wrote:> When I try to save a file, I get "Permission denied". > Can someone let me know why this happens? > > > I am running under Windows 7, Rstudio > > > > save(TheResults,file="c:\\data")You are explicitly attempting to place a file named "data" in your root directory. You lack privileges to write into the root directory, which action is the source of the "permission denied" message. Good practice is to use a directory in your user-space such as a subdirectory of Documents as indicated by Mr. Newmiller. Ideally you should use getwd() and setwd() locate and set the directory where your data and any saved files are placed. If you are using are RStudio, it is relatively simple do this under the "Session/Set Working Directory" menu choices. JWDougherty