Load R data files

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Load R data files

AbouEl-Makarim Aboueissa-3
Dear All:

I am trying to load an R data set, but I got the following message. Please
see below. The file is there.

setwd("F:/Fall_2017/5-STA574/2-Notes/1-R/1-R_new/chapter4-Entering_Data")

datahs0csv <- read.table("hs0.csv", header=T, sep=",")
attach(datahs0csv)

detach(datahs0csv)
rm(list=ls())

Then I tried to reload the data, but I got this error message. I am not
sure what was wrong.

*> load("datahs0csv.rda")*

Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
  cannot open compressed file 'datahs0csv.rda', probable reason 'No such
file or directory'


Any help will be appreciated.


with thanks
abou

______________________
AbouEl-Makarim Aboueissa, PhD
Professor of Statistics
Department of Mathematics and Statistics
University of Southern Maine

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Load R data files

Ulrik Stervbo-2
Hi Abou,

You haven't saved the datahs0csv.

When you are done manipulating datahs0csv you can use save(datahs0csv, file
= 'datahs0csv.rda'). Then you should be able to load the data.
HTH
Ulrik

On Tue, 12 Sep 2017, 20:46 AbouEl-Makarim Aboueissa <
[hidden email]> wrote:

> Dear All:
>
> I am trying to load an R data set, but I got the following message. Please
> see below. The file is there.
>
> setwd("F:/Fall_2017/5-STA574/2-Notes/1-R/1-R_new/chapter4-Entering_Data")
>
> datahs0csv <- read.table("hs0.csv", header=T, sep=",")
> attach(datahs0csv)
>
> detach(datahs0csv)
> rm(list=ls())
>
> Then I tried to reload the data, but I got this error message. I am not
> sure what was wrong.
>
> *> load("datahs0csv.rda")*
>
> Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
> In addition: Warning message:
> In readChar(con, 5L, useBytes = TRUE) :
>   cannot open compressed file 'datahs0csv.rda', probable reason 'No such
> file or directory'
>
>
> Any help will be appreciated.
>
>
> with thanks
> abou
>
> ______________________
> AbouEl-Makarim Aboueissa, PhD
> Professor of Statistics
> Department of Mathematics and Statistics
> University of Southern Maine
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Load R data files

Rui Barradas
In reply to this post by AbouEl-Makarim Aboueissa-3
Hello,

What makes you think that there is a file named "datahs0csv.rda"? You  
have not saved the file, in fact you have done nothing at all.
If you want to create a file "datahs0csv.rda", use ?save.
(And don't use 'attach', please.)

Hope this helps,

Rui Barradas


Citando AbouEl-Makarim Aboueissa <[hidden email]>:

> Dear All:
>
> I am trying to load an R data set, but I got the following message. Please
> see below. The file is there.
>
> setwd("F:/Fall_2017/5-STA574/2-Notes/1-R/1-R_new/chapter4-Entering_Data")
>
> datahs0csv <- read.table("hs0.csv", header=T, sep=",")
> attach(datahs0csv)
>
> detach(datahs0csv)
> rm(list=ls())
>
> Then I tried to reload the data, but I got this error message. I am not
> sure what was wrong.
>
> *> load("datahs0csv.rda")*
>
> Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
> In addition: Warning message:
> In readChar(con, 5L, useBytes = TRUE) :
>   cannot open compressed file 'datahs0csv.rda', probable reason 'No such
> file or directory'
>
>
> Any help will be appreciated.
>
>
> with thanks
> abou
>
> ______________________
> AbouEl-Makarim Aboueissa, PhD
> Professor of Statistics
> Department of Mathematics and Statistics
> University of Southern Maine
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Load R data files

AbouEl-Makarim Aboueissa-3
In reply to this post by Ulrik Stervbo-2
Dear All:


It was saved, but there was a space somewhere. So it works for me now.

I do have another similar problem.

I saved an R data file


save(datahs0csv,file="
F:\Fall_2017\5-STA574\2-Notes\1-R\1-R_new\chapter4-Entering_Data/datahs0csv2
.rda")

*The new R data file "*datahs0csv2.rda*" is in the directory.*

I tried to load the file "" to R, but I got an error message. Please see
below.

>
*load(file="F:/Fall_2017/5-STA574/2-Notes/1-R/1-R_new/chapter4-Entering_Data/datahs0csv2.rda")*
>
It seems for me that the file was loaded to R. But when I typed the data
name, it says that the not found.

> *datahs0csv2*

*Error: object 'datahs0csv2' not found*


with many thanks
abou

On Tue, Sep 12, 2017 at 2:53 PM, Ulrik Stervbo <[hidden email]>
wrote:

> Hi Abou,
>
> You haven't saved the datahs0csv.
>
> When you are done manipulating datahs0csv you can use save(datahs0csv,
> file = 'datahs0csv.rda'). Then you should be able to load the data.
> HTH
> Ulrik
>
> On Tue, 12 Sep 2017, 20:46 AbouEl-Makarim Aboueissa <
> [hidden email]> wrote:
>
>> Dear All:
>>
>> I am trying to load an R data set, but I got the following message. Please
>> see below. The file is there.
>>
>> setwd("F:/Fall_2017/5-STA574/2-Notes/1-R/1-R_new/chapter4-Entering_Data")
>>
>> datahs0csv <- read.table("hs0.csv", header=T, sep=",")
>> attach(datahs0csv)
>>
>> detach(datahs0csv)
>> rm(list=ls())
>>
>> Then I tried to reload the data, but I got this error message. I am not
>> sure what was wrong.
>>
>> *> load("datahs0csv.rda")*
>>
>> Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
>> In addition: Warning message:
>> In readChar(con, 5L, useBytes = TRUE) :
>>   cannot open compressed file 'datahs0csv.rda', probable reason 'No such
>> file or directory'
>>
>>
>> Any help will be appreciated.
>>
>>
>> with thanks
>> abou
>>
>> ______________________
>> AbouEl-Makarim Aboueissa, PhD
>> Professor of Statistics
>> Department of Mathematics and Statistics
>> University of Southern Maine
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] 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.
>>
>


--
______________________
AbouEl-Makarim Aboueissa, PhD
Department of Mathematics and Statistics
University of Southern Maine

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Load R data files

Ulrik Stervbo-2
The object you load has the same name as the object you saved. In this case
datahs0csv and not the name of the file sans .rda

On Di., 12. Sep. 2017, 21:26 AbouEl-Makarim Aboueissa <
[hidden email]> wrote:

> Dear All:
>
>
> It was saved, but there was a space somewhere. So it works for me now.
>
> I do have another similar problem.
>
> I saved an R data file
>
>
> save(datahs0csv,file="
> F:\Fall_2017\5-STA574\2-Notes\1-R\1-R_new\chapter4-Entering_Data/
> datahs0csv2.rda")
>
> *The new R data file "*datahs0csv2.rda*" is in the directory.*
>
> I tried to load the file "" to R, but I got an error message. Please see
> below.
>
> >
> *load(file="F:/Fall_2017/5-STA574/2-Notes/1-R/1-R_new/chapter4-Entering_Data/datahs0csv2.rda")*
> >
> It seems for me that the file was loaded to R. But when I typed the data
> name, it says that the not found.
>
> > *datahs0csv2*
>
> *Error: object 'datahs0csv2' not found*
>
>
> with many thanks
> abou
>
> On Tue, Sep 12, 2017 at 2:53 PM, Ulrik Stervbo <[hidden email]>
> wrote:
>
>> Hi Abou,
>>
>> You haven't saved the datahs0csv.
>>
>> When you are done manipulating datahs0csv you can use save(datahs0csv,
>> file = 'datahs0csv.rda'). Then you should be able to load the data.
>> HTH
>> Ulrik
>>
>> On Tue, 12 Sep 2017, 20:46 AbouEl-Makarim Aboueissa <
>> [hidden email]> wrote:
>>
>>> Dear All:
>>>
>>> I am trying to load an R data set, but I got the following message.
>>> Please
>>> see below. The file is there.
>>>
>>> setwd("F:/Fall_2017/5-STA574/2-Notes/1-R/1-R_new/chapter4-Entering_Data")
>>>
>>> datahs0csv <- read.table("hs0.csv", header=T, sep=",")
>>> attach(datahs0csv)
>>>
>>> detach(datahs0csv)
>>> rm(list=ls())
>>>
>>> Then I tried to reload the data, but I got this error message. I am not
>>> sure what was wrong.
>>>
>>> *> load("datahs0csv.rda")*
>>>
>>> Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
>>> In addition: Warning message:
>>> In readChar(con, 5L, useBytes = TRUE) :
>>>   cannot open compressed file 'datahs0csv.rda', probable reason 'No such
>>> file or directory'
>>>
>>>
>>> Any help will be appreciated.
>>>
>>>
>>> with thanks
>>> abou
>>>
>>> ______________________
>>> AbouEl-Makarim Aboueissa, PhD
>>> Professor of Statistics
>>> Department of Mathematics and Statistics
>>> University of Southern Maine
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] 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.
>>>
>>
>
>
> --
> ______________________
> AbouEl-Makarim Aboueissa, PhD
> Department of Mathematics and Statistics
> University of Southern Maine
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Load R data files

AbouEl-Makarim Aboueissa-3
Dear Ulrik:

thank you very much

abou


On Tue, Sep 12, 2017 at 3:34 PM, Ulrik Stervbo <[hidden email]>
wrote:

> The object you load has the same name as the object you saved. In this
> case datahs0csv and not the name of the file sans .rda
>
> On Di., 12. Sep. 2017, 21:26 AbouEl-Makarim Aboueissa <
> [hidden email]> wrote:
>
>> Dear All:
>>
>>
>> It was saved, but there was a space somewhere. So it works for me now.
>>
>> I do have another similar problem.
>>
>> I saved an R data file
>>
>>
>> save(datahs0csv,file=" F:\Fall_2017\5-STA574\2-Notes\
>> 1-R\1-R_new\chapter4-Entering_Data/datahs0csv2.rda")
>>
>> *The new R data file "*datahs0csv2.rda*" is in the directory.*
>>
>> I tried to load the file "" to R, but I got an error message. Please see
>> below.
>>
>> >
>> *load(file="F:/Fall_2017/5-STA574/2-Notes/1-R/1-R_new/chapter4-Entering_Data/datahs0csv2.rda")*
>> >
>> It seems for me that the file was loaded to R. But when I typed the data
>> name, it says that the not found.
>>
>> > *datahs0csv2*
>>
>> *Error: object 'datahs0csv2' not found*
>>
>>
>> with many thanks
>> abou
>>
>> On Tue, Sep 12, 2017 at 2:53 PM, Ulrik Stervbo <[hidden email]>
>> wrote:
>>
>>> Hi Abou,
>>>
>>> You haven't saved the datahs0csv.
>>>
>>> When you are done manipulating datahs0csv you can use save(datahs0csv,
>>> file = 'datahs0csv.rda'). Then you should be able to load the data.
>>> HTH
>>> Ulrik
>>>
>>> On Tue, 12 Sep 2017, 20:46 AbouEl-Makarim Aboueissa <
>>> [hidden email]> wrote:
>>>
>>>> Dear All:
>>>>
>>>> I am trying to load an R data set, but I got the following message.
>>>> Please
>>>> see below. The file is there.
>>>>
>>>> setwd("F:/Fall_2017/5-STA574/2-Notes/1-R/1-R_new/chapter4-
>>>> Entering_Data")
>>>>
>>>> datahs0csv <- read.table("hs0.csv", header=T, sep=",")
>>>> attach(datahs0csv)
>>>>
>>>> detach(datahs0csv)
>>>> rm(list=ls())
>>>>
>>>> Then I tried to reload the data, but I got this error message. I am not
>>>> sure what was wrong.
>>>>
>>>> *> load("datahs0csv.rda")*
>>>>
>>>> Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
>>>> In addition: Warning message:
>>>> In readChar(con, 5L, useBytes = TRUE) :
>>>>   cannot open compressed file 'datahs0csv.rda', probable reason 'No such
>>>> file or directory'
>>>>
>>>>
>>>> Any help will be appreciated.
>>>>
>>>>
>>>> with thanks
>>>> abou
>>>>
>>>> ______________________
>>>> AbouEl-Makarim Aboueissa, PhD
>>>> Professor of Statistics
>>>> Department of Mathematics and Statistics
>>>> University of Southern Maine
>>>>
>>>>         [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> [hidden email] 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.
>>>>
>>>
>>
>>
>> --
>> ______________________
>> AbouEl-Makarim Aboueissa, PhD
>> Department of Mathematics and Statistics
>> University of Southern Maine
>>
>


--
______________________
AbouEl-Makarim Aboueissa, PhD
Department of Mathematics and Statistics
University of Southern Maine

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.