[R] Loading aliased file in MacOSX

2019-09-11 Thread Marc Girondot via R-help
If I try to load data from an alias file made using Cmd+Ctrl+A in finder 
for MacOSX, I get an error. Symbolic links are working well but 
sometimes, it is easier to use finder rather than terminal.


Has someone a solution to help R to read the original aliased file ?

Thanks

Here is a reproducible example:

A <- 10
save(A, file="A.Rdata")
rm(A)

# Make hard link
system(paste("ln A.Rdata B.Rdata"))
load(file="B.Rdata")
# It works
print(A)

rm(A)

# Make symbolic link
system(paste("ln -s A.Rdata C.Rdata"))
load(file="C.Rdata")
# It works
print(A)

rm(A)

# Make an alias of the A.Rdata file in finder using Cmd+Ctrl+A; the name 
of the new file is "A.Rdata alias"

load(file="A.Rdata alias")

It failed with this error:

Error in load(file = "A.Rdata alias") :
?? mauvais num??ro magique de restauration de fichier (le fichier est 
peut ??tre corrompu) -- aucune donn??e charg??e

De plus : Warning message:
?? file ???A.Rdata alias??? has magic number 'book'
Use of save versions prior to 2 is deprecated

__
R-help@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.


Re: [R] Loading large tar.gz XenaHub Data into R

2019-08-01 Thread Spencer Brackett
Thank you both for your advice! The z <- readLines(gzcon(url("
https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz;)),
) command worked out nicely

On Thu, Aug 1, 2019 at 6:47 PM William Dunlap  wrote:

> By the way, instead of saying only that there were warnings, it would be
> nice to show some of them.  E.g.,
> > z <- readLines("
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
> ")
> [ Hit control-C or Esc to interrupt, or wait a long time ]
> There were 50 or more warnings (use warnings() to see the first 50)
> > warnings()
> Warning messages:
> 1: In readLines("
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz;)
> :
>   line 1 appears to contain an embedded nul
> 2: In readLines("
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz;)
> :
>   line 4 appears to contain an embedded nul
> 3: In readLines("
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz;)
> :
>   line 7 appears to contain an embedded nul
>
> Burt's guess looks right, as the following gives 10 long lines of
> reasonable-looking data.  Remove the 'n=10' to get all of it.
>
> z <- readLines(gzcon(url("
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz;)),
> n=10)
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
>
> On Thu, Aug 1, 2019 at 3:37 PM Bert Gunter  wrote:
>
>> These are gzipped files, I assume. So see ?gzfile and associated info
>> for how to open a gzip connection and read from it. You may also
>> prefer to search (e.g. at rseek.org) on "read a gzipped file" or
>> similar for possible alternatives.
>>
>> Of course, if they're not gzipped files, then ignore the above. If
>> they are, your current approach is hopeless.
>>
>>
>> Cheers,
>> Bert
>>
>> On Thu, Aug 1, 2019 at 3:13 PM Spencer Brackett
>>  wrote:
>> >
>> > Good evening,
>> >
>> > I am attempting to load the following Xena dataset
>> >
>> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
>> >
>> > I am trying to unpack the dataset and read it into R as a table, but
>> due to
>> > the size of the file, I am having some trouble. The following are the
>> > commands I have tried thus far.
>> >
>> > HumanMethylation450 <- fread("
>> >
>> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
>> > ")
>> >
>> > readLines("
>> >
>> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
>> > ")
>> >
>> >  ###These two above attempts failed with warning
>> messages
>> > from R###
>> >
>> > Methyl <-read.delim("
>> >
>> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
>> > ")
>> >
>> >##This attempt is still processing, but has been doing so
>> > for quite some time##
>> >
>> > Any ideas as to what else I could try?
>> >
>> > Best,
>> >
>> > Spencer
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > __
>> > R-help@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.
>>
>> __
>> R-help@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.
>>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading large tar.gz XenaHub Data into R

2019-08-01 Thread William Dunlap via R-help
By the way, instead of saying only that there were warnings, it would be
nice to show some of them.  E.g.,
> z <- readLines("
https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
")
[ Hit control-C or Esc to interrupt, or wait a long time ]
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In readLines("
https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz;)
:
  line 1 appears to contain an embedded nul
2: In readLines("
https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz;)
:
  line 4 appears to contain an embedded nul
3: In readLines("
https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz;)
:
  line 7 appears to contain an embedded nul

Burt's guess looks right, as the following gives 10 long lines of
reasonable-looking data.  Remove the 'n=10' to get all of it.

z <- readLines(gzcon(url("
https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz;)),
n=10)

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Thu, Aug 1, 2019 at 3:37 PM Bert Gunter  wrote:

> These are gzipped files, I assume. So see ?gzfile and associated info
> for how to open a gzip connection and read from it. You may also
> prefer to search (e.g. at rseek.org) on "read a gzipped file" or
> similar for possible alternatives.
>
> Of course, if they're not gzipped files, then ignore the above. If
> they are, your current approach is hopeless.
>
>
> Cheers,
> Bert
>
> On Thu, Aug 1, 2019 at 3:13 PM Spencer Brackett
>  wrote:
> >
> > Good evening,
> >
> > I am attempting to load the following Xena dataset
> >
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
> >
> > I am trying to unpack the dataset and read it into R as a table, but due
> to
> > the size of the file, I am having some trouble. The following are the
> > commands I have tried thus far.
> >
> > HumanMethylation450 <- fread("
> >
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
> > ")
> >
> > readLines("
> >
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
> > ")
> >
> >  ###These two above attempts failed with warning messages
> > from R###
> >
> > Methyl <-read.delim("
> >
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
> > ")
> >
> >##This attempt is still processing, but has been doing so
> > for quite some time##
> >
> > Any ideas as to what else I could try?
> >
> > Best,
> >
> > Spencer
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@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.
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading large tar.gz XenaHub Data into R

2019-08-01 Thread Bert Gunter
These are gzipped files, I assume. So see ?gzfile and associated info
for how to open a gzip connection and read from it. You may also
prefer to search (e.g. at rseek.org) on "read a gzipped file" or
similar for possible alternatives.

Of course, if they're not gzipped files, then ignore the above. If
they are, your current approach is hopeless.


Cheers,
Bert

On Thu, Aug 1, 2019 at 3:13 PM Spencer Brackett
 wrote:
>
> Good evening,
>
> I am attempting to load the following Xena dataset
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
>
> I am trying to unpack the dataset and read it into R as a table, but due to
> the size of the file, I am having some trouble. The following are the
> commands I have tried thus far.
>
> HumanMethylation450 <- fread("
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
> ")
>
> readLines("
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
> ")
>
>  ###These two above attempts failed with warning messages
> from R###
>
> Methyl <-read.delim("
> https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
> ")
>
>##This attempt is still processing, but has been doing so
> for quite some time##
>
> Any ideas as to what else I could try?
>
> Best,
>
> Spencer
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.

__
R-help@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.


[R] Loading large tar.gz XenaHub Data into R

2019-08-01 Thread Spencer Brackett
Good evening,

I am attempting to load the following Xena dataset
https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz

I am trying to unpack the dataset and read it into R as a table, but due to
the size of the file, I am having some trouble. The following are the
commands I have tried thus far.

HumanMethylation450 <- fread("
https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
")

readLines("
https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
")

 ###These two above attempts failed with warning messages
from R###

Methyl <-read.delim("
https://tcga.xenahubs.net/download/TCGA.GBMLGG.sampleMap/HumanMethylation450.gz
")

   ##This attempt is still processing, but has been doing so
for quite some time##

Any ideas as to what else I could try?

Best,

Spencer

[[alternative HTML version deleted]]

__
R-help@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.


[R] Loading EDF files

2019-05-03 Thread Marcelo Mariano Silva
Dear All,

I have tried to load an EDF file using the code below and I received the
following massage :

Error in signals[[sn]]$signal[nextInCSignal[sn]:lastOne] <- samples[[sn]] :

replacement has length zero

What this massage means?
Is there any problem with the EDF file?

Code used:
hdr <- readEdfHeader("/lasse/neurobit/edf/medidas/g1/G1medida1.edf");


df_id1 <- readEdfSignals(hdr, signals = "All", from = 0, till = Inf,
physical = TRUE, fragments = TRUE, recordStarts = TRUE, mergeASignals =
TRUE, simplify = TRUE);


Any help would be highly appreciated.


Mariano


>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading EDF files

2019-05-03 Thread Bert Gunter
Try samples[["sn"]] ?


On Fri, May 3, 2019, 9:53 AM Eric Berger  wrote:

> Hi Mariano,
> The problem appears to be that samples[[sn]] has zero length (or is NULL).
> Consider the following code which gives the same error message.
>
> x <- 1:10
> x[1:5] <- as.numeric(NULL)
> Error in x[1:5] <- as.numeric(NULL) : replacement has length zero
>
> HTH,
> Eric
>
> On Fri, May 3, 2019 at 4:32 PM Marcelo Mariano Silva <
> marcelomarianosi...@gmail.com> wrote:
>
> > Dear All,
> >
> > I have tried to load an EDF file using the code below and I received the
> > following massage :
> >
> > Error in signals[[sn]]$signal[nextInCSignal[sn]:lastOne] <-
> samples[[sn]] :
> >
> > replacement has length zero
> >
> > What this massage means?
> > Is there any problem with the EDF file?
> >
> > Code used:
> > hdr <- readEdfHeader("/lasse/neurobit/edf/medidas/g1/G1medida1.edf");
> >
> >
> > df_id1 <- readEdfSignals(hdr, signals = "All", from = 0, till = Inf,
> > physical = TRUE, fragments = TRUE, recordStarts = TRUE, mergeASignals =
> > TRUE, simplify = TRUE);
> >
> >
> > Any help would be highly appreciated.
> >
> >
> > Mariano
> >
> >
> > >
> > >
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@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.
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading EDF files

2019-05-03 Thread Eric Berger
Hi Mariano,
The problem appears to be that samples[[sn]] has zero length (or is NULL).
Consider the following code which gives the same error message.

x <- 1:10
x[1:5] <- as.numeric(NULL)
Error in x[1:5] <- as.numeric(NULL) : replacement has length zero

HTH,
Eric

On Fri, May 3, 2019 at 4:32 PM Marcelo Mariano Silva <
marcelomarianosi...@gmail.com> wrote:

> Dear All,
>
> I have tried to load an EDF file using the code below and I received the
> following massage :
>
> Error in signals[[sn]]$signal[nextInCSignal[sn]:lastOne] <- samples[[sn]] :
>
> replacement has length zero
>
> What this massage means?
> Is there any problem with the EDF file?
>
> Code used:
> hdr <- readEdfHeader("/lasse/neurobit/edf/medidas/g1/G1medida1.edf");
>
>
> df_id1 <- readEdfSignals(hdr, signals = "All", from = 0, till = Inf,
> physical = TRUE, fragments = TRUE, recordStarts = TRUE, mergeASignals =
> TRUE, simplify = TRUE);
>
>
> Any help would be highly appreciated.
>
>
> Mariano
>
>
> >
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


[R] Loading EDF files

2019-05-03 Thread Marcelo Mariano Silva
Dear All,

I have tried to load an EDF file using the code below and I received the
following massage :

Error in signals[[sn]]$signal[nextInCSignal[sn]:lastOne] <- samples[[sn]] :

replacement has length zero

What this massage means?
Is there any problem with the EDF file?

Code used:
hdr <- readEdfHeader("/lasse/neurobit/edf/medidas/g1/G1medida1.edf");


df_id1 <- readEdfSignals(hdr, signals = "All", from = 0, till = Inf,
physical = TRUE, fragments = TRUE, recordStarts = TRUE, mergeASignals =
TRUE, simplify = TRUE);


Any help would be highly appreciated.


Mariano


>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] loading the xlsx library

2019-01-14 Thread William Michels via R-help
Hello Bernard,

You might consider using the "readxl" package, which (from the package
description), "Works on Windows, Mac and Linux without external
dependencies."

 https://CRAN.R-project.org/package=readxl

HTH, Bill.

William Michels, Ph.D.

__
R-help@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.


Re: [R] loading the xlsx library

2019-01-11 Thread Rui Barradas

Hello,

Also, sometimes it's about R/Java versions. If you have Java 32 bits you 
need R 32 bits. And the same for 64b.


Hope this helps,

Rui Barradas

Às 20:37 de 11/01/2019, Jeff Newmiller escreveu:

Failure to read the installation notes for the package. You have to get Java 
working on your computer.

https://cran.r-project.org/web/packages/xlsx/index.html

On January 11, 2019 10:40:44 AM PST, Bernard McGarvey 
 wrote:

When I load the library xlsx with the command


library("xlsx")


I get the error message:



library("xlsx")

Error: package or namespace load failed for ‘xlsx’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry





Does anyone have any idea what the issue is?


Thanks


Lion Bernard McGarvey

Director, Fort Myers Beach Lions Foundation, Inc.

Retired (Lilly Engineering Fellow).



[[alternative HTML version deleted]]

__
R-help@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.




__
R-help@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.


Re: [R] loading the xlsx library

2019-01-11 Thread Jeff Newmiller
Failure to read the installation notes for the package. You have to get Java 
working on your computer.

https://cran.r-project.org/web/packages/xlsx/index.html

On January 11, 2019 10:40:44 AM PST, Bernard McGarvey 
 wrote:
>When I load the library xlsx with the command
>
>
>library("xlsx")
>
>
>I get the error message:
>
>
>> library("xlsx")
>Error: package or namespace load failed for ‘xlsx’:
>.onLoad failed in loadNamespace() for 'rJava', details:
>call: fun(libname, pkgname)
>error: JAVA_HOME cannot be determined from the Registry
>>
>
>
>Does anyone have any idea what the issue is?
>
>
>Thanks
>
>
>Lion Bernard McGarvey
>
>Director, Fort Myers Beach Lions Foundation, Inc.
>
>Retired (Lilly Engineering Fellow).
>
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@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.

-- 
Sent from my phone. Please excuse my brevity.

__
R-help@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.


[R] loading the xlsx library

2019-01-11 Thread Bernard McGarvey
When I load the library xlsx with the command


library("xlsx")


I get the error message:


> library("xlsx")
Error: package or namespace load failed for ‘xlsx’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
>


Does anyone have any idea what the issue is?


Thanks


Lion Bernard McGarvey

Director, Fort Myers Beach Lions Foundation, Inc.

Retired (Lilly Engineering Fellow).



[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading Rcmdr

2017-07-25 Thread Fox, John
Dear Jack,

There's not enough information here to know what the problem might be. Please 
see < https://www.r-project.org/help.html>, in particular the section on asking 
for help, and follow the link to the posting guide.

At a minimum, explain what you did and what happened. It's generally 
informative to provide the results of Sys.info() and sessionInfo() .

Best,
 John

-
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
Web: socserv.mcmaster.ca/jfox



> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jack Talley
> Sent: Monday, July 24, 2017 7:17 PM
> To: r-help@r-project.org
> Subject: [R] Loading Rcmdr
> 
> With the lastest version of R 3.4.1 I have not been able to loard Rcmdr.
> Advice please.
> 
> Thank you,
> 
> Jack Talley, PhD
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] Loading Rcmdr

2017-07-24 Thread Jeff Newmiller
I don't know anything about Rcmdr, but perhaps you are forgetting or never knew 
that each x.y minor version starts a new package library,  so any packages you 
had installed in the preceding minor version have to be reinstalled.
-- 
Sent from my phone. Please excuse my brevity.

On July 24, 2017 4:17:03 PM PDT, Jack Talley  wrote:
>With the lastest version of R 3.4.1 I have not been able to loard
>Rcmdr.
>Advice please.
>
>Thank you,
>
>Jack Talley, PhD
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@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.

__
R-help@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.


Re: [R] Loading Rcmdr

2017-07-24 Thread Mark Sharp
Jack,

I do not use Rcmdr, but I installed the binary package version 2.3-2. It came 
right up when I then ran the following at the prompt (console output is 
appended without edits):
> sessionInfo();library("Rcmdr");sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: 
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: 
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.4.1
Loading required package: splines
Loading required package: RcmdrMisc
Loading required package: car
Loading required package: sandwich

Rcmdr Version 2.3-2

R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: 
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: 
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] splines   stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] Rcmdr_2.3-2 RcmdrMisc_1.0-5 sandwich_2.3-4  car_2.1-5

loaded via a namespace (and not attached):
 [1] zoo_1.8-0   lattice_0.20-35 tcltk_3.4.1 
colorspace_1.3-2
 [5] htmltools_0.3.6 mgcv_1.8-17 base64enc_0.1-3 relimp_1.0-5
 [9] survival_2.41-3 rlang_0.1.1.9000e1071_1.6-8 nloptr_1.0.4
[13] foreign_0.8-69  RColorBrewer_1.1-2  readxl_1.0.0plyr_1.8.4
[17] stringr_1.2.0   MatrixModels_0.4-1  cellranger_1.1.0munsell_0.4.3
[21] gtable_0.2.0htmlwidgets_0.9 latticeExtra_0.6-28 knitr_1.16
[25] SparseM_1.77class_7.3-14quantreg_5.33   pbkrtest_0.4-7
[29] parallel_3.4.1  htmlTable_1.9   Rcpp_0.12.12acepack_1.4.1
[33] tcltk2_1.2-11   scales_0.4.1backports_1.1.0 checkmate_1.8.3
[37] Hmisc_4.0-3 abind_1.4-5 lme4_1.1-13 gridExtra_2.2.1
[41] ggplot2_2.2.1   digest_0.6.12   stringi_1.1.5   grid_3.4.1
[45] tools_3.4.1 magrittr_1.5lazyeval_0.2.0  tibble_1.3.3
[49] Formula_1.2-2   cluster_2.0.6   MASS_7.3-47 Matrix_1.2-10
[53] data.table_1.10.4   minqa_1.2.4 rpart_4.1-11nnet_7.3-12
[57] nlme_3.1-131compiler_3.4.1
> R. Mark Sharp, Ph.D.
msh...@txbiomed.org





> On Jul 24, 2017, at 6:17 PM, Jack Talley  wrote:
>
> With the lastest version of R 3.4.1 I have not been able to loard Rcmdr.
> Advice please.
>
> Thank you,
>
> Jack Talley, PhD
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.

CONFIDENTIALITY NOTICE: This e-mail and any files and/or...{{dropped:10}}

__
R-help@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.


[R] Loading Rcmdr

2017-07-24 Thread Jack Talley
With the lastest version of R 3.4.1 I have not been able to loard Rcmdr.
Advice please.

Thank you,

Jack Talley, PhD

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] loading edited functions already in saved workspace automatically

2017-05-09 Thread Ralf Goertz
Am Tue, 09 May 2017 10:00:17 -0700
schrieb Jeff Newmiller :

> This boils down to the fact that some "my ways" are more effective in
> the long run than others.. but I really want to address the complaint
> 
> "... sometimes tedious to rebuild my environment by reexecuting
> commands in the history"
> 
> by asserting that letting R re-run a script that loads my functions
> and packages (though perhaps not the data analysis steps) is always
> very fast and convenient to do explicitly. I almost never use the
> history file feature, because I type nearly every R instruction I use
> into a script file and execute/edit it until it does what I want. I
> keep functions in a separate file or package, and steps dealing with
> a particular data set in their own file that uses source() to load
> the functions) even when I am executing the lines interactively. My
> goal is to regularly re-execute the whole script so that
> tomorrow/next year/whenever someone notices something was wrong then
> I can re-execute the sequence without following the dead ends I went
> down the first time (as using a history file does) and I don't have a
> separate clean-up-the-history-file step to go through to create it.
> When I have confirmed that the script still works as it did before
> then I can find where the analysis/data problem went wrong and fix it. 

My usual work with R is probably a bit different from yours. As I said
before I work on many projects (often simultaneously) but I do routine
work. For that I have my super function, the one I want to reload every
time R starts, at the moment about 250 lines of code. This is always
work in progress. In almost every project there is something that makes
me edit this function. But in order to apply my function I need to
prepare the data, e.g. getting them from a database or csv files,
renaming the columns of data.frames etc. This is all tedious and not
worth putting in scripts because these steps are very specific to the
project and are rarely needed more than once. Sometimes one or two data
records in project on which I worked a few days before turn out to be
wrong and need to be changed. That's why I want to keep the data because
changing the data.frame directly is much easier then starting from
scratch. Meanwhile my function has evolved. But in the .RData file is
still the old version, which is bad.

However, I found a solution! .Last() gets executed before saving here,
too. I simply had forgotten that I need to use rm() with pos=1, i.e.
rm(myfun,pos=1) because otherwise rm wants to delete myfun from within
the context of the function .Last() where it doesn't live. I changed my
.Rprofile to:

.First=function(){
assign("myfun",eval(parse(file=("~/R/myfun.R"))),pos=1)
}
.Last=function(){
rm(.First,pos=1)
rm(myfun,pos=1)
rm(.Last,pos=1)
}

and everything works as I want it. So no design flaw but still way too
complicated in my opinion. Thanks to everybody who came up with
suggestions.

Ralf

__
R-help@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.


Re: [R] loading edited functions already in saved workspace automatically

2017-05-09 Thread Jeff Newmiller
This boils down to the fact that some "my ways" are more effective in the long 
run than others.. but I really want to address the complaint

"... sometimes tedious to rebuild my environment by reexecuting commands in the 
history"

by asserting that letting R re-run a script that loads my functions and 
packages (though perhaps not the data analysis steps) is always very fast and 
convenient to do explicitly. I almost never use the history file feature, 
because I type nearly every R instruction I use into a script file and 
execute/edit it until it does what I want. I keep functions in a separate file 
or package, and steps dealing with a particular data set in their own file that 
uses source() to load the functions) even when I am executing the lines 
interactively. My goal is to regularly re-execute the whole script so that 
tomorrow/next year/whenever someone notices something was wrong then I can 
re-execute the sequence without following the dead ends I went down the first 
time (as using a history file does) and I don't have a separate 
clean-up-the-history-file step to go through to create it. When I have 
confirmed that the script still works as it did before then I can find where 
the analysis/data problem went wrong and fix it. 

This does not mean I never use RData files to reduce how often I re-do slow 
calculations... but it does mean that I always have my script that loads the 
necessary packages and functions rather than using versions of functions in the 
RData file. It is useful to avoid becoming dependent on saved intermediate 
saved data files so you don't continue to encounter the effects of script 
errors that you have already fixed earlier in the analysis. 

It becomes more convenient to minimize dependency on automatic startup behavior 
when you want to share your script with someone else or run it yourself on a 
different computer (say, a powerful server). If you have the script habit then 
these hiccups with moving around are non-issues, and you can perform more and 
more complex analyses over time because you don't have to remember all the 
individual steps nor do you have to sort through the dead ends in your history 
file over and over. 

The editor you use can make a huge difference in making this work... get one 
that has a hot key that lets you execute one line at a time straight from the 
editor rather than requiring an explicit copy/paste. RStudio, Notepad++/NppToR, 
IntelliJ IDEA, vim-r, and ESS are a few options I am aware of. RStudio also 
supports full screen debugging of R so you can more easily reproduce the exact 
conditions where things go wrong inside functions as well. 

-- 
Sent from my phone. Please excuse my brevity.

On May 9, 2017 8:49:22 AM PDT, Michael Friendly  wrote:
>Ralf:
>
>You are afflicted with several mind bugs:
>* the "my-way mind bug" -- "I want to do it MY WAY, because that's sort
>
>of what
>I know" and also,
>* the "my-square-peg-should-fit-into-this-round-hole mind bug" -- "R 
>should be able to
>do it MY WAY, but it puts obstacles in my path," perhaps a subsidiary, 
>but more technical:
>* the "loading-a-function-or-data-is-the-same mind bug"
>As in many things R, you can't always get to MY WAY from there, at
>least 
>not without a tortuous journey.
>
>You think you should be able to do everything you want in .Rprofile,
>but 
>then you posed two separate problems:
>(a) save/reload history
>(b) save/reload functions and data
>
>If you recognize them as two separate problems, there is an easier
>path:
>(a) use .Rprofile only for making your history persistent, as I
>described
>(b) Put your functions & data you always want available in a package; 
>you can load it from .Rprofile
>
>I originally defined a bunch of handy functions (e.g., cd(), a setwd() 
>replacement, that works more like `cd` on unix, in that `cd()` returns 
>to the previous directory; it also changes the Windows title to
>`RGui:`  abbreviation of getwd() )
>
>I moved them all out of .Rprofile, made a package `myutil` and now load
>
>them from there with
>
>  #==
>  # load default packages
>  #==
>  if (!require(myutil)) warning("myutil functions not available")
>
>hope this helps,
>-Michael
>
>On 5/9/2017 10:20 AM, Ralf Goertz wrote:
>> Am Sat, 6 May 2017 11:17:42 -0400
>> schrieb Michael Friendly :
>>
>>> On 5/5/2017 10:23 AM, Ralf Goertz wrote:
 Am Fri, 05 May 2017 07:14:36 -0700
 schrieb Jeff Newmiller :
   
> R normally prompts you to save .RData, but it just automatically
> saves .Rhistory... the two are unrelated.
 Not here. If I say "n" to the prompted question "Save workspace
 image? [y/n/c]: " my history doesn't get saved.

 Version:

 R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
 Copyright (C) 2016 The R Foundation for Statistical Computing
 Platform: x86_64-suse-linux-gnu (64-bit)
   
>>> On 

Re: [R] loading edited functions already in saved workspace automatically

2017-05-09 Thread Michael Friendly

Ralf:

You are afflicted with several mind bugs:
* the "my-way mind bug" -- "I want to do it MY WAY, because that's sort 
of what

I know" and also,
* the "my-square-peg-should-fit-into-this-round-hole mind bug" -- "R 
should be able to
do it MY WAY, but it puts obstacles in my path," perhaps a subsidiary, 
but more technical:

* the "loading-a-function-or-data-is-the-same mind bug"
As in many things R, you can't always get to MY WAY from there, at least 
not without a tortuous journey.


You think you should be able to do everything you want in .Rprofile, but 
then you posed two separate problems:

(a) save/reload history
(b) save/reload functions and data

If you recognize them as two separate problems, there is an easier path:
(a) use .Rprofile only for making your history persistent, as I described
(b) Put your functions & data you always want available in a package; 
you can load it from .Rprofile


I originally defined a bunch of handy functions (e.g., cd(), a setwd() 
replacement, that works more like `cd` on unix, in that `cd()` returns 
to the previous directory; it also changes the Windows title to

`RGui:`  abbreviation of getwd() )

I moved them all out of .Rprofile, made a package `myutil` and now load 
them from there with


 #==
 # load default packages
 #==
 if (!require(myutil)) warning("myutil functions not available")

hope this helps,
-Michael

On 5/9/2017 10:20 AM, Ralf Goertz wrote:

Am Sat, 6 May 2017 11:17:42 -0400
schrieb Michael Friendly :


On 5/5/2017 10:23 AM, Ralf Goertz wrote:

Am Fri, 05 May 2017 07:14:36 -0700
schrieb Jeff Newmiller :
  

R normally prompts you to save .RData, but it just automatically
saves .Rhistory... the two are unrelated.

Not here. If I say "n" to the prompted question "Save workspace
image? [y/n/c]: " my history doesn't get saved.

Version:

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-suse-linux-gnu (64-bit)
  

On Windoze, here's what I use in my .Rprofile, which runs every time
I start an RGUI coonsole.  The key is .First & .Last to load/save
history automagically.

Hi Michael,

thanks. This helps with saving the history without saving the data. But
actually I'd really like to save both and still be able to load
functions automatically from .Rprofile. Not saving the data as Jeff
suggested is not a good option because it is sometimes tedious to
rebuild my environment by reexecuting commands in the history. And I
explained in my OP why I can't use .First() to achieve my goal.

But let me try again to explain the problem because I think not
everybody understood what I was trying to say. For simplicity I use the
plain variable "a" instead of a function. Start a fresh session and
remove all variables, define one variable and quit with saving:


rm(list=ls())
a=17
quit(save="yes")

Now, before opening a new session edit .Rprofile such that it contains
just the two lines:

print("Hello from .Rprofile")
a=42

Start a new session where your saved environment will be loaded.
Observe that you see the line

[1] "Hello from .Rprofile"

proving that the commands in .Rprofile have been executed. Now look at
"a":


a

[1] 17


You would expect to see this because *after* your "Hello" line you find

[Previously saved workspace restored]

So you have set "a" to 42 in .Rprofile but it gets overwritten from the
previously saved and now restored workspace. On the other hand, .First()
gets executed after the restoring of the workspace. Therefore, I could
edit .Rprofile to read

.First=function(){ assign("a",42,pos=1) }

Now, after starting I see that "a" is indeed 42. But then it turns out
that from now on I need "a" to be 11. After editing .Rprofile
accordingly, I am quite hopeful but after starting a new session I see
that "a" is still 42. Why is that? Because .First() was saved and when I
started a new session it got a new function body (setting "a" to 11) but
before it could be executed it was again overwritten by the old value
(setting "a" to 42) and I am chasing my own tail. Sigh.

.Last() doesn't help. Apparently (at least on my linux system) it is
executed *after* saving the environment so too late to remove anything
you don't want saved. In that regard linux doesn't seem to be typical,
since in "?.Last" the reverse order is described as typical:

  Exactly what happens at termination of an R session depends on the
  platform and GUI interface in use.  A typical sequence is to run
  ‘.Last()’ and ‘.Last.sys()’ (unless ‘runLast’ is false), to save
  the workspace if requested (and in most cases also to save the
  session history: see ‘savehistory’), then run any finalizers (see
  ‘reg.finalizer’) that have been set to be run on exit, close all
  open graphics devices, remove the session temporary directory and
  print any remaining warnings (e.g., from 

Re: [R] loading edited functions already in saved workspace automatically

2017-05-09 Thread Ralf Goertz
Am Sat, 6 May 2017 11:17:42 -0400
schrieb Michael Friendly :

> On 5/5/2017 10:23 AM, Ralf Goertz wrote:
> > Am Fri, 05 May 2017 07:14:36 -0700
> > schrieb Jeff Newmiller :
> >  
> >> R normally prompts you to save .RData, but it just automatically
> >> saves .Rhistory... the two are unrelated.  
> >
> > Not here. If I say "n" to the prompted question "Save workspace
> > image? [y/n/c]: " my history doesn't get saved.
> >
> > Version:
> >
> > R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
> > Copyright (C) 2016 The R Foundation for Statistical Computing
> > Platform: x86_64-suse-linux-gnu (64-bit)
> >  
> 
> On Windoze, here's what I use in my .Rprofile, which runs every time
> I start an RGUI coonsole.  The key is .First & .Last to load/save
> history automagically.

Hi Michael,

thanks. This helps with saving the history without saving the data. But
actually I'd really like to save both and still be able to load
functions automatically from .Rprofile. Not saving the data as Jeff
suggested is not a good option because it is sometimes tedious to
rebuild my environment by reexecuting commands in the history. And I
explained in my OP why I can't use .First() to achieve my goal.

But let me try again to explain the problem because I think not
everybody understood what I was trying to say. For simplicity I use the
plain variable "a" instead of a function. Start a fresh session and
remove all variables, define one variable and quit with saving:

> rm(list=ls())
> a=17
> quit(save="yes")

Now, before opening a new session edit .Rprofile such that it contains
just the two lines:

print("Hello from .Rprofile")
a=42

Start a new session where your saved environment will be loaded.
Observe that you see the line 

[1] "Hello from .Rprofile"

proving that the commands in .Rprofile have been executed. Now look at
"a":

> a
[1] 17


You would expect to see this because *after* your "Hello" line you find

[Previously saved workspace restored]

So you have set "a" to 42 in .Rprofile but it gets overwritten from the
previously saved and now restored workspace. On the other hand, .First()
gets executed after the restoring of the workspace. Therefore, I could
edit .Rprofile to read

.First=function(){ assign("a",42,pos=1) }

Now, after starting I see that "a" is indeed 42. But then it turns out
that from now on I need "a" to be 11. After editing .Rprofile
accordingly, I am quite hopeful but after starting a new session I see
that "a" is still 42. Why is that? Because .First() was saved and when I
started a new session it got a new function body (setting "a" to 11) but
before it could be executed it was again overwritten by the old value
(setting "a" to 42) and I am chasing my own tail. Sigh.

.Last() doesn't help. Apparently (at least on my linux system) it is
executed *after* saving the environment so too late to remove anything
you don't want saved. In that regard linux doesn't seem to be typical,
since in "?.Last" the reverse order is described as typical:

 Exactly what happens at termination of an R session depends on the
 platform and GUI interface in use.  A typical sequence is to run
 ‘.Last()’ and ‘.Last.sys()’ (unless ‘runLast’ is false), to save
 the workspace if requested (and in most cases also to save the
 session history: see ‘savehistory’), then run any finalizers (see
 ‘reg.finalizer’) that have been set to be run on exit, close all
 open graphics devices, remove the session temporary directory and
 print any remaining warnings (e.g., from ‘.Last()’ and device
 closure).


IMHO this is a design flaw.

Ralf

__
R-help@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.

Re: [R] loading edited functions already in saved workspace automatically

2017-05-06 Thread Michael Friendly


On 5/5/2017 10:23 AM, Ralf Goertz wrote:

Am Fri, 05 May 2017 07:14:36 -0700
schrieb Jeff Newmiller :


R normally prompts you to save .RData, but it just automatically
saves .Rhistory... the two are unrelated.


Not here. If I say "n" to the prompted question "Save workspace image?
[y/n/c]: " my history doesn't get saved.

Version:

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-suse-linux-gnu (64-bit)



On Windoze, here's what I use in my .Rprofile, which runs every time I 
start an RGUI coonsole.  The key is .First & .Last to load/save

history automagically.  There is some extra overhead in my use of
old.packages() here, but that is for a different reason.



### History

# could use Sys.getenv("R_HISTFILE")
# Sys.getenv("R_HISTSIZE"=1024)
.First <- function() {
if(interactive()) {
if (.Platform$GUI == "Rgui") {
			histfile <- if (file.exists(".Rhistory")) ".Rhistory" else 
"c:/R/.Rhistory"

try(utils::loadhistory(histfile))
old <- utils::old.packages()
	if (! is.null(old)) cat("Updatable packages: ", old[,1], "\n", 
fill=TRUE) else cat("All packages up to date\n")

}
  setwd("c:/R")
  cat(paste("[.Rprofile loaded, current dir:", getwd(), 
"]\n"),sep=" ")	

  }
}


.Last <- function()
if(interactive() && .Platform$GUI == "Rgui") {
		 histfile <- if (file.exists(".Rhistory")) ".Rhistory" else 
"c:/R/.Rhistory"

 try(utils::savehistory(histfile))
}


--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept. & Chair, Quantitative Methods
York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

__
R-help@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.


Re: [R] loading edited functions already in saved workspace automatically

2017-05-05 Thread Bert Gunter
Haven't followed this closely, but
?Startup
and links therein might be useful (esp .First).

Bert


On May 5, 2017 11:47 AM, "David Winsemius"  wrote:


> On May 5, 2017, at 7:48 AM, Michael Dewey  wrote:
>
> Dear Ralf
>
> You can manually save it with
> savehistory(insertyour preferred filenamehere.r)
>
> or does that not do what you hoped?

Or you can exit to your system browser and copy of the desired sections of
the .Rhistory file that you desire archiving to a text editor (after you
find the ofttimes hidden file.) It's just a text file.

The details vary across OSes. I don't think you told us yours. Might help
to read the Posting Guide.

--
David


>
> On 05/05/2017 14:44, Ralf Goertz wrote:
>> Am Fri, 05 May 2017 06:30:01 -0700
>> schrieb Jeff Newmiller :
>>
>>> The answer most people seem to use is to avoid depending on functions
>>> in RData files, and in particular avoiding ever saving the
>>> "automatic" ".RData" files at all. (Some people avoid using any RData
>>> files, but the automatic loading of functions by ".RData" files is a
>>> particularly pernicious source of evil as you have already
>>> discovered.)
>>>
>>> That is,  always work toward building scripts that you run to restore
>>> your workspace rather than depending on save files. Don't depend on
>>> save files to keep track of what you do interactively. This also
>>> usually means that there should be little if anything in
>>> your .Rprofile because that tends to build non-reproducibility into
>>> your scripts.
>>
>> Hi Jeff,
>>
>> thanks for your answer. Actually, I don't use the workspace saving
>> feature primarily for the data but for the command line history. Is
>> there a way to just save .Rhistory?
>>
>> Ralf
>>
>> __
>> R-help@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.
>>
>> ---
>> This email has been checked for viruses by AVG.
>> http://www.avg.com
>>
>>
>
> --
> Michael
> http://www.dewey.myzen.co.uk/home.html
>
> __
> R-help@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.

David Winsemius
Alameda, CA, USA

__
R-help@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.

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] loading edited functions already in saved workspace automatically

2017-05-05 Thread David Winsemius

> On May 5, 2017, at 7:48 AM, Michael Dewey  wrote:
> 
> Dear Ralf
> 
> You can manually save it with
> savehistory(insertyour preferred filenamehere.r)
> 
> or does that not do what you hoped?

Or you can exit to your system browser and copy of the desired sections of the 
.Rhistory file that you desire archiving to a text editor (after you find the 
ofttimes hidden file.) It's just a text file. 

The details vary across OSes. I don't think you told us yours. Might help to 
read the Posting Guide.

-- 
David


> 
> On 05/05/2017 14:44, Ralf Goertz wrote:
>> Am Fri, 05 May 2017 06:30:01 -0700
>> schrieb Jeff Newmiller :
>> 
>>> The answer most people seem to use is to avoid depending on functions
>>> in RData files, and in particular avoiding ever saving the
>>> "automatic" ".RData" files at all. (Some people avoid using any RData
>>> files, but the automatic loading of functions by ".RData" files is a
>>> particularly pernicious source of evil as you have already
>>> discovered.)
>>> 
>>> That is,  always work toward building scripts that you run to restore
>>> your workspace rather than depending on save files. Don't depend on
>>> save files to keep track of what you do interactively. This also
>>> usually means that there should be little if anything in
>>> your .Rprofile because that tends to build non-reproducibility into
>>> your scripts.
>> 
>> Hi Jeff,
>> 
>> thanks for your answer. Actually, I don't use the workspace saving
>> feature primarily for the data but for the command line history. Is
>> there a way to just save .Rhistory?
>> 
>> Ralf
>> 
>> __
>> R-help@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.
>> 
>> ---
>> This email has been checked for viruses by AVG.
>> http://www.avg.com
>> 
>> 
> 
> -- 
> Michael
> http://www.dewey.myzen.co.uk/home.html
> 
> __
> R-help@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.

David Winsemius
Alameda, CA, USA

__
R-help@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.


Re: [R] loading edited functions already in saved workspace automatically

2017-05-05 Thread Michael Dewey

Dear Ralf

You can manually save it with
savehistory(insertyour preferred filenamehere.r)

or does that not do what you hoped?

On 05/05/2017 14:44, Ralf Goertz wrote:

Am Fri, 05 May 2017 06:30:01 -0700
schrieb Jeff Newmiller :


The answer most people seem to use is to avoid depending on functions
in RData files, and in particular avoiding ever saving the
"automatic" ".RData" files at all. (Some people avoid using any RData
files, but the automatic loading of functions by ".RData" files is a
particularly pernicious source of evil as you have already
discovered.)

That is,  always work toward building scripts that you run to restore
your workspace rather than depending on save files. Don't depend on
save files to keep track of what you do interactively. This also
usually means that there should be little if anything in
your .Rprofile because that tends to build non-reproducibility into
your scripts.


Hi Jeff,

thanks for your answer. Actually, I don't use the workspace saving
feature primarily for the data but for the command line history. Is
there a way to just save .Rhistory?

Ralf

__
R-help@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.

---
This email has been checked for viruses by AVG.
http://www.avg.com




--
Michael
http://www.dewey.myzen.co.uk/home.html

__
R-help@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.


Re: [R] loading edited functions already in saved workspace automatically

2017-05-05 Thread Jeff Newmiller
Read ?history.

Seems somewhat platform dependent, but they ARE different. 
-- 
Sent from my phone. Please excuse my brevity.

On May 5, 2017 7:23:14 AM PDT, Ralf Goertz  wrote:
>Am Fri, 05 May 2017 07:14:36 -0700
>schrieb Jeff Newmiller :
>
>> R normally prompts you to save .RData, but it just automatically
>> saves .Rhistory... the two are unrelated. 
>
>Not here. If I say "n" to the prompted question "Save workspace image?
>[y/n/c]: " my history doesn't get saved.
>
>Version:
>
>R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
>Copyright (C) 2016 The R Foundation for Statistical Computing
>Platform: x86_64-suse-linux-gnu (64-bit)

__
R-help@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.


Re: [R] loading edited functions already in saved workspace automatically

2017-05-05 Thread Ralf Goertz
Am Fri, 05 May 2017 07:14:36 -0700
schrieb Jeff Newmiller :

> R normally prompts you to save .RData, but it just automatically
> saves .Rhistory... the two are unrelated. 

Not here. If I say "n" to the prompted question "Save workspace image?
[y/n/c]: " my history doesn't get saved.

Version:

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-suse-linux-gnu (64-bit)

__
R-help@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.


Re: [R] loading edited functions already in saved workspace automatically

2017-05-05 Thread Jeff Newmiller
R normally prompts you to save .RData, but it just automatically saves 
.Rhistory... the two are unrelated. 
-- 
Sent from my phone. Please excuse my brevity.

On May 5, 2017 6:44:50 AM PDT, Ralf Goertz  wrote:
>Am Fri, 05 May 2017 06:30:01 -0700
>schrieb Jeff Newmiller :
>
>> The answer most people seem to use is to avoid depending on functions
>> in RData files, and in particular avoiding ever saving the
>> "automatic" ".RData" files at all. (Some people avoid using any RData
>> files, but the automatic loading of functions by ".RData" files is a
>> particularly pernicious source of evil as you have already
>> discovered.)
>> 
>> That is,  always work toward building scripts that you run to restore
>> your workspace rather than depending on save files. Don't depend on
>> save files to keep track of what you do interactively. This also
>> usually means that there should be little if anything in
>> your .Rprofile because that tends to build non-reproducibility into
>> your scripts.
>
>Hi Jeff,
>
>thanks for your answer. Actually, I don't use the workspace saving
>feature primarily for the data but for the command line history. Is
>there a way to just save .Rhistory?
>
>Ralf

__
R-help@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.


Re: [R] loading edited functions already in saved workspace automatically

2017-05-05 Thread Ralf Goertz
Am Fri, 05 May 2017 06:30:01 -0700
schrieb Jeff Newmiller :

> The answer most people seem to use is to avoid depending on functions
> in RData files, and in particular avoiding ever saving the
> "automatic" ".RData" files at all. (Some people avoid using any RData
> files, but the automatic loading of functions by ".RData" files is a
> particularly pernicious source of evil as you have already
> discovered.)
> 
> That is,  always work toward building scripts that you run to restore
> your workspace rather than depending on save files. Don't depend on
> save files to keep track of what you do interactively. This also
> usually means that there should be little if anything in
> your .Rprofile because that tends to build non-reproducibility into
> your scripts.

Hi Jeff,

thanks for your answer. Actually, I don't use the workspace saving
feature primarily for the data but for the command line history. Is
there a way to just save .Rhistory?

Ralf

__
R-help@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.


Re: [R] loading edited functions already in saved workspace automatically

2017-05-05 Thread Jeff Newmiller
The answer most people seem to use is to avoid depending on functions in RData 
files, and in particular avoiding ever saving the "automatic" ".RData" files at 
all. (Some people avoid using any RData files, but the automatic loading of 
functions by ".RData" files is a particularly pernicious source of evil as you 
have already discovered.)

That is,  always work toward building scripts that you run to restore your 
workspace rather than depending on save files. Don't depend on save files to 
keep track of what you do interactively. This also usually means that there 
should be little if anything in your .Rprofile because that tends to build 
non-reproducibility into your scripts.
-- 
Sent from my phone. Please excuse my brevity.

On May 5, 2017 1:33:27 AM PDT, Ralf Goertz  wrote:
>Hi,
>
>In short: Is it possible to have the previously saved workspace
>restored
>and nevertheless load a function already existing in this workspace via
>.Rprofile anyway?
>
>In detail: I use different directories for different projects. In all
>those projects I use a function which I therefore try to get into the
>session by `myfunc=eval(parse(file=("~/R/myfunc.R")))' in ~/.Rprofile.
>Once I leave the session thereby saving the workspace this function
>gets
>saved in ./.RData as well. In a subsequent session in that directory it
>gets loaded back. However, in the meantime I might have edited
>~/R/myfunc.R. I don't seem to be able to automatically load the new
>function into the session. The workspace gets loaded *after* the
>execution of ~/.Rprofile. So the new definition of myfunc() gets
>overwritten by the old one. I can't use .First() – which is executed
>after loading the workspace – because this would load myfunc() into the
>environment of .First() instead of the global environment. I could use
>.Last() to remove the function before saving the workspace. But then
>.Last() gets saved to the workspace which is also not convenient since
>when I add another function the same way and edit the definition of
>.Last() in ~/.Rprofile to also remove that function this does not work
>because I don't get the new .Last() into the session automatically. And
>no, removing .Last() from within .Last() doesn't work.
>
>__
>R-help@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.

__
R-help@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.

[R] loading edited functions already in saved workspace automatically

2017-05-05 Thread Ralf Goertz
Hi,

In short: Is it possible to have the previously saved workspace restored
and nevertheless load a function already existing in this workspace via
.Rprofile anyway?

In detail: I use different directories for different projects. In all
those projects I use a function which I therefore try to get into the
session by `myfunc=eval(parse(file=("~/R/myfunc.R")))' in ~/.Rprofile.
Once I leave the session thereby saving the workspace this function gets
saved in ./.RData as well. In a subsequent session in that directory it
gets loaded back. However, in the meantime I might have edited
~/R/myfunc.R. I don't seem to be able to automatically load the new
function into the session. The workspace gets loaded *after* the
execution of ~/.Rprofile. So the new definition of myfunc() gets
overwritten by the old one. I can't use .First() – which is executed
after loading the workspace – because this would load myfunc() into the
environment of .First() instead of the global environment. I could use
.Last() to remove the function before saving the workspace. But then
.Last() gets saved to the workspace which is also not convenient since
when I add another function the same way and edit the definition of
.Last() in ~/.Rprofile to also remove that function this does not work
because I don't get the new .Last() into the session automatically. And
no, removing .Last() from within .Last() doesn't work.

__
R-help@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.

Re: [R] loading .rda file

2016-08-30 Thread Leslie Rutkowski
Thanks, all, for your quick and comprehensive help with this - very much
appreciated in my R journey.

Leslie

On Tue, Aug 30, 2016 at 8:03 PM, Jeff Newmiller 
wrote:

> Thanks for the perspective, Martin. I personally feel like attaching to
> the search path is more confusing than being explicit, because it appears
> indistinguishable from namespace pollution yet for modifying data it
> creates copies in the current environment (in-place editing requires `<<-`
> which requires keeping your search path in mind as you work to know when to
> use it).
> --
> Sent from my phone. Please excuse my brevity.
>
> On August 30, 2016 10:12:32 AM PDT, Martin Maechler <
> maech...@stat.math.ethz.ch> wrote:
> >> Jeff Newmiller 
> >> on Tue, 30 Aug 2016 09:36:05 -0700 writes:
> >
> >> You cannot. However, you can load the file into a dedicated
> >environment to keep those names separated from your global environment.
> >e.g. [1]
> >
> >yes, that's my "famous"  only-allowed use of  attach() :
> >attach() an rda-file to your search patch instead of polluting
> >your globalenv.
> >
> >  > The saveRDS / loadRDS
> >
> >saveRDS / readRDS   are the correct names
> >
> >> functions are an alternative handle one object at a time without
> >dragging the object names into the picture (you have to name the
> >re-loaded object).
> >
> >The fact that it is readRDS() and not loadRDS(),
> >actually does convey via it is often "much better" in the sense
> >of functional / transparent programming to use this pair in
> >favor of save() / load() :
> >readRDS() does *return* what we are interested in, and
> >
> >   result <- readRDS()
> >
> >is so much better than   load()   silently overwriting all
> >kinds of objects in my globalenv.
> >
> >Indeed, I strongly advocate to use  saveRDS() and readRDS()
> >much more frequently than they are used nowawadays.
> >
> >
> >
> >> However, the best approach is to write scripts that pull directly
> >from your source (non-R) data files. This makes your work process
> >reproducible as you develop it.
> >
> >Yes, but that's sometimes too inefficient.
> >
> >And then, some of us do simulations and other expensive
> >computations, we need/want to save and re-read.
> >
> >and yes,  I *always*  use the equivalent of   q("no")  to leave R;
> >never save the workspace or load it at startup, unless
> >accidentally on non-standard (for me) platforms.
> >
> >Martin
> >
> >> [1] https://stat.ethz.ch/pipermail/r-help/2016-August/441078.html
> >> --
> >> Sent from my phone. Please excuse my brevity.
> >
> >> On August 30, 2016 7:37:24 AM PDT, Leslie Rutkowski
> > wrote:
> >>> Hi,
> >>>
> >>> I'm slowly migrating from SAS to R and - for the very first time -
> >I'm
> >>> working with a native .Rda data file (rather than importing data
> >from
> >>> other
> >>> sources). When I load this .Rda file into the global environment
> >using
> >>> load("file path") I see a data.frame in the global environment
> >called
> >>> "mydata" that corresponds to the .rda file.
> >>>
> >>> My question: how can I change the name of this data.frame to
> >something
> >>> of
> >>> my choosing?
> >>>
> >>> Thanks for considering this very simple question.
> >>>
> >>> Leslie
> >>>
> >>> [[alternative HTML version deleted]]
> >>>
> >>> __
> >   >> R-help@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.
> >
> >> __
> >> R-help@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.
>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] loading .rda file

2016-08-30 Thread Jeff Newmiller
Thanks for the perspective, Martin. I personally feel like attaching to the 
search path is more confusing than being explicit, because it appears 
indistinguishable from namespace pollution yet for modifying data it creates 
copies in the current environment (in-place editing requires `<<-` which 
requires keeping your search path in mind as you work to know when to use it).
-- 
Sent from my phone. Please excuse my brevity.

On August 30, 2016 10:12:32 AM PDT, Martin Maechler 
 wrote:
>> Jeff Newmiller 
>> on Tue, 30 Aug 2016 09:36:05 -0700 writes:
>
>> You cannot. However, you can load the file into a dedicated
>environment to keep those names separated from your global environment.
>e.g. [1]
>
>yes, that's my "famous"  only-allowed use of  attach() :
>attach() an rda-file to your search patch instead of polluting
>your globalenv.
>
>  > The saveRDS / loadRDS 
>
>saveRDS / readRDS   are the correct names
>
>> functions are an alternative handle one object at a time without
>dragging the object names into the picture (you have to name the
>re-loaded object).
>
>The fact that it is readRDS() and not loadRDS(),
>actually does convey via it is often "much better" in the sense
>of functional / transparent programming to use this pair in
>favor of save() / load() :
>readRDS() does *return* what we are interested in, and
>
>   result <- readRDS()
>
>is so much better than   load()   silently overwriting all
>kinds of objects in my globalenv.
>
>Indeed, I strongly advocate to use  saveRDS() and readRDS()
>much more frequently than they are used nowawadays.
>
>
>
>> However, the best approach is to write scripts that pull directly
>from your source (non-R) data files. This makes your work process
>reproducible as you develop it.
>
>Yes, but that's sometimes too inefficient.
>
>And then, some of us do simulations and other expensive
>computations, we need/want to save and re-read.
>
>and yes,  I *always*  use the equivalent of   q("no")  to leave R; 
>never save the workspace or load it at startup, unless
>accidentally on non-standard (for me) platforms.
>
>Martin
>
>> [1] https://stat.ethz.ch/pipermail/r-help/2016-August/441078.html
>> -- 
>> Sent from my phone. Please excuse my brevity.
>
>> On August 30, 2016 7:37:24 AM PDT, Leslie Rutkowski
> wrote:
>>> Hi,
>>> 
>>> I'm slowly migrating from SAS to R and - for the very first time -
>I'm
>>> working with a native .Rda data file (rather than importing data
>from
>>> other
>>> sources). When I load this .Rda file into the global environment
>using
>>> load("file path") I see a data.frame in the global environment
>called
>>> "mydata" that corresponds to the .rda file.
>>> 
>>> My question: how can I change the name of this data.frame to
>something
>>> of
>>> my choosing?
>>> 
>>> Thanks for considering this very simple question.
>>> 
>>> Leslie
>>> 
>>> [[alternative HTML version deleted]]
>>> 
>>> __
>   >> R-help@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.
>
>> __
>> R-help@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.

__
R-help@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.


Re: [R] loading .rda file

2016-08-30 Thread Martin Maechler
> Jeff Newmiller 
> on Tue, 30 Aug 2016 09:36:05 -0700 writes:

> You cannot. However, you can load the file into a dedicated environment 
to keep those names separated from your global environment. e.g. [1]

yes, that's my "famous"  only-allowed use of  attach() :
attach() an rda-file to your search patch instead of polluting
your globalenv.

  > The saveRDS / loadRDS 

saveRDS / readRDS   are the correct names

> functions are an alternative handle one object at a time without dragging 
the object names into the picture (you have to name the re-loaded object).

The fact that it is readRDS() and not loadRDS(),
actually does convey via it is often "much better" in the sense
of functional / transparent programming to use this pair in
favor of save() / load() :
readRDS() does *return* what we are interested in, and

   result <- readRDS()

is so much better than   load()   silently overwriting all
kinds of objects in my globalenv.

Indeed, I strongly advocate to use  saveRDS() and readRDS()
much more frequently than they are used nowawadays.



> However, the best approach is to write scripts that pull directly from 
your source (non-R) data files. This makes your work process reproducible as 
you develop it.

Yes, but that's sometimes too inefficient.

And then, some of us do simulations and other expensive
computations, we need/want to save and re-read.

and yes,  I *always*  use the equivalent of   q("no")  to leave R; 
never save the workspace or load it at startup, unless
accidentally on non-standard (for me) platforms.

Martin

> [1] https://stat.ethz.ch/pipermail/r-help/2016-August/441078.html
> -- 
> Sent from my phone. Please excuse my brevity.

> On August 30, 2016 7:37:24 AM PDT, Leslie Rutkowski 
 wrote:
>> Hi,
>> 
>> I'm slowly migrating from SAS to R and - for the very first time - I'm
>> working with a native .Rda data file (rather than importing data from
>> other
>> sources). When I load this .Rda file into the global environment using
>> load("file path") I see a data.frame in the global environment called
>> "mydata" that corresponds to the .rda file.
>> 
>> My question: how can I change the name of this data.frame to something
>> of
>> my choosing?
>> 
>> Thanks for considering this very simple question.
>> 
>> Leslie
>> 
>> [[alternative HTML version deleted]]
>> 
>> __
>> R-help@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.

> __
> R-help@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.

__
R-help@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.


Re: [R] loading .rda file

2016-08-30 Thread Jeff Newmiller
You cannot. However, you can load the file into a dedicated environment to keep 
those names separated from your global environment. e.g. [1]

The saveRDS/loadRDS functions are an alternative handle one object at a time 
without dragging the object names into the picture (you have to name the 
re-loaded object).

However, the best approach is to write scripts that pull directly from your 
source (non-R) data files. This makes your work process reproducible as you 
develop it.

[1] https://stat.ethz.ch/pipermail/r-help/2016-August/441078.html
-- 
Sent from my phone. Please excuse my brevity.

On August 30, 2016 7:37:24 AM PDT, Leslie Rutkowski 
 wrote:
>Hi,
>
>I'm slowly migrating from SAS to R and - for the very first time - I'm
>working with a native .Rda data file (rather than importing data from
>other
>sources). When I load this .Rda file into the global environment using
>load("file path") I see a data.frame in the global environment called
>"mydata" that corresponds to the .rda file.
>
>My question: how can I change the name of this data.frame to something
>of
>my choosing?
>
>Thanks for considering this very simple question.
>
>Leslie
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@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.

__
R-help@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.


Re: [R] loading .rda file

2016-08-30 Thread Robert Baer
I think that the .rda extension is the old extension convention for what 
now gets the .RData extension name by convention.


These are basically workspaces. These .RData files can contain multiple 
data objects, and all objects seem to read back in with the same name 
that they were saved with using the save() function.  Of course, you can 
assign a new name to the objects you read in with the standard <- or -> 
syntax.


See ?save, to lean how to save them with the new name.  You can save 
just an individual data object in an .rda or .RData file and make the 
data object name match the filename if you so wish.



On 8/30/2016 9:37 AM, Leslie Rutkowski wrote:

Hi,

I'm slowly migrating from SAS to R and - for the very first time - I'm
working with a native .Rda data file (rather than importing data from other
sources). When I load this .Rda file into the global environment using
load("file path") I see a data.frame in the global environment called
"mydata" that corresponds to the .rda file.

My question: how can I change the name of this data.frame to something of
my choosing?

Thanks for considering this very simple question.

Leslie

[[alternative HTML version deleted]]

__
R-help@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.


--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

__
R-help@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.


[R] loading .rda file

2016-08-30 Thread Leslie Rutkowski
Hi,

I'm slowly migrating from SAS to R and - for the very first time - I'm
working with a native .Rda data file (rather than importing data from other
sources). When I load this .Rda file into the global environment using
load("file path") I see a data.frame in the global environment called
"mydata" that corresponds to the .rda file.

My question: how can I change the name of this data.frame to something of
my choosing?

Thanks for considering this very simple question.

Leslie

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] loading

2016-03-27 Thread Uwe Ligges
Err, you already loaded it, there is not necessarily another message. 
Just try the functions you want to use. ..


Best,
Uwe Ligges



On 27.03.2016 19:10, farzana akbari wrote:

  hi I install plm and pglm packages but I  can not load no one of them. the
massage of loading plm is


library(plm)

Loading required package: Formula


and for pglm is




library(pglm)

Loading required package: maxLik
Loading required package: miscTools

Please cite the 'maxLik' package as:
Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum
likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI
10.1007/s00180-010-0217-1.

If you have questions, suggestions, or comments regarding the 'maxLik'
package, please use a forum or 'tracker' at maxLik's R-Forge site:
https://r-forge.r-project.org/projects/maxlik/

can you help me? and also when i wanna Formula package there is no massage
. for installing Formula massage is
--- Please select a CRAN mirror for use in this session ---
Warning: package ‘Formula’ is in use and will not be installed


i used  3.1.3  and  3.2.4 ver *64  and  32  and my computer is 64 bit



please help me

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.

[R] loading

2016-03-27 Thread farzana akbari
 hi I install plm and pglm packages but I  can not load no one of them. the
massage of loading plm is

> library(plm)
Loading required package: Formula


and for pglm is



> library(pglm)
Loading required package: maxLik
Loading required package: miscTools

Please cite the 'maxLik' package as:
Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum
likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI
10.1007/s00180-010-0217-1.

If you have questions, suggestions, or comments regarding the 'maxLik'
package, please use a forum or 'tracker' at maxLik's R-Forge site:
https://r-forge.r-project.org/projects/maxlik/

can you help me? and also when i wanna Formula package there is no massage
. for installing Formula massage is
--- Please select a CRAN mirror for use in this session ---
Warning: package ‘Formula’ is in use and will not be installed


i used  3.1.3  and  3.2.4 ver *64  and  32  and my computer is 64 bit



please help me

[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] Loading large .pxt and .asc datasets causes issues.

2016-02-24 Thread Torvon
This is incredibly helpful, thank you all!

On 24 February 2016 at 04:02, Anthony Damico <ajdam...@gmail.com> wrote:

> hi eiko, LaF is incompatible with survey data, that road is a dead-end.
> this code below will painlessly load brfss into R, review the link douglas
> sent for analysis examples and change `years.to.download <- ` to 2006 only
> if you just want a single year of microdata.  glhf
>
>
> # install.packages( c("MonetDB.R", "MonetDBLite" , "survey" , "SAScii" ,
> "descr" , "downloader" , "digest" ) , repos=c("
> http://dev.monetdb.org/Assets/R/;, "http://cran.rstudio.com/;))
>
> # setInternet2( FALSE )# # only windows users need
> this line
> # options( encoding = "windows-1252" )# # only macintosh and *nix
> users need this line
> library(downloader)
> # setwd( "C:/My Directory/BRFSS/" )
> years.to.download <- 1984:2014
> source_url( "
> https://raw.githubusercontent.com/ajdamico/asdfree/master/Behavioral%20Risk%20Factor%20Surveillance%20System/download%20all%20microdata.R;
> , prompt = FALSE , echo = TRUE )
>
>
>
>
>
> On Tue, Feb 23, 2016 at 4:39 PM, Federman, Douglas <
> douglas.feder...@utoledo.edu> wrote:
>
>> You might want to look at Anthony Damico's work at
>>
>>
>> http://www.asdfree.com/search/label/behavioral%20risk%20factor%20surveillance%20system%20%28brfss%29
>>
>> --
>> Better name for the general practitioner might be multispecialist.
>> ~Martin H. Fischer (1879-1962)
>>
>>
>> -Original Message-
>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Torvon
>> Sent: Tuesday, February 23, 2016 2:13 PM
>> To: r-help@r-project.org
>> Subject: [R] Loading large .pxt and .asc datasets causes issues.
>>
>> Hi,
>>
>> I want to load a dataset into R. This dataset is available in two formats:
>> .XPT and .ASC. The dataset is available at
>> http://www.cdc.gov/brfss/annual_data/annual_2006.htm.
>>
>> They are about 40mb zipped, and about 500mb unzipped.
>>
>> I can get the .xpt data to load, using:
>>
>> > library(hmisc)
>> > data <- sasxport.get("CDBRFS06.XPT")
>>
>> The data look fine, no error messages. However, the data only contains
>> 302 columns, which is less than it should have (according to the
>> documentation). It does not contain my variables of interest, so either the
>> documentation or the data file is wrong, and I want to make sure it's not
>> the data file.
>>
>> Hence I wanted to see if I get the same results loading the .ASC file.
>> However, multiple ways to do so have failed.
>>
>> > library(adehabitat)
>> > import.asc("CDBRFS06.asc")
>>
>> Results in:
>> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
>> : scan() expected 'a real', got '1191.8808943.38209868648.960119'
>>
>> > library(SDMTools)
>> > read.asc("CDBRFS06.asc")
>>
>> Results in:
>> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
>> : scan() expected 'a real', got '1191.8808943.38209868648.960119' In
>> addition: Warning messages: 1: In scan(file, what, nmax, sep, dec, quote,
>> skip, nlines, na.strings, : number of items read is not a multiple of the
>> number of columns 2: In scan(file, what, nmax, sep, dec, quote, skip,
>> nlines, na.strings, : number of items read is not a multiple of the number
>> of columns 3: In scan(file, what, nmax, sep, dec, quote, skip, nlines,
>> na.strings, : number of items read is not a multiple of the number of
>> columns 4: In scan(file, what, nmax, sep, dec, quote, skip, nlines,
>> na.strings, : number of items read is not a multiple of the number of
>> columns 5: In scan(file, nmax = nl * nc, skip = 6, quiet = TRUE) : NAs
>> introduced by coercion to integer range
>>
>> Thank you for your help.
>>Eiko
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@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.
>>
>> __
>> R-help@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.
>>
>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading large .pxt and .asc datasets causes issues.

2016-02-23 Thread Anthony Damico
hi eiko, LaF is incompatible with survey data, that road is a dead-end.
this code below will painlessly load brfss into R, review the link douglas
sent for analysis examples and change `years.to.download <- ` to 2006 only
if you just want a single year of microdata.  glhf


# install.packages( c("MonetDB.R", "MonetDBLite" , "survey" , "SAScii" ,
"descr" , "downloader" , "digest" ) , repos=c("
http://dev.monetdb.org/Assets/R/;, "http://cran.rstudio.com/;))

# setInternet2( FALSE )# # only windows users need
this line
# options( encoding = "windows-1252" )# # only macintosh and *nix
users need this line
library(downloader)
# setwd( "C:/My Directory/BRFSS/" )
years.to.download <- 1984:2014
source_url( "
https://raw.githubusercontent.com/ajdamico/asdfree/master/Behavioral%20Risk%20Factor%20Surveillance%20System/download%20all%20microdata.R;
, prompt = FALSE , echo = TRUE )





On Tue, Feb 23, 2016 at 4:39 PM, Federman, Douglas <
douglas.feder...@utoledo.edu> wrote:

> You might want to look at Anthony Damico's work at
>
>
> http://www.asdfree.com/search/label/behavioral%20risk%20factor%20surveillance%20system%20%28brfss%29
>
> --
> Better name for the general practitioner might be multispecialist.
> ~Martin H. Fischer (1879-1962)
>
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Torvon
> Sent: Tuesday, February 23, 2016 2:13 PM
> To: r-help@r-project.org
> Subject: [R] Loading large .pxt and .asc datasets causes issues.
>
> Hi,
>
> I want to load a dataset into R. This dataset is available in two formats:
> .XPT and .ASC. The dataset is available at
> http://www.cdc.gov/brfss/annual_data/annual_2006.htm.
>
> They are about 40mb zipped, and about 500mb unzipped.
>
> I can get the .xpt data to load, using:
>
> > library(hmisc)
> > data <- sasxport.get("CDBRFS06.XPT")
>
> The data look fine, no error messages. However, the data only contains 302
> columns, which is less than it should have (according to the
> documentation). It does not contain my variables of interest, so either the
> documentation or the data file is wrong, and I want to make sure it's not
> the data file.
>
> Hence I wanted to see if I get the same results loading the .ASC file.
> However, multiple ways to do so have failed.
>
> > library(adehabitat)
> > import.asc("CDBRFS06.asc")
>
> Results in:
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
> : scan() expected 'a real', got '1191.8808943.38209868648.960119'
>
> > library(SDMTools)
> > read.asc("CDBRFS06.asc")
>
> Results in:
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
> : scan() expected 'a real', got '1191.8808943.38209868648.960119' In
> addition: Warning messages: 1: In scan(file, what, nmax, sep, dec, quote,
> skip, nlines, na.strings, : number of items read is not a multiple of the
> number of columns 2: In scan(file, what, nmax, sep, dec, quote, skip,
> nlines, na.strings, : number of items read is not a multiple of the number
> of columns 3: In scan(file, what, nmax, sep, dec, quote, skip, nlines,
> na.strings, : number of items read is not a multiple of the number of
> columns 4: In scan(file, what, nmax, sep, dec, quote, skip, nlines,
> na.strings, : number of items read is not a multiple of the number of
> columns 5: In scan(file, nmax = nl * nc, skip = 6, quiet = TRUE) : NAs
> introduced by coercion to integer range
>
> Thank you for your help.
>Eiko
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading large .pxt and .asc datasets causes issues.

2016-02-23 Thread Federman, Douglas
You might want to look at Anthony Damico's work at

http://www.asdfree.com/search/label/behavioral%20risk%20factor%20surveillance%20system%20%28brfss%29

--
Better name for the general practitioner might be multispecialist. 
~Martin H. Fischer (1879-1962)


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Torvon
Sent: Tuesday, February 23, 2016 2:13 PM
To: r-help@r-project.org
Subject: [R] Loading large .pxt and .asc datasets causes issues.

Hi,

I want to load a dataset into R. This dataset is available in two formats:
.XPT and .ASC. The dataset is available at 
http://www.cdc.gov/brfss/annual_data/annual_2006.htm.

They are about 40mb zipped, and about 500mb unzipped.

I can get the .xpt data to load, using:

> library(hmisc)
> data <- sasxport.get("CDBRFS06.XPT")

The data look fine, no error messages. However, the data only contains 302 
columns, which is less than it should have (according to the documentation). It 
does not contain my variables of interest, so either the documentation or the 
data file is wrong, and I want to make sure it's not the data file.

Hence I wanted to see if I get the same results loading the .ASC file.
However, multiple ways to do so have failed.

> library(adehabitat)
> import.asc("CDBRFS06.asc")

Results in:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
: scan() expected 'a real', got '1191.8808943.38209868648.960119'

> library(SDMTools)
> read.asc("CDBRFS06.asc")

Results in:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
: scan() expected 'a real', got '1191.8808943.38209868648.960119' In
addition: Warning messages: 1: In scan(file, what, nmax, sep, dec, quote, skip, 
nlines, na.strings, : number of items read is not a multiple of the number of 
columns 2: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
: number of items read is not a multiple of the number of columns 3: In 
scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : number of 
items read is not a multiple of the number of columns 4: In scan(file, what, 
nmax, sep, dec, quote, skip, nlines, na.strings, : number of items read is not 
a multiple of the number of columns 5: In scan(file, nmax = nl * nc, skip = 6, 
quiet = TRUE) : NAs introduced by coercion to integer range

Thank you for your help.
   Eiko

[[alternative HTML version deleted]]

__
R-help@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.

__
R-help@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.


Re: [R] Loading large .pxt and .asc datasets causes issues.

2016-02-23 Thread Jan van der Laan
First, the file does contain 302 columns; the variable layout 
(http://www.cdc.gov/brfss/annual_data/2006/varlayout_table_06.htm) 
contains 302 columns. So, reading the SASS file probably works correctly.


Second, the read.asc function you use is for reading geographic raster 
files, not fixed width files.


Below, I show how you could read the file using the LaF package (sorry 
for the long dump of variable files; copy-pasted them from the page 
linked to above):


columns <- "StartingColumn  VariableNameFieldLength
1_STATE2
3_GEOSTR2
5_DENSTR21
6PRECALL1
7REPNUM5
12REPDEPTH2
14FMONTH2
16IDATE8
16IMONTH2
18IDAY2
20IYEAR4
24INTVID3
27DISPCODE3
30SEQNO10
30_PSU10
40NATTMPTS2
42NRECSEL6
48NRECSTR9
57CTELENUM1
58CELLFON11
59PVTRESID1
60NUMADULT2
62NUMMEN2
64NUMWOMEN2
73GENHLTH1
74PHYSHLTH2
76MENTHLTH2
78POORHLTH2
80HLTHPLAN1
81PERSDOC21
82MEDCOST1
83CHECKUP1
84EXERANY21
85DIABETE21
86LASTDEN31
87RMVTETH31
88DENCLEAN1
89CVDINFR31
90CVDCRHD31
91CVDSTRK31
92ASTHMA21
93ASTHNOW1
94QLACTLM21
95USEEQUIP1
96SMOKE1001
97SMOKDAY21
98STOPSMK21
99AGE2
101HISPANC21
102MRACE6
108ORACE21
109MARITAL1
110CHILDREN2
112EDUCA1
113EMPLOY1
114INCOME22
116WEIGHT24
120HEIGHT34
124CTYCODE3
132NUMHHOL21
133NUMPHON21
134TELSERV21
135SEX1
136PREGNANT1
137VETERAN1
138DRNKANY41
139ALCDAY43
142AVEDRNK22
144DRNK3GE52
146MAXDRNKS2
148FLUSHOT31
149FLUSPRY21
162PNEUVAC31
163HEPBVAC1
164HEPBRSN1
165FALL3MN22
167FALLINJ22
169SEATBELT1
170DRINKDRI2
172HADMAM1
173HOWLONG1
174PROFEXAM1
175LENGEXAM1
176HADPAP21
177LASTPAP21
178HADHYST21
179PSATEST1
180PSATIME1
181DIGRECEX1
182DRETIME1
183PROSTATE1
184BLDSTOOL1
185LSTBLDS21
186HADSIGM31
187LASTSIG21
188HIVTST51
189HIVTSTD26
195WHRTST72
197HIVRDTST1
198EMTSUPRT1
199LSATISFY1
200RCSBIRTH6
206RCSGENDR1
207RCHISLAT1
208RCSRACE6
214RCSBRACE1
215RCSRELN11
216DRHPCH1
217HAVHPCH1
218CIFLUSH21
219RCVFVCH26
225RNOFVCH22
227CASTHDX21
228CASTHNO21
229DIABAGE22
231INSULIN1
232DIABPILL1
233BLDSUGAR3
236FEETCHK23
239FEETSORE1
240DOCTDIAB2
242CHKHEMO32
244FEETCHK2
246EYEEXAM1
247DIABEYE1
248DIABEDU1
249VIDFCLT21
250VIREDIF21
251VIPRFVS21
252VINOCRE22
254VIEYEXM21
255VIINSUR21
256VICTRCT21
257VIGLUMA21
258VIMACDG21
259VIATWRK21
260PAINACT22
262QLMENTL22
264QLSTRES22
266QLREST22
268QLHLTH22
270ASTHMAGE2
272ASATTACK1
273ASERVIST2
275ASDRVIST2
277ASRCHKUP2
279ASACTLIM3
282ASYMPTOM1
283ASNOSLEP1
284ASTHMED21
285ASINHALR1
286BRTHCNT31
287TYPCNTR42
289NOBCUSE22
291FPCHLDFT1
292FPCHLDHS1
293VITAMINS1
294MULTIVIT1
295FOLICACD1
296TAKEVIT3
299RECOMMEN1
300HOUSESMK1
301INDOORS1
302SMKPUBLC1
303SMKWORK1
304IAQHTSRC1
305IAQGASAP1
306IAQHTDYS3
309IAQCODTR1
310IAQMOLD1
311HEWTRSRC1
312HEWTRDRK1
313HECHMHOM3
316HECHMYRD3
319RRCLASS21
320RRCOGNT21
321RRATWORK1
322RRHCARE21
323RRPHYSM11
324RREMTSM11
325ADPLEASR2
327ADDOWN2
329ADSLEEP2
331ADENERGY2
333ADEAT2
335ADFAIL2
337ADTHINK2
339ADMOVE2
341ADANXEV1
342ADDEPEV1
343SVSAFE1
344SVSEXTCH1
345SVNOTCH1
346SVEHDSE11
347SVHDSX121
348SVEANOS11
349SVNOSX121
350SVRELAT22
352SVGENDER1
353IPVSAFE1
354IPVTHRAT1
355IPVPHYV11
356IPVPHHRT1
357IPVUWSEX1
358IPVPVL121
359IPVSXINJ1
360IPVRELT12
362GPWELPRD1
363GPVACPLN1
364GP3DYWTR1
365GP3DYFOD1
366GP3DYPRS1
367GPBATRAD1
368GPFLSLIT1
369GPMNDEVC1
370GPNOTEVC2
372GPEMRCOM1
373GPEMRINF1
741QSTVER1
742QSTLANG2
800

[R] Loading large .pxt and .asc datasets causes issues.

2016-02-23 Thread Torvon
Hi,

I want to load a dataset into R. This dataset is available in two formats:
.XPT and .ASC. The dataset is available at
http://www.cdc.gov/brfss/annual_data/annual_2006.htm.

They are about 40mb zipped, and about 500mb unzipped.

I can get the .xpt data to load, using:

> library(hmisc)
> data <- sasxport.get("CDBRFS06.XPT")

The data look fine, no error messages. However, the data only contains 302
columns, which is less than it should have (according to the
documentation). It does not contain my variables of interest, so either the
documentation or the data file is wrong, and I want to make sure it's not
the data file.

Hence I wanted to see if I get the same results loading the .ASC file.
However, multiple ways to do so have failed.

> library(adehabitat)
> import.asc("CDBRFS06.asc")

Results in:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
: scan() expected 'a real', got '1191.8808943.38209868648.960119'

> library(SDMTools)
> read.asc("CDBRFS06.asc")

Results in:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
: scan() expected 'a real', got '1191.8808943.38209868648.960119' In
addition: Warning messages: 1: In scan(file, what, nmax, sep, dec, quote,
skip, nlines, na.strings, : number of items read is not a multiple of the
number of columns 2: In scan(file, what, nmax, sep, dec, quote, skip,
nlines, na.strings, : number of items read is not a multiple of the number
of columns 3: In scan(file, what, nmax, sep, dec, quote, skip, nlines,
na.strings, : number of items read is not a multiple of the number of
columns 4: In scan(file, what, nmax, sep, dec, quote, skip, nlines,
na.strings, : number of items read is not a multiple of the number of
columns 5: In scan(file, nmax = nl * nc, skip = 6, quiet = TRUE) : NAs
introduced by coercion to integer range

Thank you for your help.
   Eiko

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading data chartseries

2015-09-23 Thread Joshua Ulrich
On Tue, Sep 22, 2015 at 3:10 PM, bgnumis bgnum  wrote:
> Hi all,
>
> I want to plot this data on file.txt that has this format
>
> 01/01/2000;970,1877
> 02/01/2000;970,2224
> 03/01/2000;969,0336
> 04/01/2000;958,3023
> 05/01/2000;952,8527
>
> I´m trying to plot with quantmode with this code but it is not working
>
>
> X<-read.table("file.txt", col.names=c("Date","LAST"), sep=";",dec=",")
>
>
>
>
> chartSeries(
> X,theme="white",
>   TA = c(addBBands(200,2))
>
>
> )
>
> But it says on error
>
> Error in try.xts(x, error = "chartSeries requires an xtsible object") :
>   chartSeries requires an xtsible object
>
>
> How can I run chartseries with my own data?
>
Your data need to be in an xts object, or something that can be
converted to an xts object via as.xts().  I recommend the former.

Lines <-
"01/01/2000;970,1877
02/01/2000;970,2224
03/01/2000;969,0336
04/01/2000;958,3023
05/01/2000;952,8527"

library(quantmod)
X <- as.xts(read.zoo(text=Lines, sep=";", dec=",", format="%m/%d/%Y"))
chartSeries(X, theme="white", TA="addBBands(200,2)")

> [[alternative HTML version deleted]]
>
> __
> R-help@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.



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-help@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.

[R] Loading data chartseries

2015-09-22 Thread bgnumis bgnum
Hi all,

I want to plot this data on file.txt that has this format

01/01/2000;970,1877
02/01/2000;970,2224
03/01/2000;969,0336
04/01/2000;958,3023
05/01/2000;952,8527

I´m trying to plot with quantmode with this code but it is not working


X<-read.table("file.txt", col.names=c("Date","LAST"), sep=";",dec=",")




chartSeries(
X,theme="white",
  TA = c(addBBands(200,2))


)

But it says on error

Error in try.xts(x, error = "chartSeries requires an xtsible object") :
  chartSeries requires an xtsible object


How can I run chartseries with my own data?

[[alternative HTML version deleted]]

__
R-help@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.

[R] Loading a rda file for predicton

2014-10-13 Thread TJUN KIAT TEO
I tried this


fit-glm(Pred~Pressure+MissingStep, data = Test, family=binomial)

save(fit,file=pred.rda)

pred-load(pred.rda)


predict(pred,Testsamp,type=response)



But got this error message

 no applicable method for 'predict' applied to an object of class character

What did I do wrong?


Tjun Kiat

  
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading a rda file for predicton

2014-10-13 Thread Peter Langfelder
see help(load) and pay particular attention to what the function
returns: the names of the loaded objects, not the object(s)
themselves.

You have to use

predict(fit,Testsamp,type=response)

since the load() created a variable 'fit' (same name as the one saved).

HTH

Peter



On Mon, Oct 13, 2014 at 6:37 AM, TJUN KIAT TEO teotj...@hotmail.com wrote:
 I tried this

 
 fit-glm(Pred~Pressure+MissingStep, data = Test, family=binomial)

 save(fit,file=pred.rda)

 pred-load(pred.rda)


 predict(pred,Testsamp,type=response)

 

 But got this error message

  no applicable method for 'predict' applied to an object of class character

 What did I do wrong?


 Tjun Kiat


 [[alternative HTML version deleted]]

 __
 R-help@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.

__
R-help@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.


Re: [R] loading saved files with objects in same names

2014-08-23 Thread Hadley Wickham
In the future, you can avoid this problem by using saveRDS and readRDS.

Hadley

On Mon, Aug 18, 2014 at 7:30 PM, Jinsong Zhao jsz...@yeah.net wrote:
 Hi there,

 I have several saved data files (e.g., A.RData, B.RData and C.RData). In
 each file, there are some objects with same names but different contents.
 Now, I need to compare those objects through plotting. However, I can't find
 a way to load them into a workspace. The only thing I can do is to rename
 them and then save and load again.

 Is there a convenient to load those objects?

 Thanks a lot in advance.

 Best regards,
 Jinsong

 __
 R-help@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.



-- 
http://had.co.nz/

__
R-help@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.


Re: [R] loading saved files with objects in same names

2014-08-22 Thread Martin Maechler

 Have you tried the 'envir' argument to load()?  E.g.,
envA - new.environment()
load(A.RData, envir=envA)
envB - new.environment()
load(B.RData, envir=envB)
plot(A$object, B$object)

 Bill Dunlap
 TIBCO Software
 wdunlap tibco.com

An alternative that I have been advocating is using

  attach(A.RData)

etc. It does something similar as the above, but more
conveniently:
It loads the objects into a new environment  *and* attaches that
environment to your search()  path, so you can access them
directly, but attach() will never accidentally destroy existing
R objects in your global environment ( = search()[[1]] ).

Martin





 On Mon, Aug 18, 2014 at 5:30 PM, Jinsong Zhao jsz...@yeah.net wrote:
 Hi there,

 I have several saved data files (e.g., A.RData, B.RData and C.RData). In
 each file, there are some objects with same names but different contents.
 Now, I need to compare those objects through plotting. However, I can't find
 a way to load them into a workspace. The only thing I can do is to rename
 them and then save and load again.

 Is there a convenient to load those objects?

 Thanks a lot in advance.

 Best regards,
 Jinsong

 __
 R-help@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.

__
R-help@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.

__
R-help@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.


Re: [R] loading saved files with objects in same names

2014-08-22 Thread Martin Maechler
 On 20/08/2014, 8:58 AM, Barry Rowlingson wrote:
  On Tue, Aug 19, 2014 at 1:30 AM, Jinsong Zhao jsz...@yeah.net wrote:
  Hi there,
 
  I have several saved data files (e.g., A.RData, B.RData and C.RData). In
  each file, there are some objects with same names but different
  contents. Now, I need to compare those objects through plotting.
  However, I can't find a way to load them into a workspace. The only
  thing I can do is to rename them and then save and load again.
 
  Is there a convenient to load those objects?
 
  Thanks a lot in advance.
  
  The technique of loading into an environment already mentioned can be
  cleaned up and put into a function.
  
  First lets save a thing called x into two files with different values:
  
x=first
save(x,file=f.RData))
x=second
save(x,file=s.RData)
  
  This little function wraps the loading:
  
getFrom=function(file, name){e=new.env();load(file,env=e);e[[name]]}
  
  So now I can get 'x' from the first file - the value is returned from
  `getFrom` so I can assign it to anything:
  
x1 =  getFrom(f.RData,x)
x1
  [1] first
x2 = getFrom(s.RData,x)
x2
  [1] second
  
  And I can even loop over RData files and read in all the `x`s into a vector:
  
sapply(c(f.RData,s.RData),function(f){getFrom(f,x)})
f.RData  s.RData
first second
  
  (on second thoughts, possibly 'loadFrom' is a better name)

 That's a nice little function.  You could also have lsFrom, that lists
 the objects stored in the file, along the same lines:

 lsFrom - function(file, all.names = FALSE, pattern) {
   e - new.env()
   load(file, envir = e)
   ls(e, all.names = all.names, pattern = pattern)
 }

 Duncan Murdoch

Note that the solution of simply using 

 attach(f.RData)

makes the use of  ls()  very natural, 
and for Rstudio and similar gui users, even automatically part of
their GUI.

Martin Maechler

__
R-help@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.


Re: [R] loading saved files with objects in same names

2014-08-22 Thread Jinsong Zhao

On 2014/8/22 1:02, Martin Maechler wrote:



Have you tried the 'envir' argument to load()?  E.g.,
envA - new.environment()
load(A.RData, envir=envA)
envB - new.environment()
load(B.RData, envir=envB)
plot(A$object, B$object)



Bill Dunlap
TIBCO Software
wdunlap tibco.com


An alternative that I have been advocating is using

   attach(A.RData)

etc. It does something similar as the above, but more
conveniently:
It loads the objects into a new environment  *and* attaches that
environment to your search()  path, so you can access them
directly, but attach() will never accidentally destroy existing
R objects in your global environment ( = search()[[1]] ).

Martin



Thanks a lot.

I try your method, and I got:

 attach(D2.1.RData)
The following objects are masked _by_ .GlobalEnv:

coda.jags.1, df.1, jags.1, Mean, N

In this case, how to access the masked objects?

Best,
Jinsong







On Mon, Aug 18, 2014 at 5:30 PM, Jinsong Zhao jsz...@yeah.net wrote:
Hi there,

I have several saved data files (e.g., A.RData, B.RData and C.RData). In
each file, there are some objects with same names but different contents.
Now, I need to compare those objects through plotting. However, I can't find
a way to load them into a workspace. The only thing I can do is to rename
them and then save and load again.

Is there a convenient to load those objects?

Thanks a lot in advance.

Best regards,
Jinsong



__
R-help@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.


Re: [R] loading saved files with objects in same names

2014-08-22 Thread Duncan Murdoch
On 22/08/2014, 1:14 PM, Jinsong Zhao wrote:
 On 2014/8/22 1:02, Martin Maechler wrote:

 Have you tried the 'envir' argument to load()?  E.g.,
 envA - new.environment()
 load(A.RData, envir=envA)
 envB - new.environment()
 load(B.RData, envir=envB)
 plot(A$object, B$object)

 Bill Dunlap
 TIBCO Software
 wdunlap tibco.com

 An alternative that I have been advocating is using

attach(A.RData)

 etc. It does something similar as the above, but more
 conveniently:
 It loads the objects into a new environment  *and* attaches that
 environment to your search()  path, so you can access them
 directly, but attach() will never accidentally destroy existing
 R objects in your global environment ( = search()[[1]] ).

 Martin

 
 Thanks a lot.
 
 I try your method, and I got:
 
   attach(D2.1.RData)
 The following objects are masked _by_ .GlobalEnv:
 
  coda.jags.1, df.1, jags.1, Mean, N
 
 In this case, how to access the masked objects?

Don't ever use attach(), and this won't be a problem.  Martin gave you
bad advice.

Duncan Murdoch

__
R-help@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.


Re: [R] loading saved files with objects in same names

2014-08-20 Thread Barry Rowlingson
On Tue, Aug 19, 2014 at 1:30 AM, Jinsong Zhao jsz...@yeah.net wrote:
 Hi there,

 I have several saved data files (e.g., A.RData, B.RData and C.RData). In
 each file, there are some objects with same names but different
 contents. Now, I need to compare those objects through plotting.
 However, I can't find a way to load them into a workspace. The only
 thing I can do is to rename them and then save and load again.

 Is there a convenient to load those objects?

 Thanks a lot in advance.

The technique of loading into an environment already mentioned can be
cleaned up and put into a function.

First lets save a thing called x into two files with different values:

  x=first
  save(x,file=f.RData)
  x=second
  save(x,file=s.RData)

This little function wraps the loading:

  getFrom=function(file, name){e=new.env();load(file,env=e);e[[name]]}

So now I can get 'x' from the first file - the value is returned from
`getFrom` so I can assign it to anything:

  x1 =  getFrom(f.RData,x)
  x1
[1] first
  x2 = getFrom(s.RData,x)
  x2
[1] second

And I can even loop over RData files and read in all the `x`s into a vector:

  sapply(c(f.RData,s.RData),function(f){getFrom(f,x)})
  f.RData  s.RData
  first second

(on second thoughts, possibly 'loadFrom' is a better name)

Barry

__
R-help@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.


Re: [R] loading saved files with objects in same names

2014-08-20 Thread Duncan Murdoch
On 20/08/2014, 8:58 AM, Barry Rowlingson wrote:
 On Tue, Aug 19, 2014 at 1:30 AM, Jinsong Zhao jsz...@yeah.net wrote:
 Hi there,

 I have several saved data files (e.g., A.RData, B.RData and C.RData). In
 each file, there are some objects with same names but different
 contents. Now, I need to compare those objects through plotting.
 However, I can't find a way to load them into a workspace. The only
 thing I can do is to rename them and then save and load again.

 Is there a convenient to load those objects?

 Thanks a lot in advance.
 
 The technique of loading into an environment already mentioned can be
 cleaned up and put into a function.
 
 First lets save a thing called x into two files with different values:
 
   x=first
   save(x,file=f.RData))
   x=second
   save(x,file=s.RData)
 
 This little function wraps the loading:
 
   getFrom=function(file, name){e=new.env();load(file,env=e);e[[name]]}
 
 So now I can get 'x' from the first file - the value is returned from
 `getFrom` so I can assign it to anything:
 
   x1 =  getFrom(f.RData,x)
   x1
 [1] first
   x2 = getFrom(s.RData,x)
   x2
 [1] second
 
 And I can even loop over RData files and read in all the `x`s into a vector:
 
   sapply(c(f.RData,s.RData),function(f){getFrom(f,x)})
   f.RData  s.RData
   first second
 
 (on second thoughts, possibly 'loadFrom' is a better name)

That's a nice little function.  You could also have lsFrom, that lists
the objects stored in the file, along the same lines:

lsFrom - function(file, all.names = FALSE, pattern) {
  e - new.env()
  load(file, envir = e)
  ls(e, all.names = all.names, pattern = pattern)
}

Duncan Murdoch

__
R-help@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.


[R] loading saved files with objects in same names

2014-08-18 Thread Jinsong Zhao

Hi there,

I have several saved data files (e.g., A.RData, B.RData and C.RData). In 
each file, there are some objects with same names but different 
contents. Now, I need to compare those objects through plotting. 
However, I can't find a way to load them into a workspace. The only 
thing I can do is to rename them and then save and load again.


Is there a convenient to load those objects?

Thanks a lot in advance.

Best regards,
Jinsong

__
R-help@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.


Re: [R] loading saved files with objects in same names

2014-08-18 Thread William Dunlap
Have you tried the 'envir' argument to load()?  E.g.,
   envA - new.environment()
   load(A.RData, envir=envA)
   envB - new.environment()
   load(B.RData, envir=envB)
   plot(A$object, B$object)

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Aug 18, 2014 at 5:30 PM, Jinsong Zhao jsz...@yeah.net wrote:
 Hi there,

 I have several saved data files (e.g., A.RData, B.RData and C.RData). In
 each file, there are some objects with same names but different contents.
 Now, I need to compare those objects through plotting. However, I can't find
 a way to load them into a workspace. The only thing I can do is to rename
 them and then save and load again.

 Is there a convenient to load those objects?

 Thanks a lot in advance.

 Best regards,
 Jinsong

 __
 R-help@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.

__
R-help@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.


Re: [R] loading saved files with objects in same names

2014-08-18 Thread Rolf Turner

On 19/08/14 14:20, William Dunlap wrote:

Have you tried the 'envir' argument to load()?  E.g.,
envA - new.environment()
load(A.RData, envir=envA)
envB - new.environment()
load(B.RData, envir=envB)
plot(A$object, B$object)



Did you mean

 plot(envA$object, envB$object)

???  Or am I misunderstanding something?

cheers,

Rolf



--
Rolf Turner
Technical Editor ANZJS

__
R-help@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.


Re: [R] loading saved files with objects in same names

2014-08-18 Thread William Dunlap
Rolf,
   Yes, I meant to write envA$object, etc, but did not read it twice
before running off to dinner.  Thanks.
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Aug 18, 2014 at 7:52 PM, Rolf Turner r.tur...@auckland.ac.nz wrote:
 On 19/08/14 14:20, William Dunlap wrote:

 Have you tried the 'envir' argument to load()?  E.g.,
 envA - new.environment()
 load(A.RData, envir=envA)
 envB - new.environment()
 load(B.RData, envir=envB)
 plot(A$object, B$object)



 Did you mean

  plot(envA$object, envB$object)

 ???  Or am I misunderstanding something?

 cheers,

 Rolf



 --
 Rolf Turner
 Technical Editor ANZJS

__
R-help@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.


Re: [R] loading saved files with objects in same names

2014-08-18 Thread Jinsong Zhao

On 2014/8/18 19:20, William Dunlap wrote:

Have you tried the 'envir' argument to load()?  E.g.,
envA - new.environment()
load(A.RData, envir=envA)
envB - new.environment()
load(B.RData, envir=envB)
plot(A$object, B$object)

Bill Dunlap
TIBCO Software
wdunlap tibco.com



Thank you very much. It is what I want.
new.environment() is not defined in R 3.1.1. There is new.env().

Best,
Jinsong



On Mon, Aug 18, 2014 at 5:30 PM, Jinsong Zhao jsz...@yeah.net wrote:

Hi there,

I have several saved data files (e.g., A.RData, B.RData and C.RData). In
each file, there are some objects with same names but different contents.
Now, I need to compare those objects through plotting. However, I can't find
a way to load them into a workspace. The only thing I can do is to rename
them and then save and load again.

Is there a convenient to load those objects?

Thanks a lot in advance.

Best regards,
Jinsong

__
R-help@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.




__
R-help@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.


[R] Loading an .RData file and assigning the loaded objects within a loop

2013-06-01 Thread Jeremy Ng
Hi all,

I tried to look this up online, but am still feeling a little stuck.

I have a bunch of Rdata files in side my directory, and I would like to
load all of them in a loop. Each time the next is read in, it would
over-write the previously read in object because they will be assigned the
same workspace object name.

Is there anyway for each individually read in Rdata object to be assigned a
new name?

Thanks!
JEremy

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading an .RData file and assigning the loaded objects within a loop

2013-06-01 Thread Jim Holtman
use 'lapply' to read in the .RData file.  Therefore each file is stored as an 
element of a list thatb
 you can access and change as necessary.

Sent from my iPad

On Jun 1, 2013, at 6:18, Jeremy Ng jeremy.ng.wk1...@gmail.com wrote:

 Hi all,
 
 I tried to look this up online, but am still feeling a little stuck.
 
 I have a bunch of Rdata files in side my directory, and I would like to
 load all of them in a loop. Each time the next is read in, it would
 over-write the previously read in object because they will be assigned the
 same workspace object name.
 
 Is there anyway for each individually read in Rdata object to be assigned a
 new name?
 
 Thanks!
 JEremy
 
[[alternative HTML version deleted]]
 
 __
 R-help@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.

__
R-help@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.


Re: [R] Loading an .RData file and assigning the loaded objects within a loop

2013-06-01 Thread Barry Rowlingson
Within lapply load the file and return the value of the thing or
things in the file you want. Something like this:

  files
[1] x1.RData x2.RData x3.RData x4.RData

  lapply(files,function(z){load(z);x})
[[1]]
[1] 1

[[2]]
[1] 22

[[3]]
[1] 333

[[4]]
[1] 

Each of my files contains a single number stored in an object called
'x'. Within the loop 'x' has the value just loaded from the file.

Another method is to use the environment argument of load to save into
an environment other than the global one...




On Sat, Jun 1, 2013 at 11:52 AM, Jim Holtman jholt...@gmail.com wrote:
 use 'lapply' to read in the .RData file.  Therefore each file is stored as an 
 element of a list thatb
  you can access and change as necessary.

 Sent from my iPad

 On Jun 1, 2013, at 6:18, Jeremy Ng jeremy.ng.wk1...@gmail.com wrote:

 Hi all,

 I tried to look this up online, but am still feeling a little stuck.

 I have a bunch of Rdata files in side my directory, and I would like to
 load all of them in a loop. Each time the next is read in, it would
 over-write the previously read in object because they will be assigned the
 same workspace object name.

 Is there anyway for each individually read in Rdata object to be assigned a
 new name?

 Thanks!
 JEremy

[[alternative HTML version deleted]]

 __
 R-help@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.

 __
 R-help@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.

__
R-help@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.


Re: [R] Loading an .RData file and assigning the loaded objects within a loop

2013-06-01 Thread Gabor Grothendieck
On Sat, Jun 1, 2013 at 6:18 AM, Jeremy Ng jeremy.ng.wk1...@gmail.com wrote:
 Hi all,

 I tried to look this up online, but am still feeling a little stuck.

 I have a bunch of Rdata files in side my directory, and I would like to
 load all of them in a loop. Each time the next is read in, it would
 over-write the previously read in object because they will be assigned the
 same workspace object name.

 Is there anyway for each individually read in Rdata object to be assigned a
 new name?


If Files is a character vector containing the filenames then this
creates a list witih one componet per RData file. The list names will
be the file names.  Each component is itself a list containing the
objects in that file:

L - sapply(Files, function(x) mget(load(x)), simplify = FALSE)

(If it is known that each RData file contains only a single object
then mget could be replaced with get in which case each component of L
would be the object in the respective file.  In that case you will
lose the object names but as you indicated they are all the same that
likely won' t matter.)

--
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

__
R-help@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.


Re: [R] Loading intraday data with zoo

2013-05-20 Thread arun
Hi,
You may need to add dec=, in the read.csv.
dat1- read.table(text=
Time;Mid
31/01/2013 00:00;1,35679
31/01/2013 00:01;1,35678
31/01/2013 00:02;1,356785
31/01/2013 00:03;1,35689
31/01/2013 00:04;1,3569
31/01/2013 00:05;1,3569
31/01/2013 00:06;1,356885
31/01/2013 00:07;1,35691
31/01/2013 00:08;1,357 
,sep=;,dec=,,header=TRUE,stringsAsFactors=FALSE)

f1 - function(...) as.POSIXct(paste(...), format = %d/%m/%Y %H:%M) 
library(zoo)
 b - read.zoo(dat1, index = 1, FUN  = f1) 

library(xts)
dat2- xts(b)
 dat2
#   x
#2013-01-31 00:00:00 1.356790
#2013-01-31 00:01:00 1.356780
#2013-01-31 00:02:00 1.356785
#2013-01-31 00:03:00 1.356890
#2013-01-31 00:04:00 1.356900
#2013-01-31 00:05:00 1.356900
#2013-01-31 00:06:00 1.356885
#2013-01-31 00:07:00 1.356910
#2013-01-31 00:08:00 1.357000
 plot(dat2)
A.K.



Hi all, 

I would like to do some time series analysis on intraday data. 
Therefore, I try to read some data with zoo and then convert them a 
xts-object. 

The data are like: 
Time;Mid 
31/01/2013 00:00;1,35679 
31/01/2013 00:01;1,35678 
31/01/2013 00:02;1,356785 
31/01/2013 00:03;1,35689 
31/01/2013 00:04;1,3569 
31/01/2013 00:05;1,3569 
31/01/2013 00:06;1,356885 
31/01/2013 00:07;1,35691 
31/01/2013 00:08;1,357 

My r-code is 
df-read.csv(file.csv, header=TRUE, sep=;) 
f1 - function(...) as.POSIXct(paste(...), format = %d/%m/%Y %H:%M) 
 b - read.zoo(df, index = 1, sep=;, header = TRUE, FUN  = f1) 
data-xts(b) 
plot(data) 

The following error occurs: 
Error in plot.window(...) : need finite 'ylim' values 
In addition: Warning messages: 
1: In as.double.xts(y) : NAs introduced by coercion 
2: In min(x) : no non-missing arguments to min; returning Inf 
3: In max(x) : no non-missing arguments to max; returning -Inf 

I think the problem is that the index does not recognize the 
%d/%m/%Y %H:%M format, but I do not know how to handle this problem. 
Does anyone know a solution to my problem? 
Thank you a lot! 
Michi 


Intraday.pdf
Description: Adobe PDF document
__
R-help@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.


[R] Loading of package RNetCDF fails

2013-04-27 Thread Marc Girondot
Dear Pavel Michna [maintainer of the package] (and copy to R-help 
Mailing List)


When I try to load the package RNetCDF (after install from CRAN) I get 
this message:
 library(RNetCDF, 
lib.loc=/Library/Frameworks/R.framework/Versions/3.0/Resources/library)

Error : .onLoad a échoué dans loadNamespace() pour 'RNetCDF', détails :
appel : NULL
erreur : I/O error (udunits)
Erreur : le chargement du package ou de l'espace de noms a échoué pour 
‘RNetCDF’


Anybody have some info about what's happened ?

In MacOSX 10.8.3, R3.0.0

Sincerely,

Marc Girondot

--
__
Marc Girondot, Pr

Laboratoire Ecologie, Systématique et Evolution
Equipe de Conservation des Populations et des Communautés
CNRS, AgroParisTech et Université Paris-Sud 11 , UMR 8079
Bâtiment 362
91405 Orsay Cedex, France

Tel:  33 1 (0)1.69.15.72.30   Fax: 33 1 (0)1.69.15.73.53
e-mail: marc.giron...@u-psud.fr
Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html
Skype: girondot

__
R-help@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.


Re: [R] Loading of package RNetCDF fails

2013-04-27 Thread Prof Brian Ripley

On 27/04/2013 14:40, Marc Girondot wrote:

Dear Pavel Michna [maintainer of the package] (and copy to R-help
Mailing List)

When I try to load the package RNetCDF (after install from CRAN) I get
this message:
  library(RNetCDF,
lib.loc=/Library/Frameworks/R.framework/Versions/3.0/Resources/library)
Error : .onLoad a échoué dans loadNamespace() pour 'RNetCDF', détails :
appel : NULL
erreur : I/O error (udunits)
Erreur : le chargement du package ou de l'espace de noms a échoué pour
‘RNetCDF’

Anybody have some info about what's happened ?

In MacOSX 10.8.3, R3.0.0

Sincerely,

Marc Girondot



This is to do with the CRAN binary package.  Please *DO* as we ask and 
discuss such issues on R-sig-mac.  You have been reminded before 


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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.


Re: [R] loading data frames and rbind them

2013-03-13 Thread A M Lavezzi
Dear Ivan and Greg, thaks a lot!

sorry for late reply, both ways work fine! I have to say that maybe Greg's
is a little faster (but I am working with a relatively small amount of
data, approx 130 xls files) so I do not notice remarkable differences.

The only suggestion I have is to add to the read.xlsx(...) part either:

stringsAsFactors=FALSE

or:

colClasses= c(numeric,character, ...)

to make the rbind operation robust (otherwise NA could be created)
thanks!
Mario


On Tue, Mar 12, 2013 at 10:17 PM, Greg Snow 538...@gmail.com wrote:

 The only real improveent I can see over Ivan's solution is to use lapply
 instead of the loop (this may just be person preference though).

 Something like:

 list_df - lapply( lista_rea_c, function(x) read.xls( file=
 paste0(path,x,/,x,.xls),1,header=TRUE,as.data.frame=TRUE))
 my_df - do.call(rbind, list_df)

 You could even do that as a single line if you really wanted to, but it
 would be less readable.  You could also make it a little more readable by
 putting the paste on its own line to create all the path/filenames in a
 variable to pass to lapply.



 On Tue, Mar 12, 2013 at 9:06 AM, Ivan Calandra 
 ivan.calan...@u-bourgogne.fr
  wrote:

  Hi Mario!
 
  I'm not really familiar with this kind of manipulations, but I think you
  can do it more or less like this (some people on this list might give a
  more detailed answer):
 
  #Create an empty named list
  list_df - vector(mode=list, length=length(lista_rec_c))
  names(list_df) - lista_rea_c##or some part of it using gsub or
  something similar
 
  #Import
  for (i in lista_rea_c) {
  list_df[[i]] - read.xlsx(...)
  }
 
  #rbind
  do.call(rbind, list_df)
 
  This probably won't work like this exactly but you should be able to make
  the modifications.
 
  HTH,
  Ivan
 
  --
  Ivan CALANDRA
  Université de Bourgogne
  UMR CNRS/uB 6282 Biogéosciences
  6 Boulevard Gabriel
  21000 Dijon, FRANCE
  +33(0)3.80.39.63.06
  ivan.calan...@u-bourgogne.fr
  http://biogeosciences.u-**bourgogne.fr/calandra
 http://biogeosciences.u-bourgogne.fr/calandra
 
  Le 12/03/13 15:52, A M Lavezzi a écrit :
 
  Hello everybody
 
  I have the following problem. I have to load a number of xls files from
  different folders (each xls file has the same number of columns, and
  different numbers of rows). Each xls file is named with a number, i.e.
  12345.xls and is contained in a folder with same name, say 12345)
 
  Once loaded, I want to rbind all of them to obtain a single database.
 
  I think I successfully did the first part, using assign:
 
  for (i in lista_rea_c){
 
  name=paste(reaNum,i,sep=,**collapse=NULL)
 
  assign(name,read.xlsx(file=**paste(path,i,/,i,.xls,sep=**
  ,collapse=NULL),1,header=**TRUE,as.data.frame=TRUE))
 
  }
 
  where lista_rea_c contains the numbers and is obtained
  as: lista_rea_c = list.files(path = /Users/mario/Dropbox/..., and path
 is
  defined elsewhere
  At this point I have a number of variables, names as reaNum12345 ecc.
 
  I would like to rbind all of them, but what I get is that I rbind
  reaNum12345, i.e. the variable name and not the data it contains.
 
  Can anyone help?
 
  thanks!
  Mario
 
 
 
 
  __**
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/**listinfo/r-help
 https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/**
  posting-guide.html http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
  __**
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/**listinfo/r-help
 https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/**
  posting-guide.html http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 



 --
 Gregory (Greg) L. Snow Ph.D.
 538...@gmail.com

 [[alternative HTML version deleted]]


 __
 R-help@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.




-- 
-- 
PLEASE NOTICE NEW EMAIL ADDRESS AND HOME PAGE URL

Andrea Mario Lavezzi
Dipartimento di Studi su Politica, Diritto e Società
Università di Palermo
Piazza Bologni 8
90134 Palermo, Italy
tel. ++39 091 23892208
fax ++39 091 6111268
skype: lavezzimario
email: mario.lavezzi (at) unipa.it
web: http://www.unipa.it/~mario.lavezzi

[[alternative HTML version deleted]]

__
R-help@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.


[R] loading data frames and rbind them

2013-03-12 Thread A M Lavezzi
Hello everybody

I have the following problem. I have to load a number of xls files from
different folders (each xls file has the same number of columns, and
different numbers of rows). Each xls file is named with a number, i.e.
12345.xls and is contained in a folder with same name, say 12345)

Once loaded, I want to rbind all of them to obtain a single database.

I think I successfully did the first part, using assign:

for (i in lista_rea_c){

name=paste(reaNum,i,sep=,collapse=NULL)

assign(name,read.xlsx(file=paste(path,i,/,i,.xls,sep=,collapse=NULL),1,header=TRUE,as.data.frame=TRUE))

}

where lista_rea_c contains the numbers and is obtained
as: lista_rea_c = list.files(path = /Users/mario/Dropbox/..., and path is
defined elsewhere
At this point I have a number of variables, names as reaNum12345 ecc.

I would like to rbind all of them, but what I get is that I rbind
reaNum12345, i.e. the variable name and not the data it contains.

Can anyone help?

thanks!
Mario


-- 
-- 
PLEASE NOTICE NEW EMAIL ADDRESS AND HOME PAGE URL

Andrea Mario Lavezzi
Dipartimento di Studi su Politica, Diritto e Società
Università di Palermo
Piazza Bologni 8
90134 Palermo, Italy
tel. ++39 091 23892208
fax ++39 091 6111268
skype: lavezzimario
email: mario.lavezzi (at) unipa.it
web: http://www.unipa.it/~mario.lavezzi

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] loading data frames and rbind them

2013-03-12 Thread Ivan Calandra

Hi Mario!

I'm not really familiar with this kind of manipulations, but I think you 
can do it more or less like this (some people on this list might give a 
more detailed answer):


#Create an empty named list
list_df - vector(mode=list, length=length(lista_rec_c))
names(list_df) - lista_rea_c##or some part of it using gsub or 
something similar


#Import
for (i in lista_rea_c) {
list_df[[i]] - read.xlsx(...)
}

#rbind
do.call(rbind, list_df)

This probably won't work like this exactly but you should be able to 
make the modifications.


HTH,
Ivan

--
Ivan CALANDRA
Université de Bourgogne
UMR CNRS/uB 6282 Biogéosciences
6 Boulevard Gabriel
21000 Dijon, FRANCE
+33(0)3.80.39.63.06
ivan.calan...@u-bourgogne.fr
http://biogeosciences.u-bourgogne.fr/calandra

Le 12/03/13 15:52, A M Lavezzi a écrit :

Hello everybody

I have the following problem. I have to load a number of xls files from
different folders (each xls file has the same number of columns, and
different numbers of rows). Each xls file is named with a number, i.e.
12345.xls and is contained in a folder with same name, say 12345)

Once loaded, I want to rbind all of them to obtain a single database.

I think I successfully did the first part, using assign:

for (i in lista_rea_c){

name=paste(reaNum,i,sep=,collapse=NULL)

assign(name,read.xlsx(file=paste(path,i,/,i,.xls,sep=,collapse=NULL),1,header=TRUE,as.data.frame=TRUE))

}

where lista_rea_c contains the numbers and is obtained
as: lista_rea_c = list.files(path = /Users/mario/Dropbox/..., and path is
defined elsewhere
At this point I have a number of variables, names as reaNum12345 ecc.

I would like to rbind all of them, but what I get is that I rbind
reaNum12345, i.e. the variable name and not the data it contains.

Can anyone help?

thanks!
Mario




__
R-help@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.


__
R-help@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.


Re: [R] loading data frames and rbind them

2013-03-12 Thread Greg Snow
The only real improveent I can see over Ivan's solution is to use lapply
instead of the loop (this may just be person preference though).

Something like:

list_df - lapply( lista_rea_c, function(x) read.xls( file=
paste0(path,x,/,x,.xls),1,header=TRUE,as.data.frame=TRUE))
my_df - do.call(rbind, list_df)

You could even do that as a single line if you really wanted to, but it
would be less readable.  You could also make it a little more readable by
putting the paste on its own line to create all the path/filenames in a
variable to pass to lapply.



On Tue, Mar 12, 2013 at 9:06 AM, Ivan Calandra ivan.calan...@u-bourgogne.fr
 wrote:

 Hi Mario!

 I'm not really familiar with this kind of manipulations, but I think you
 can do it more or less like this (some people on this list might give a
 more detailed answer):

 #Create an empty named list
 list_df - vector(mode=list, length=length(lista_rec_c))
 names(list_df) - lista_rea_c##or some part of it using gsub or
 something similar

 #Import
 for (i in lista_rea_c) {
 list_df[[i]] - read.xlsx(...)
 }

 #rbind
 do.call(rbind, list_df)

 This probably won't work like this exactly but you should be able to make
 the modifications.

 HTH,
 Ivan

 --
 Ivan CALANDRA
 Université de Bourgogne
 UMR CNRS/uB 6282 Biogéosciences
 6 Boulevard Gabriel
 21000 Dijon, FRANCE
 +33(0)3.80.39.63.06
 ivan.calan...@u-bourgogne.fr
 http://biogeosciences.u-**bourgogne.fr/calandrahttp://biogeosciences.u-bourgogne.fr/calandra

 Le 12/03/13 15:52, A M Lavezzi a écrit :

 Hello everybody

 I have the following problem. I have to load a number of xls files from
 different folders (each xls file has the same number of columns, and
 different numbers of rows). Each xls file is named with a number, i.e.
 12345.xls and is contained in a folder with same name, say 12345)

 Once loaded, I want to rbind all of them to obtain a single database.

 I think I successfully did the first part, using assign:

 for (i in lista_rea_c){

 name=paste(reaNum,i,sep=,**collapse=NULL)

 assign(name,read.xlsx(file=**paste(path,i,/,i,.xls,sep=**
 ,collapse=NULL),1,header=**TRUE,as.data.frame=TRUE))

 }

 where lista_rea_c contains the numbers and is obtained
 as: lista_rea_c = list.files(path = /Users/mario/Dropbox/..., and path is
 defined elsewhere
 At this point I have a number of variables, names as reaNum12345 ecc.

 I would like to rbind all of them, but what I get is that I rbind
 reaNum12345, i.e. the variable name and not the data it contains.

 Can anyone help?

 thanks!
 Mario




 __**
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/**
 posting-guide.html http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


 __**
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/**
 posting-guide.html http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading a list into the environment

2013-02-04 Thread Greg Snow
An often better approach is to use a function like with or within.  These
allow you to run a command with your list (data frame, environment, etc.)
in the first position of the search list so they behave like they are in
the global environment (actually better because they temporarily mask
rather than overwrite other objects of the same name), but do not clutter
up your global environment and/or search list.

You can use the attach (and detach) functions, but this is generally not as
good as with/within since the variables in your list can still be masked
and if you don't clean up after yourself then the search path gets really
cluttered (and therefore more masking and related problems).


On Fri, Feb 1, 2013 at 3:24 PM, Jonathan Greenberg j...@illinois.eduwrote:

 R-helpers:

 Say I have a list:

 myvariables - list(a=1:10,b=20)

 Is there a way to load the list components into the environment as
 variables based on the component names?  i.e. by applying this theoretical
 function to myvariables I would have the variables a and b loaded into the
 environment without having to explicitly define them.

 --j

 --
 Jonathan A. Greenberg, PhD
 Assistant Professor
 Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
 Department of Geography and Geographic Information Science
 University of Illinois at Urbana-Champaign
 607 South Mathews Avenue, MC 150
 Urbana, IL 61801
 Phone: 217-300-1924
 http://www.geog.illinois.edu/~jgrn/
 AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007

 [[alternative HTML version deleted]]

 __
 R-help@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.




-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading a list into the environment

2013-02-02 Thread Jonathan Greenberg
Thanks all!  list2env was exactly what I was looking for.  As an FYI (and
please correct me if I'm wrong), if you want to load a list into the
current environment, use:

myvariables - list(a=1:10,b=20)
loadenv - list2env(myvariables ,envir=environment())
a
b

--j


On Fri, Feb 1, 2013 at 5:49 PM, Rui Barradas ruipbarra...@sapo.pt wrote:

 Hello,

 Something like this?

 myfun - function(x, envir = .GlobalEnv){
 nm - names(x)
 for(i in seq_along(nm))
 assign(nm[i], x[[i]], envir)
 }

 myvariables - list(a=1:10,b=20)

 myfun(myvariables)
 a
 b


 Hope this helps,

 Rui Barradas

 Em 01-02-2013 22:24, Jonathan Greenberg escreveu:

  R-helpers:

 Say I have a list:

 myvariables - list(a=1:10,b=20)

 Is there a way to load the list components into the environment as
 variables based on the component names?  i.e. by applying this theoretical
 function to myvariables I would have the variables a and b loaded into the
 environment without having to explicitly define them.

 --j




-- 
Jonathan A. Greenberg, PhD
Assistant Professor
Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
Department of Geography and Geographic Information Science
University of Illinois at Urbana-Champaign
607 South Mathews Avenue, MC 150
Urbana, IL 61801
Phone: 217-300-1924
http://www.geog.illinois.edu/~jgrn/
AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007

[[alternative HTML version deleted]]

__
R-help@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.


[R] Loading a list into the environment

2013-02-01 Thread Jonathan Greenberg
R-helpers:

Say I have a list:

myvariables - list(a=1:10,b=20)

Is there a way to load the list components into the environment as
variables based on the component names?  i.e. by applying this theoretical
function to myvariables I would have the variables a and b loaded into the
environment without having to explicitly define them.

--j

-- 
Jonathan A. Greenberg, PhD
Assistant Professor
Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
Department of Geography and Geographic Information Science
University of Illinois at Urbana-Champaign
607 South Mathews Avenue, MC 150
Urbana, IL 61801
Phone: 217-300-1924
http://www.geog.illinois.edu/~jgrn/
AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading a list into the environment

2013-02-01 Thread Gabor Grothendieck
On Fri, Feb 1, 2013 at 5:24 PM, Jonathan Greenberg j...@illinois.edu wrote:
 R-helpers:

 Say I have a list:

 myvariables - list(a=1:10,b=20)

 Is there a way to load the list components into the environment as
 variables based on the component names?  i.e. by applying this theoretical
 function to myvariables I would have the variables a and b loaded into the
 environment without having to explicitly define them.

?list2env

--
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

__
R-help@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.


Re: [R] Loading a list into the environment

2013-02-01 Thread Rui Barradas

Hello,

Something like this?

myfun - function(x, envir = .GlobalEnv){
nm - names(x)
for(i in seq_along(nm))
assign(nm[i], x[[i]], envir)
}

myvariables - list(a=1:10,b=20)

myfun(myvariables)
a
b


Hope this helps,

Rui Barradas

Em 01-02-2013 22:24, Jonathan Greenberg escreveu:

R-helpers:

Say I have a list:

myvariables - list(a=1:10,b=20)

Is there a way to load the list components into the environment as
variables based on the component names?  i.e. by applying this theoretical
function to myvariables I would have the variables a and b loaded into the
environment without having to explicitly define them.

--j



__
R-help@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.


[R] Loading data into R

2013-01-26 Thread Christofer Bogaso
Hello again,

I generally use Clipboard to load data into R from Excel using the
read.delim() function. In most cases, my data after loading looks like
below:

myData - structure(list(V1 = structure(c(3L, 2L, 1L, 1L, 2L), .Label = c(,
2, a), class = factor), V2 = structure(c(4L, 3L, 1L, 2L,
1L), .Label = c(, 34, 4, b), class = factor), V3 = structure(c(3L,
1L, 1L, 1L, 2L), .Label = c(, 4, c), class = factor),
V4 = structure(c(3L, 1L, 1L, 2L, 1L), .Label = c(, 4,
d), class = factor), V5 = structure(c(4L, 3L, 1L, 1L,
2L), .Label = c(, 4, 7, f), class = factor)), .Names = c(V1,
V2, V3, V4, V5), class = data.frame, row.names = c(NA,
-5L))


 myData
  V1 V2 V3 V4 V5
1  a  b  c  d  f
2  2  47
3
434 4
5  2 4 4


Now I want to put this data in a Matrix class with all elements are
character. So tried this :

 as.character(myData)
[1] c(3, 2, 1, 1, 2) c(4, 3, 1, 2, 1) c(3, 1, 1, 1, 2) c(3, 1,
1, 2, 1) c(4, 3, 1, 1, 2)


This looks funny and does not conform the original data. Can somebody
point me what would be right way to put it into Matrix?

Thanks and regards,

__
R-help@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.


Re: [R] Loading data into R

2013-01-26 Thread Duncan Murdoch

On 13-01-26 3:00 PM, Christofer Bogaso wrote:

Hello again,

I generally use Clipboard to load data into R from Excel using the
read.delim() function. In most cases, my data after loading looks like
below:

myData - structure(list(V1 = structure(c(3L, 2L, 1L, 1L, 2L), .Label = c(,
2, a), class = factor), V2 = structure(c(4L, 3L, 1L, 2L,
1L), .Label = c(, 34, 4, b), class = factor), V3 = structure(c(3L,
1L, 1L, 1L, 2L), .Label = c(, 4, c), class = factor),
 V4 = structure(c(3L, 1L, 1L, 2L, 1L), .Label = c(, 4,
 d), class = factor), V5 = structure(c(4L, 3L, 1L, 1L,
 2L), .Label = c(, 4, 7, f), class = factor)), .Names = c(V1,
V2, V3, V4, V5), class = data.frame, row.names = c(NA,
-5L))



myData

   V1 V2 V3 V4 V5
1  a  b  c  d  f
2  2  47
3
434 4
5  2 4 4


Now I want to put this data in a Matrix class with all elements are
character. So tried this :


as.character(myData)

[1] c(3, 2, 1, 1, 2) c(4, 3, 1, 2, 1) c(3, 1, 1, 1, 2) c(3, 1,
1, 2, 1) c(4, 3, 1, 1, 2)


This looks funny and does not conform the original data. Can somebody
point me what would be right way to put it into Matrix?


Use as.matrix(myData).

Duncan Murdoch

__
R-help@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.


Re: [R] Loading data into R

2013-01-26 Thread arun
Hi,
myData[]-lapply(myData,as.character)
 as.matrix(myData)
# V1  V2   V3  V4  V5 
#[1,] a b  c d f
#[2,] 2 4      7
#[3,]           
#[4,]   34   4  
#[5,] 2    4   4


str(as.matrix(myData))
# chr [1:5, 1:5] a 2   2 b 4  34  ...
 #- attr(*, dimnames)=List of 2
  #..$ : NULL
  #..$ : chr [1:5] V1 V2 V3 V4 ...
A.K.



- Original Message -
From: Christofer Bogaso bogaso.christo...@gmail.com
To: r-help r-help@r-project.org
Cc: 
Sent: Saturday, January 26, 2013 3:00 PM
Subject: [R] Loading data into R

Hello again,

I generally use Clipboard to load data into R from Excel using the
read.delim() function. In most cases, my data after loading looks like
below:

myData - structure(list(V1 = structure(c(3L, 2L, 1L, 1L, 2L), .Label = c(,
2, a), class = factor), V2 = structure(c(4L, 3L, 1L, 2L,
1L), .Label = c(, 34, 4, b), class = factor), V3 = structure(c(3L,
1L, 1L, 1L, 2L), .Label = c(, 4, c), class = factor),
    V4 = structure(c(3L, 1L, 1L, 2L, 1L), .Label = c(, 4,
    d), class = factor), V5 = structure(c(4L, 3L, 1L, 1L,
    2L), .Label = c(, 4, 7, f), class = factor)), .Names = c(V1,
V2, V3, V4, V5), class = data.frame, row.names = c(NA,
-5L))


 myData
  V1 V2 V3 V4 V5
1  a  b  c  d  f
2  2  4        7
3
4    34     4
5  2     4     4


Now I want to put this data in a Matrix class with all elements are
character. So tried this :

 as.character(myData)
[1] c(3, 2, 1, 1, 2) c(4, 3, 1, 2, 1) c(3, 1, 1, 1, 2) c(3, 1,
1, 2, 1) c(4, 3, 1, 1, 2)


This looks funny and does not conform the original data. Can somebody
point me what would be right way to put it into Matrix?

Thanks and regards,

__
R-help@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.


__
R-help@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.


[R] Loading circular package from Rprofile.site

2013-01-13 Thread Ved P. Sharma
Hi,

I installed circular package and I wanted to load it automatically
when R starts up, so I added the following lines in file
Rprofile.site,

.First - function()
 library(circular)

When R starts up, it gives me the following error:
--
Loading required package: boot
Loading required package: graphics
Loading required package: stats
Error : .onAttach failed in attachNamespace() for 'circular', details:
  call: fun(libname, pkgname)
  error: could not find function packageDescription
Error: package/namespace load failed for ‘circular’
--

What's surprising is that instead of loading circular from the
Rprofile.site, if I run R and load this package

 library(circular)

it works fine and gives me the following message:
--
Loading required package: boot
Package 'circular', 0.4-3 (2011-07-18). Type 'help(Circular)' for
summary information.
 Please report any bugs or comments to Claudio Agostinelli clau...@unive.it
 The package redefine how function 'var' and 'sd' works
 In particular, (try 'methods(var)' and 'methods(sd)')
 notice that 'var.default' ('sd.default')is an alias for the original
'var' ('sd') function
 and that a method for data.frame is available.


Attaching package: ‘circular’

The following object(s) are masked from ‘package:stats’:

sd, var
--

I am puzzled as to why there are different responses to the same
command? FYI, I am running R version 2.15.2 (2012-10-26) on Windows 7,
i386-w64-mingw32/i386 (32-bit)

I have other installed packages, which load up fine from the
Rprofile.site at R startup. The error seems to occur only with
circular.

Ved

__
R-help@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.


Re: [R] Loading circular package from Rprofile.site

2013-01-13 Thread Prof Brian Ripley
This is a known bug in the package.  It should have used 
utils::packageDescription, or imported it in its NAMESPACE.  If this was 
not condiitonal on interactive() it would have be shown up in the CRAN 
package checks.


Rprofile.site is run early in the startup process: it is not really 
intended for such things.  Use ~/.Rprofile to load packages for your 
session.


On 13/01/2013 03:49, Ved P. Sharma wrote:

Hi,

I installed circular package and I wanted to load it automatically
when R starts up, so I added the following lines in file
Rprofile.site,

.First - function()
  library(circular)

When R starts up, it gives me the following error:
--
Loading required package: boot
Loading required package: graphics
Loading required package: stats
Error : .onAttach failed in attachNamespace() for 'circular', details:
   call: fun(libname, pkgname)
   error: could not find function packageDescription
Error: package/namespace load failed for ‘circular’
--

What's surprising is that instead of loading circular from the
Rprofile.site, if I run R and load this package


library(circular)


it works fine and gives me the following message:
--
Loading required package: boot
Package 'circular', 0.4-3 (2011-07-18). Type 'help(Circular)' for
summary information.
  Please report any bugs or comments to Claudio Agostinelli clau...@unive.it
  The package redefine how function 'var' and 'sd' works
  In particular, (try 'methods(var)' and 'methods(sd)')
  notice that 'var.default' ('sd.default')is an alias for the original
'var' ('sd') function
  and that a method for data.frame is available.


Attaching package: ‘circular’

The following object(s) are masked from ‘package:stats’:

 sd, var
--

I am puzzled as to why there are different responses to the same
command? FYI, I am running R version 2.15.2 (2012-10-26) on Windows 7,
i386-w64-mingw32/i386 (32-bit)

I have other installed packages, which load up fine from the
Rprofile.site at R startup. The error seems to occur only with
circular.

Ved

__
R-help@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.




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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.


[R] loading using Ryacas

2012-12-05 Thread Alicia Ellis
I'm having trouble loading Ryacas.  I've downloaded and extracted Ryacas
0.2-9 (also tried Ryacas ) and yacas 1.0.63, have the latest version of R
and have tried the following (this works for installing other packages):

install.packages(Ryacas)
library(Ryacas)
install.packages(yacas)
library(yacas)

and get this:
Warning message:
package ‘yacas’ is not available (for R version 2.15.2)

Got the same thing for R version 2.15.1.

Suggestions?  I'm fairly new to R and could use some detailed
instructions.  Working on Mac OSx 10.8.2

Thanks!
-- 
Alicia Ellis
Postdoc
Gund Institute for Ecological Economics
University of Vermont
617 Main Street
Burlington, VT  05405
(802) 656-1046
http://www.uvm.edu/~aellis5/
 http://entomology.ucdavis.edu/faculty/scott/aellis/

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] loading using Ryacas

2012-12-05 Thread David Winsemius


On Dec 5, 2012, at 10:21 AM, Alicia Ellis wrote:

I'm having trouble loading Ryacas.  I've downloaded and extracted  
Ryacas
0.2-9 (also tried Ryacas ) and yacas 1.0.63, have the latest version  
of R
and have tried the following (this works for installing other  
packages):


install.packages(Ryacas)
library(Ryacas)
install.packages(yacas)


Yacas is an external program and on the Mac (and Linux) needs to be  
installed outside of R.




library(yacas)

and get this:
Warning message:
package ‘yacas’ is not available (for R version 2.15.2)

Got the same thing for R version 2.15.1.

Suggestions?  I'm fairly new to R and could use some detailed
instructions.  Working on Mac OSx 10.8.2

Thanks!
--
Alicia Ellis
Postdoc
Gund Institute for Ecological Economics
University of Vermont
617 Main Street
Burlington, VT  05405
(802) 656-1046
http://www.uvm.edu/~aellis5/
http://entomology.ucdavis.edu/faculty/scott/aellis/

[[alternative HTML version deleted]]

__
R-help@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.


David Winsemius, MD
Alameda, CA, USA

__
R-help@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.


Re: [R] loading both RPostgreSQL and RSQLite leads to problems

2012-11-08 Thread Jon McAuliffe

hi martin,

i have installed 2.15.2 and tried your code example below, but
i still get the same error:


 library(RSQLite)
Loading required package: DBI
 library(RPostgreSQL)
 dbDriver('PostgreSQL')
Error in function (classes, fdef, mtable)  : 
  unable to find an inherited method for function  show  for signature  
PostgreSQLDriver 


are you able run this successfully in 2.15.2?

thanks
jon.


On Aug 23, 2012, at 12:38 PM, Martin Morgan wrote:

 On 08/22/2012 01:35 PM, Jon McAuliffe wrote:
 hello,
 
 if i load the RSQLite package in addition to the RPostgreSQL package,
 i get various errors when trying to use RPostgreSQL functions. here is
 an example transcript showing one such error:
 
 
 ==
 R version 2.15.0 (2012-03-30)
 [...]
 packageVersion('RPostgreSQL')
 [1]  0.3.2
 packageVersion('RSQLite')
 [1]  0.11.1
 library(RPostgreSQL)
 Loading required package: DBI
 dbDriver('PostgreSQL')
 PostgreSQLDriver:(32540)
 library(RSQLite)
 dbDriver('PostgreSQL')
 Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function show, for signature 
 PostgreSQLDriver
 
 Hi Jon --
 
 It seems like this has been addressed in the devel version of R
 
  library(RSQLite)
 Loading required package: DBI
  library(RPostgreSQL)
  dbDriver(PostgreSQL)
 An object of class PostgreSQLDriver
 Slot Id:
 [1] 12355
 
  sessionInfo()
 R Under development (unstable) (2012-08-20 r60336)
 Platform: x86_64-unknown-linux-gnu (64-bit)
 
 locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
 [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base
 
 other attached packages:
 [1] RPostgreSQL_0.3-2RSQLite_0.11.1   DBI_0.2-5
 
 
 ==
 
 
 below is the output of showMethods('show') in two scenarios:
 (1) RPostgreSQL loaded, RSQLite not loaded;
 (2) RPostgreSQL loaded, RSQLite loaded (in that order).
 i'd be grateful for any help resolving or working around this issue.
 if possible, please include my email address in any reply.
 
 best
 jon mcauliffe
 j...@mcauliffe.com
 
 
 
 (1)
 showMethods('show')
 Function: show (package methods)
 object=ANY
 object=classGeneratorFunction
 object=classRepresentation
 object=dbObjectId
 object=envRefClass
 object=function
(inherited from: object=ANY)
 object=genericFunction
 object=genericFunctionWithTrace
 object=MethodDefinition
 object=MethodDefinitionWithTrace
 object=MethodSelectionReport
 object=MethodWithNext
 object=MethodWithNextWithTrace
 object=namedList
 object=ObjectsWithPackage
 object=oldClass
 object=PostgreSQLDriver
(inherited from: object=dbObjectId)
 object=refClassRepresentation
 object=refMethodDef
 object=refObjectGenerator
 object=signature
 object=sourceEnvironment
 object=standardGeneric
(inherited from: object=genericFunction)
 object=traceable
 
 
 (2)
 showMethods('show')
 Function: show (package methods)
 object=ANY
 object=classGeneratorFunction
 object=classRepresentation
  (2 methods defined for this signature, with different packages)
 object=envRefClass
 object=genericFunction
 object=genericFunctionWithTrace
 object=MethodDefinition
 object=MethodDefinitionWithTrace
 object=MethodSelectionReport
 object=MethodWithNext
 object=MethodWithNextWithTrace
 object=namedList
 object=ObjectsWithPackage
 object=oldClass
 object=refClassRepresentation
 object=refMethodDef
 object=refObjectGenerator
 object=signature
 object=sourceEnvironment
 object=traceable
 
 __
 R-help@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.
 
 
 
 -- 
 Computational Biology / Fred Hutchinson Cancer Research Center
 1100 Fairview Ave. N.
 PO Box 19024 Seattle, WA 98109
 
 Location: Arnold Building M1 B861
 Phone: (206) 667-2793

__
R-help@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.


Re: [R] loading both RPostgreSQL and RSQLite leads to problems

2012-11-08 Thread Martin Morgan

On 11/8/2012 11:43 AM, Jon McAuliffe wrote:


hi martin,

i have installed 2.15.2 and tried your code example below, but
i still get the same error:



library(RSQLite)

Loading required package: DBI

library(RPostgreSQL)
dbDriver('PostgreSQL')

Error in function (classes, fdef, mtable)  :
   unable to find an inherited method for function  show  for signature  
PostgreSQLDriver


are you able run this successfully in 2.15.2?


This works for me with R-devel

 library(RSQLite)
Loading required package: DBI
 library(RPostgreSQL)
 dbDriver(PostgreSQL)
An object of class PostgreSQLDriver
Slot Id:
[1] 12873

 sessionInfo()
R Under development (unstable) (2012-11-04 r61084)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  utils datasets  grDevices methods   base

other attached packages:
[1] RPostgreSQL_0.3-3   RSQLite_0.11.2  DBI_0.2-5

but not R-2.15.2

 library(RSQLite)
Loading required package: DBI
 library(RPostgreSQL)
 dbDriver(PostgreSQL)
Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘show’ for signature 
‘PostgreSQLDriver’

 sessionInfo()
R version 2.15.2 Patched (2012-11-07 r61093)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] RPostgreSQL_0.3-3 RSQLite_0.11.2DBI_0.2-5




thanks
jon.


On Aug 23, 2012, at 12:38 PM, Martin Morgan wrote:


On 08/22/2012 01:35 PM, Jon McAuliffe wrote:

hello,

if i load the RSQLite package in addition to the RPostgreSQL package,
i get various errors when trying to use RPostgreSQL functions. here is
an example transcript showing one such error:


==
R version 2.15.0 (2012-03-30)
[...]

packageVersion('RPostgreSQL')

[1]  0.3.2

packageVersion('RSQLite')

[1]  0.11.1

library(RPostgreSQL)

Loading required package: DBI

dbDriver('PostgreSQL')

PostgreSQLDriver:(32540)

library(RSQLite)
dbDriver('PostgreSQL')

Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function show, for signature 
PostgreSQLDriver


Hi Jon --

It seems like this has been addressed in the devel version of R


library(RSQLite)

Loading required package: DBI

library(RPostgreSQL)
dbDriver(PostgreSQL)

An object of class PostgreSQLDriver
Slot Id:
[1] 12355


sessionInfo()

R Under development (unstable) (2012-08-20 r60336)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] RPostgreSQL_0.3-2RSQLite_0.11.1   DBI_0.2-5



==


below is the output of showMethods('show') in two scenarios:
(1) RPostgreSQL loaded, RSQLite not loaded;
(2) RPostgreSQL loaded, RSQLite loaded (in that order).
i'd be grateful for any help resolving or working around this issue.
if possible, please include my email address in any reply.

best
jon mcauliffe
j...@mcauliffe.com



(1)

showMethods('show')

Function: show (package methods)
object=ANY
object=classGeneratorFunction
object=classRepresentation
object=dbObjectId
object=envRefClass
object=function
(inherited from: object=ANY)
object=genericFunction
object=genericFunctionWithTrace
object=MethodDefinition
object=MethodDefinitionWithTrace
object=MethodSelectionReport
object=MethodWithNext
object=MethodWithNextWithTrace
object=namedList
object=ObjectsWithPackage
object=oldClass
object=PostgreSQLDriver
(inherited from: object=dbObjectId)
object=refClassRepresentation
object=refMethodDef
object=refObjectGenerator
object=signature
object=sourceEnvironment
object=standardGeneric
(inherited from: object=genericFunction)
object=traceable


(2)

showMethods('show')

Function: show (package methods)
object=ANY
object=classGeneratorFunction
object=classRepresentation
  (2 methods defined for this signature, with different packages)
object=envRefClass
object=genericFunction

Re: [R] Loading Chess Data

2012-09-11 Thread Robert Baer

On 9/2/2012 11:41 AM, David Arnold wrote:

All,

What would be the most efficient way to load the data at the following
address into a dataframe?

http://ratings.fide.com/top.phtml?list=men
It depends.  The most efficient for me was to highlight it, copy it to 
the windows clipboard and execute the following R command.

chess - read.table(file='clipboard', header = TRUE, sep = '\t')

If you want you can then set it to use in an R post or a script:
chess2 - dput(chess)
chess2
# You would include similar to the following in your script or email:
chess3 -
structure(list(Rank = 1:101, Name = structure(c(17L, 8L, 48L,
77L, 66L, 5L, 45L, 18L, 40L, 61L, 35L, 91L, 88L, 44L, 97L, 30L,
29L, 53L, 42L, 33L, 90L, 75L, 56L, 21L, 41L, 1L, 96L, 6L, 26L,
83L, 15L, 99L, 4L, 58L, 14L, 64L, 79L, 82L, 9L, 47L, 63L, 69L,
7L, 55L, 60L, 86L, 95L, 74L, 84L, 92L, 93L, 20L, 52L, 80L, 81L,
98L, 67L, 94L, 38L, 24L, 19L, 31L, 2L, 87L, 49L, 13L, 25L, 46L,
16L, 39L, 3L, 23L, 22L, 78L, 12L, 51L, 37L, 89L, 34L, 72L, 70L,
101L, 10L, 85L, 100L, 54L, 65L, 28L, 76L, 32L, 57L, 71L, 50L,
43L, 68L, 62L, 27L, 73L, 59L, 36L, 11L), .Label = c( Adams, Michael,
 Akopian, Vladimir,  Alekseev, Evgeny,  Almasi, Zoltan,
 Anand, Viswanathan,  Andreikin, Dmitry,  Areshchenko, Alexander,
 Aronian, Levon,  Bacrot, Etienne,  Balogh, Csaba,  Bartel, 
Mateusz,
 Bauer, Christian,  Berkes, Ferenc,  Bologan, Viktor,  Bruzon 
Batista, Lazaro,
 Bu, Xiangzhi,  Carlsen, Magnus,  Caruana, Fabiano,  Cheparinov, 
Ivan,

 Ding, Liren,  Dominguez Perez, Leinier,  Dreev, Aleksey,
 Edouard, Romain,  Efimenko, Zahar,  Eljanov, Pavel,  Fressinet, 
Laurent,
 Fridman, Daniel,  Gareev, Timur,  Gashimov, Vugar,  Gelfand, 
Boris,
 Georgiev, Kiril,  Gharamian, Tigran,  Giri, Anish,  Grachev, 
Boris,

 Grischuk, Alexander,  Gupta, Abhijeet,  Gyimesi, Zoltan,
 Harikrishna, P.,  Inarkiev, Ernesto,  Ivanchuk, Vassily,
 Jakovenko, Dmitry,  Jobava, Baadur,  Jones, Gawain C B,
 Kamsky, Gata,  Karjakin, Sergey,  Kasimdzhanov, Rustam,
 Korobov, Anton,  Kramnik, Vladimir,  Kryvoruchko, Yuriy,
 Kurnosov, Igor,  Laznicka, Viktor,  Le, Quang Liem,  Leko, Peter,
 Li, Chao b,  Malakhov, Vladimir,  Mamedyarov, Shakhriyar,
 Matlakov, Maxim,  McShane, Luke J,  Meier, Georg,  Moiseenko, 
Alexander,

 Morozevich, Alexander,  Motylev, Alexander,  Movsesian, Sergei,
 Naiditsch, Arkadij,  Najer, Evgeniy,  Nakamura, Hikaru,
 Navara, David,  Negi, Parimarjan,  Nepomniachtchi, Ian,
 Ni, Hua,  Nielsen, Peter Heine,  Onischuk, Alexander,
 Petrosian, Tigran L.,  Polgar, Judit,  Ponomariov, Ruslan,
 Potkin, Vladimir,  Radjabov, Teimour,  Ragger, Markus,
 Riazantsev, Alexander,  Rublevsky, Sergei,  Sargissian, Gabriel,
 Sasikiran, Krishnan,  Shirov, Alexei,  Short, Nigel D,
 So, Wesley,  Sokolov, Ivan,  Sutovsky, Emil,  Svidler, Peter,
 Tiviakov, Sergei,  Tomashevsky, Evgeny,  Topalov, Veselin,
 Vachier-Lagrave, Maxime,  Vallejo Pons, Francisco,  Van Wely, Loek,
 Vitiugov, Nikita,  Volokitin, Andrei,  Wang, Hao,  Wang, Yue,
 Wojtaszek, Radoslaw,  Zhigalko, Sergei,  Zvjaginsev, Vadim
), class = factor), Title = structure(c(1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
), .Label =  g, class = factor), Country = structure(c(22L,
1L, 25L, 3L, 27L, 16L, 25L, 18L, 26L, 25L, 25L, 5L, 25L, 27L,
6L, 17L, 3L, 15L, 13L, 21L, 25L, 26L, 3L, 7L, 25L, 10L, 26L,
25L, 12L, 19L, 7L, 24L, 15L, 10L, 20L, 14L, 25L, 16L, 12L, 26L,
1L, 25L, 26L, 25L, 26L, 21L, 25L, 15L, 10L, 12L, 11L, 6L, 29L,
25L, 1L, 6L, 8L, 21L, 16L, 26L, 5L, 5L, 1L, 17L, 26L, 15L, 26L,
28L, 6L, 25L, 25L, 12L, 25L, 2L, 12L, 8L, 15L, 21L, 25L, 27L,
6L, 25L, 15L, 23L, 4L, 6L, 25L, 27L, 25L, 12L, 25L, 9L, 25L,
10L, 16L, 25L, 14L, 1L, 14L, 16L, 24L), .Label = c( ARM,  AUT,
 AZE,  BLR,  BUL,  CHN,  CUB,  CZE,  DEN,  ENG,
 ESP,  FRA,  GEO,  GER,  HUN,  IND,  ISR,  ITA,
 LAT,  MDA,  NED,  NOR,  PHI,  POL,  RUS,  UKR,
 USA,  UZB,  VIE), class = factor), Rating = c(2843L,
2816L, 2797L, 2788L, 2783L, 2780L, 2778L, 2773L, 2769L, 2758L,
2754L, 2752L, 2747L, 2746L, 2742L, 2738L, 2737L, 2737L, 2734L,
2730L, 2730L, 2729L, 2729L, 2725L, 2724L, 2722L, 2718L, 2718L,
2714L, 2714L, 2713L, 2713L, 2713L, 2713L, 2712L, 2712L, 2712L,
2707L, 2705L, 2705L, 2705L, 2704L, 2702L, 2700L, 2699L, 2699L,
2699L, 2698L, 2698L, 2697L, 2697L, 2694L, 2693L, 2693L, 2693L,
2691L, 2691L, 2691L, 2690L, 2689L, 2689L, 2687L, 2687L, 2687L,
2686L, 2685L, 2684L, 2684L, 2683L, 2683L, 2682L, 2678L, 2677L,
2677L, 2676L, 2675L, 2674L, 2674L, 2672L, 2672L, 2671L, 2671L,
2668L, 2667L, 2667L, 2665L, 2664L, 2663L, 2663L, 2663L, 2663L,
2662L, 2660L, 2658L, 2658L, 2658L, 2657L, 2657L, 2656L, 2654L,
2654L), Games = c(10L, 0L, 0L, 0L, 10L, 0L, 9L, 0L, 0L, 2L, 9L,
0L, 9L, 

[R] Loading Chess Data

2012-09-02 Thread David Arnold
All,

What would be the most efficient way to load the data at the following
address into a dataframe?

http://ratings.fide.com/top.phtml?list=men

Thanks,

David



--
View this message in context: 
http://r.789695.n4.nabble.com/Loading-Chess-Data-tp4642006.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Loading Chess Data

2012-09-02 Thread jones

You might take a look at the link titled Download Rating List,
in the blue box on the right side of that page...

albyn

On 2012-09-02 9:41, David Arnold wrote:

All,

What would be the most efficient way to load the data at the 
following

address into a dataframe?

http://ratings.fide.com/top.phtml?list=men

Thanks,

David



--
View this message in context:
http://r.789695.n4.nabble.com/Loading-Chess-Data-tp4642006.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


__
R-help@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.


Re: [R] Loading Chess Data

2012-09-02 Thread Hasan Diwan
Mr Arnold,

 What would be the most efficient way to load the data at the following
 address into a dataframe?


To what end? In other words, what are you trying to achieve with the
ratings list? -- H
-- 
Sent from my mobile device
Envoyait de mon portable

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Loading Chess Data

2012-09-02 Thread Rui Barradas

Hello,

Try the following


library(XML)

url - http://ratings.fide.com/top.phtml?list=men;
chess - readHTMLTable(url, header = TRUE, which = 5)

str(chess)  # See what we have

# All variables are factors,
# convert these to integer
chess$Rating - as.integer(chess$Rating)
chess$Games - as.integer(chess$Games)
chess$`B-Year` - as.integer(chess$`B-Year`)

head(chess, 20)  # See first 20 rows


Hope this helps,

Rui Barradas
Em 02-09-2012 17:41, David Arnold escreveu:

All,

What would be the most efficient way to load the data at the following
address into a dataframe?

http://ratings.fide.com/top.phtml?list=men

Thanks,

David



--
View this message in context: 
http://r.789695.n4.nabble.com/Loading-Chess-Data-tp4642006.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


__
R-help@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.


[R] loading 'RcmdrPlugin.FactoMineR' pachage in R

2012-08-31 Thread Mahbubeh Parsaeian




- Forwarded Message -
From: Mahbubeh Parsaeian mahbobehparsae...@yahoo.com
To: r-help@r-project.org r-help@r-project.org
Cc: 
Sent: Friday, 31 August 2012, 17:18
Subject: loading 'RcmdrPlugin.FactoMineR' pachage in R

Hi everybody
I have a question about loading 'RcmdrPlugin.FactoMineR'
pachage in R.
I have installed Rcmdr, FactoMineR and 'RcmdrPlugin.FactoMineR.
when I want to load this package, at first a message inform me I should load
the following list of packages:
FactoMineR, ellipse, lattice, cluster, scatterplot3d, Rcmdr,
tcltk, car, MASS, nnet
I have loaded all above packages and again I load the  'RcmdrPlugin.FactoMineR' 
package.
The output is as follows:

local({pkg - select.list(sort(.packages(all.available =
TRUE)),graphics=TRUE)
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
Attaching package: 'RcmdrPlugin.FactoMineR'
The following object(s) are masked _by_ '.GlobalEnv':
    defmacro,
FactoAFDM, FactoCA, Factocatdes, FactoDMFA, FactoGPA,
    FactoHCPC,
FactoHMFA, FactoMCA, FactoMFA, FactoPCA, Factoprefpls,
    readDataSetFacto
The following object(s) are masked from 'package:Rcdr':
    defmacro



Would you please help me to find a good solution for this problem?
Thanks a lot.


__
R-help@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.


[R] loading 'RcmdrPlugin.FactoMineR' pachage in R

2012-08-31 Thread Mahbubeh Parsaeian
Hi everybody
I have a question about loading 'RcmdrPlugin.FactoMineR'
pachage in R.
I have installed Rcmdr, FactoMineR and 'RcmdrPlugin.FactoMineR.
when I want to load this package, at first a message inform me I should load
the following list of packages:
FactoMineR, ellipse, lattice, cluster, scatterplot3d, Rcmdr,
tcltk, car, MASS, nnet
I have loaded all above packages and again I load the  'RcmdrPlugin.FactoMineR' 
package.
The output is as follows:
#
local({pkg - select.list(sort(.packages(all.available =
TRUE)),graphics=TRUE)
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
Attaching package: 'RcmdrPlugin.FactoMineR'
The following object(s) are masked _by_ '.GlobalEnv':
    defmacro,
FactoAFDM, FactoCA, Factocatdes, FactoDMFA, FactoGPA,
    FactoHCPC,
FactoHMFA, FactoMCA, FactoMFA, FactoPCA, Factoprefpls,
    readDataSetFacto
The following object(s) are masked from 'package:Rcdr':
    defmacro
#
Would you please help me to find a good solution for this problem?
Thanks a lot.

__
R-help@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.


Re: [R] loading both RPostgreSQL and RSQLite leads to problems

2012-08-23 Thread Martin Morgan

On 08/22/2012 01:35 PM, Jon McAuliffe wrote:

hello,

if i load the RSQLite package in addition to the RPostgreSQL package,
i get various errors when trying to use RPostgreSQL functions. here is
an example transcript showing one such error:


==
R version 2.15.0 (2012-03-30)
[...]

packageVersion('RPostgreSQL')

[1]  0.3.2

packageVersion('RSQLite')

[1]  0.11.1

library(RPostgreSQL)

Loading required package: DBI

dbDriver('PostgreSQL')

PostgreSQLDriver:(32540)

library(RSQLite)
dbDriver('PostgreSQL')

Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function show, for signature 
PostgreSQLDriver


Hi Jon --

It seems like this has been addressed in the devel version of R

 library(RSQLite)
Loading required package: DBI
 library(RPostgreSQL)
 dbDriver(PostgreSQL)
An object of class PostgreSQLDriver
Slot Id:
[1] 12355

 sessionInfo()
R Under development (unstable) (2012-08-20 r60336)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] RPostgreSQL_0.3-2RSQLite_0.11.1   DBI_0.2-5



==


below is the output of showMethods('show') in two scenarios:
(1) RPostgreSQL loaded, RSQLite not loaded;
(2) RPostgreSQL loaded, RSQLite loaded (in that order).
i'd be grateful for any help resolving or working around this issue.
if possible, please include my email address in any reply.

best
jon mcauliffe
j...@mcauliffe.com



(1)

showMethods('show')

Function: show (package methods)
object=ANY
object=classGeneratorFunction
object=classRepresentation
object=dbObjectId
object=envRefClass
object=function
(inherited from: object=ANY)
object=genericFunction
object=genericFunctionWithTrace
object=MethodDefinition
object=MethodDefinitionWithTrace
object=MethodSelectionReport
object=MethodWithNext
object=MethodWithNextWithTrace
object=namedList
object=ObjectsWithPackage
object=oldClass
object=PostgreSQLDriver
(inherited from: object=dbObjectId)
object=refClassRepresentation
object=refMethodDef
object=refObjectGenerator
object=signature
object=sourceEnvironment
object=standardGeneric
(inherited from: object=genericFunction)
object=traceable


(2)

showMethods('show')

Function: show (package methods)
object=ANY
object=classGeneratorFunction
object=classRepresentation
  (2 methods defined for this signature, with different packages)
object=envRefClass
object=genericFunction
object=genericFunctionWithTrace
object=MethodDefinition
object=MethodDefinitionWithTrace
object=MethodSelectionReport
object=MethodWithNext
object=MethodWithNextWithTrace
object=namedList
object=ObjectsWithPackage
object=oldClass
object=refClassRepresentation
object=refMethodDef
object=refObjectGenerator
object=signature
object=sourceEnvironment
object=traceable

__
R-help@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.




--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

__
R-help@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.


[R] loading both RPostgreSQL and RSQLite leads to problems

2012-08-22 Thread Jon McAuliffe
hello,

if i load the RSQLite package in addition to the RPostgreSQL package,
i get various errors when trying to use RPostgreSQL functions. here is
an example transcript showing one such error:


==
R version 2.15.0 (2012-03-30)
[...]
 packageVersion('RPostgreSQL')
[1]  0.3.2 
 packageVersion('RSQLite')
[1]  0.11.1 
 library(RPostgreSQL)
Loading required package: DBI
 dbDriver('PostgreSQL')
PostgreSQLDriver:(32540) 
 library(RSQLite)
 dbDriver('PostgreSQL')
Error in function (classes, fdef, mtable)  : 
 unable to find an inherited method for function show, for signature 
PostgreSQLDriver
==


below is the output of showMethods('show') in two scenarios:
(1) RPostgreSQL loaded, RSQLite not loaded;
(2) RPostgreSQL loaded, RSQLite loaded (in that order).
i'd be grateful for any help resolving or working around this issue.
if possible, please include my email address in any reply.

best
jon mcauliffe
j...@mcauliffe.com



(1)
 showMethods('show')
Function: show (package methods)
object=ANY
object=classGeneratorFunction
object=classRepresentation
object=dbObjectId
object=envRefClass
object=function
   (inherited from: object=ANY)
object=genericFunction
object=genericFunctionWithTrace
object=MethodDefinition
object=MethodDefinitionWithTrace
object=MethodSelectionReport
object=MethodWithNext
object=MethodWithNextWithTrace
object=namedList
object=ObjectsWithPackage
object=oldClass
object=PostgreSQLDriver
   (inherited from: object=dbObjectId)
object=refClassRepresentation
object=refMethodDef
object=refObjectGenerator
object=signature
object=sourceEnvironment
object=standardGeneric
   (inherited from: object=genericFunction)
object=traceable


(2)
 showMethods('show')
Function: show (package methods)
object=ANY
object=classGeneratorFunction
object=classRepresentation
 (2 methods defined for this signature, with different packages)
object=envRefClass
object=genericFunction
object=genericFunctionWithTrace
object=MethodDefinition
object=MethodDefinitionWithTrace
object=MethodSelectionReport
object=MethodWithNext
object=MethodWithNextWithTrace
object=namedList
object=ObjectsWithPackage
object=oldClass
object=refClassRepresentation
object=refMethodDef
object=refObjectGenerator
object=signature
object=sourceEnvironment
object=traceable

__
R-help@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.


[R] Loading in Large Dataset + variables via loop

2012-07-15 Thread cmc0605
Hello, I'm new to R with a (probably elementary) question.

Suppose I have a dataset called /A/ with /n/ locations, and each location
contains within it 3 time series of different variables (all of 100 years
length); each time series is of a weather variable (for each location there
is a temperature, precipitation, and pressure).  For instance, location 1
has a temperature1 time series, a precip1 time series, and a pressure1 time
series; location two has a temperature2, precip2, and pressure2
timeseries...That is, there are 100 rows, and (/n/*3)+1 columns.  The extra
column is the time.

I want to load in this dataset and declare a variable for each time series. 
The columns are in order of location, so it goes temp1, precip1,pressure1,
temp2,... and so forth in increasing column order.  There are always 100
rows.  Manually, Id have to do:

temp1=A[,1]
precip1=A[,2]
pressure1=A[,3]
temp2=A[,4]
precip2=A[,5]
pressure2=A[,6]
temp3=A[,7]
and so forth.

Problem is, n is large, so I don't want to repeat this pattern forever.  I
figure I need a loop both for the variable name (ie.., the variable at a
particular location) as well as for what column it reads from.

Any help...?



--
View this message in context: 
http://r.789695.n4.nabble.com/Loading-in-Large-Dataset-variables-via-loop-tp4636501.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Loading in Large Dataset + variables via loop

2012-07-15 Thread Rui Barradas

Hello,

Why do you need 9 variables in your environment if they are time series 
that correspond to the same period? You should use time series functions.


#install.packages('zoo')
library(zoo)

# Make up a dataset
Year - seq(from=as.Date(1901-01-01), by=year, length.out=100)
dat - data.frame(matrix(rnorm(100*9), ncol=9), Year)

# assign names.
varNames - expand.grid(c(temp, precip, pressure), 1:3, 
stringsAsFactors=FALSE)

varNames - as.vector(apply(colNames, 1, paste, collapse=))
varNames - c(varNames, Year)
names(dat) - varNames
head(dat)

# and transform it into a time series of class 'zoo'
z - zoo(dat[, 1:9], order.by=dat$Year)
str(z)
head(z)


Another way would be, like you say, to use a loop to put the variables 
in a list. Something like


lst - list()
for(i in 1:9) lst[[i]] - dat[, i]
names(lst) - varNames


Note that I've used a dataset called 'dat' n place of your 'A'. You 
should post a data example, like the posting guide says. Using dput().


Hope this helps,

Rui Barradas



Em 14-07-2012 03:44, cmc0605 escreveu:

Hello, I'm new to R with a (probably elementary) question.

Suppose I have a dataset called /A/ with /n/ locations, and each location
contains within it 3 time series of different variables (all of 100 years
length); each time series is of a weather variable (for each location there
is a temperature, precipitation, and pressure).  For instance, location 1
has a temperature1 time series, a precip1 time series, and a pressure1 time
series; location two has a temperature2, precip2, and pressure2
timeseries...That is, there are 100 rows, and (/n/*3)+1 columns.  The extra
column is the time.

I want to load in this dataset and declare a variable for each time series.
The columns are in order of location, so it goes temp1, precip1,pressure1,
temp2,... and so forth in increasing column order.  There are always 100
rows.  Manually, Id have to do:

temp1=A[,1]
precip1=A[,2]
pressure1=A[,3]
temp2=A[,4]
precip2=A[,5]
pressure2=A[,6]
temp3=A[,7]
and so forth.

Problem is, n is large, so I don't want to repeat this pattern forever.  I
figure I need a loop both for the variable name (ie.., the variable at a
particular location) as well as for what column it reads from.

Any help...?



--
View this message in context: 
http://r.789695.n4.nabble.com/Loading-in-Large-Dataset-variables-via-loop-tp4636501.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.


Re: [R] Loading in Large Dataset + variables via loop

2012-07-15 Thread Rui Barradas

Hello,

Right, it should be 'varNames' in the apply. I guess I had something 
called colNames in my environment. I've just rm(list=ls()) and rerun the 
code, corrected. No errors this time.


varNames is the result of expand.grid, therefore does have a dim attribute.

The faulty instruction corrected is:

varNames - as.vector(apply(varNames, 1, paste, collapse=))

Rui Barradas

Em 15-07-2012 18:12, arun escreveu:

Hi Rui,

Getting some error messages:


varNames - as.vector(apply(colNames, 1, paste, collapse=))
Error in apply(colNames, 1, paste, collapse = ) :
   dim(X) must have a positive length

A.K.



- Original Message -
From: Rui Barradas ruipbarra...@sapo.pt
To: cmc0605 colos...@gmail.com
Cc: r-help@r-project.org
Sent: Sunday, July 15, 2012 8:12 AM
Subject: Re: [R] Loading in Large Dataset + variables via loop

Hello,

Why do you need 9 variables in your environment if they are time series
that correspond to the same period? You should use time series functions.

#install.packages('zoo')
library(zoo)

# Make up a dataset
Year - seq(from=as.Date(1901-01-01), by=year, length.out=100)
dat - data.frame(matrix(rnorm(100*9), ncol=9), Year)

# assign names.
varNames - expand.grid(c(temp, precip, pressure), 1:3,
stringsAsFactors=FALSE)
varNames - as.vector(apply(colNames, 1, paste, collapse=))
varNames - c(varNames, Year)
names(dat) - varNames
head(dat)

# and transform it into a time series of class 'zoo'
z - zoo(dat[, 1:9], order.by=dat$Year)
str(z)
head(z)


Another way would be, like you say, to use a loop to put the variables
in a list. Something like

lst - list()
for(i in 1:9) lst[[i]] - dat[, i]
names(lst) - varNames


Note that I've used a dataset called 'dat' n place of your 'A'. You
should post a data example, like the posting guide says. Using dput().

Hope this helps,

Rui Barradas



Em 14-07-2012 03:44, cmc0605 escreveu:

Hello, I'm new to R with a (probably elementary) question.

Suppose I have a dataset called /A/ with /n/ locations, and each location
contains within it 3 time series of different variables (all of 100 years
length); each time series is of a weather variable (for each location there
is a temperature, precipitation, and pressure).  For instance, location 1
has a temperature1 time series, a precip1 time series, and a pressure1 time
series; location two has a temperature2, precip2, and pressure2
timeseries...That is, there are 100 rows, and (/n/*3)+1 columns.  The extra
column is the time.

I want to load in this dataset and declare a variable for each time series.
The columns are in order of location, so it goes temp1, precip1,pressure1,
temp2,... and so forth in increasing column order.  There are always 100
rows.  Manually, Id have to do:

temp1=A[,1]
precip1=A[,2]
pressure1=A[,3]
temp2=A[,4]
precip2=A[,5]
pressure2=A[,6]
temp3=A[,7]
and so forth.

Problem is, n is large, so I don't want to repeat this pattern forever.  I
figure I need a loop both for the variable name (ie.., the variable at a
particular location) as well as for what column it reads from.

Any help...?



--
View this message in context: 
http://r.789695.n4.nabble.com/Loading-in-Large-Dataset-variables-via-loop-tp4636501.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.



__
R-help@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.


[R] Loading R scripts stored behind htaccess

2012-07-13 Thread Gaj Stan (BIGCAT)
Hello,

Within my department I would like to share the latest version(s) of my R 
scripts to my colleagues using subversion. This repository is password 
protected (WebDAV) as it should not be accessed by external persons. 
In the majority of my scripts I load scripts using the source() function, but 
this will now return a ''401 Authorization Required'  error.

I've been browsing through the RCurl documentation, since this seems to be the 
package that will allow me to do this and use the following line of code to 
download the script content and load a single script:

  x - getURL(http://www.example.com/script.R;, userpwd=key:secret) 
  write(x, script.R)
  source(script.R)

I have two direct questions related to this:
- Can this be done in an easier/neater way? In some cases there are a 
considerable amount of scripts that need to be downloaded (up to 7 or so). If 
not, then this will be converted to a small function. Ideally the scripts 
should be loaded immediately, without any download steps.
- I'm not really in favor of storing user names and passwords in scripts. Does 
anyone know of a way where R asks the user which login credentials to use, 
stores this in an (encrypted) variable and then uses this to access the website?

Best,

  -- Stan

__
R-help@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.


[R] Loading the stupid dataset--help!!!

2012-05-19 Thread SteveQ
I am using the following: 
library(RODBC)
chan = odbcConnectExcel(rats-lda)
rats.lda = sqlFetch(chan, data)
close(chan) 

And getting the following error message:
 library(RODBC)
Error in library(RODBC) : there is no package called ‘RODBC’
 chan = odbcConnectExcel(rats-lda)
Error: could not find function odbcConnectExcel
 rats.lda = sqlFetch(chan, data)
Error: could not find function sqlFetch
 close(chan) 



I am sure there is a simple answer to this.  Thanks.

--
View this message in context: 
http://r.789695.n4.nabble.com/Loading-the-stupid-dataset-help-tp4630585.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Loading the stupid dataset--help!!!

2012-05-19 Thread Kevin E. Thorpe

On 05/19/2012 07:44 AM, SteveQ wrote:

I am using the following:
library(RODBC)
chan = odbcConnectExcel(rats-lda)
rats.lda = sqlFetch(chan, data)
close(chan)

And getting the following error message:

library(RODBC)

Error in library(RODBC) : there is no package called ‘RODBC’


The above error message indicates that the ROBDC package is not
installed.  Have you done an install.packages(ROBDC)?


chan = odbcConnectExcel(rats-lda)

Error: could not find function odbcConnectExcel

rats.lda = sqlFetch(chan, data)

Error: could not find function sqlFetch

close(chan)




I am sure there is a simple answer to this.  Thanks.



--
Kevin E. Thorpe
Biostatistician/Trialist,  Applied Health Research Centre (AHRC)
Li Ka Shing Knowledge Institute of St. Michael's
Assistant Professor, Dalla Lana School of Public Health
University of Toronto
email: kevin.tho...@utoronto.ca  Tel: 416.864.5776  Fax: 416.864.3016

__
R-help@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.


  1   2   3   >