Re: [R] Making a markov transition matrix

2006-01-22 Thread Charles and Kimberly Maner

Ajay--you seem to have gotten your question answered regarding putting your
dataframe in the correct format, etc.  If you haven't already, you might
want to check out the MSM package for multi-state Markov and hidden Markov
models in continuous time.  It's been quite useful for some of my work
regarding estimating Markov chains/matrices and is actively maintained.


Thanks,
Charles

<<< you wrote >>>

Folks,

I am holding a dataset where firms are observed for a fixed (and
small) set of years. The data is in "long" format - one record for one
firm for one point in time. A state variable is observed (a factor).

I wish to make a markov transition matrix about the time-series
evolution of that state variable. The code below does this. But it's
hardcoded to the specific years that I observe. How might one
generalise this and make a general function which does this? :-)

   -ans.



set.seed(1001)

# Raw data in long format --
raw <- data.frame(name=c("f1","f1","f1","f1","f2","f2","f2","f2"),
  year=c(83,   84,  85,  86,  83,  84,  85,  86),
  state=sample(1:3, 8, replace=TRUE)
  )
# Shift to wide format --
fixedup <- reshape(raw, timevar="year", idvar="name", v.names="state",
   direction="wide")
# Now tediously build up records for an intermediate data structure
try <- rbind(
 data.frame(prev=fixedup$state.83, new=fixedup$state.84),
 data.frame(prev=fixedup$state.84, new=fixedup$state.85),
 data.frame(prev=fixedup$state.85, new=fixedup$state.86)
 )
# This is a bad method because it is hardcoded to the specific values
# of "year".
markov <- table(destination$prev.state, destination$new.state)

-- 
Ajay Shah  http://www.mayin.org/ajayshah

[EMAIL PROTECTED]
http://ajayshahblog.blogspot.com
<*(:-? - wizard who doesn't know the answer.


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Graphics on MacOSX

2005-08-07 Thread Charles and Kimberly Maner

Yet another approach is to create a postscript file on R for MacOSX and
convert to a windows metafile is:

> postscript("test.ps", width=5.0, height=6.0, paper="special")
> xyplot(1~1)
> dev.off

Then, using the "free"/included MacOSX bundled software, GraphicConverter,
convert the just-created postscript file to a WMF, (Windows Metafile
Graphics), format.  (This software has a batch conversion utility for
converting multiple graphs--just select the multiple files and off you go.)
Then, just import the newly converted .wmf files as you normally would into
MS Word/MS Powerpoint.  One (tiny) detail, though, is there is a bit of
cropping you may have to do as the paper size, at least on mine, defaulted
to letter, (which is the default).  The paper size did not restrict itself
to the 5"x6 " I specified earlier, but rather just the image size, (as
advertised in the documentation.)

However, the final printed product is as you wish--quality commensurate with
the Win32 version.


Good luck,
Charles


On Aug 4, 2005, at 9:13 AM, Martin Henry H. Stevens wrote:  
 
> This is a big issue for me, causing many days of angst. I finally  
> stumbled on the following solution. I create a device save an image  
> with postscript(). I then open it in Adobe Acrobat, select the area I  
> want, enlarge to at least 400%, then copy, then paste into PowerPoint  
> or Word. Alternatively, you can simply save a graphics image through  
> the gui and it saves it as pdf. Then go through the steps of selecting,  
> enlarging and copying in Acrobat. I am guessing real graphics programs  
> would work as well (Photoshop or Illustrator), but I don't have those.  
>  
> Hank Stevens  
>  
>  
> On Aug 4, 2005, at 8:03 AM, Weismann_D wrote:  
>  
>> Ist there a possibility on MacOSX to import Graphics into MSOffice  
>> Applications and resize them there without decreased quality? When I  
>> import  
>> via copy&paste I get low quality bitmaps and via import pictures (pdf)  
>> it is  
>> all the same. In the Windows versions of R there is the convienient  
>> way to  
>> use metafile format which can easily be resized in ppt and word. What  
>> is the  
>> equivalent way on MacOSX?  
>> Thanks, Dirk.  
 
You could try creating a PNG with bitmap() using a high resolution,  
e.g.,  
 
bitmap("test.png", type = "png256", res = 1200)  
plot(1:10, rnorm(10))  
dev.off()  
 
Preview can read the resulting PNG file just fine and the Windows  
version of Office can insert PNGs, displays them well, and allows  
resizing. (I don't have an OS X version of Office so can't test that  
the OS X version would handle the PNGs equally well but I would have to  
assume it does.)  
 
bitmap() requires Ghostscript which I have installed on my system in  
/usr/local/bin. I'm not sure whether Ghostscript came with OS X or if I  
installed it myself but it's freely available.  
 
Hope this helps,  
 
Stephen  
 
PS I am using the out-of-the-box R.app:  
 
platform powerpc-apple-darwin7.9.0  
arch powerpc  
os   darwin7.9.0  
system   powerpc, darwin7.9.0  
status   Patched  
major2  
minor1.0  
year 2005  
month05  
day  12  
 
and Ghostscript 8.13 (2003-12-31)  


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] RODBC, IODBC and Mac OS X

2005-03-13 Thread Charles and Kimberly Maner

Hi.  Another, slightly more updated, link to the same info is:

http://bioconductor.org/, under the Developmental Packages under Software,
contains Rdbi version 1.1.1 and RdbiPgSQL version 1.1.3.  I am running them
under MacOSX and they work beautifully.  I am using it to pull data on
PostgreSQL servers running on the same machine as well as a remote FreeBSD
PostgreSQL server.  I'm getting quite respectable performance to boot.


Good luck,
Charles

- Original Message - 
Message: 23
Date: Sat, 12 Mar 2005 18:07:55 -0500
From: "Sean Davis" <[EMAIL PROTECTED]>
Subject: Re: [R] RODBC, IODBC and Mac OS X
To: , "Depiereux Constant"
<[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=response

Have you looked at these two packages that, together, provide Postgres 
access and do not require ODBC?  I have found them quite useful and I use 
them on Panther:

http://www.bioconductor.org/repository/release1.5/package/html/Rdbi.html
http://www.bioconductor.org/repository/release1.5/package/html/RdbiPgSQL.htm
l

Sean

- Original Message - 
From: "Depiereux Constant" <[EMAIL PROTECTED]>
To: 
Sent: Saturday, March 12, 2005 5:21 PM
Subject: [R] RODBC, IODBC and Mac OS X


> Dear All,
>
> As some of you in the archive, i am experiencing problems in using RODBC 
> with IODBC on Mac OS X Panther.
>
> I am currrently facing two problems.
>
> The first one is apparently linked with IODBC (according to returned R 
> error message) although testing the database access from IODBC manager 
> seems to work fine.
>
> The second is by far more radical, R purely and simply reports an error , 
> blocks and I finally got a Mac OS X message.
>
> I browsed the archive without really finding a solution. Before spending 
> lengthy hours on an operating system that I am currently discovering, I 
> have therefore a simple question :
>
> DOES ANY BODY HAVE A COOKBOOK EXPLAINING HOW TO ACCESS - THRU ODBC - A 
> POSTGRESQL DATABASE USING R ON MAC OS X PANTHER ?
>
> Thanks in advance for your help.
>
>
>
>
>
> Constant Depihreux
> Managing Director
> Applied Quality Technologies Europe sprl
> Rue des Diportis 123, B4800   Verviers
> Tel : + 32 87 29 21 75
> Fax : +32 87 29 21 71
> Mobile : +32 475 555 818
> e-Mail : [EMAIL PROTECTED]
> Web presence : http://www.aqte.be
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] rodbc or unixodbc error

2005-02-22 Thread Charles and Kimberly Maner

Hi Sebastian.  Another option you "may" want to entertain is the Rdbi
packages from GRASS, http://grass.itc.it/statsgrass/r_and_dbms.html.  This
page begins with Postgresql but does have an option for MySQL.  I'm running
FreeBSD and unixODBC and never got RODBC running as it should.  Also, the
stats these guys thow up from a speed standpoint are fairly impressive.
Again, another option for you to consider if you haven't already.


Charles

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] RE: Reading Dates in a csv File

2005-02-07 Thread Charles and Kimberly Maner

Hi all.  Thanks for all of your help/suggestions.  I found an old email in
the R-help archives, pieced together a couple things and arrived at the
solution below.  As an additional followup, I thought I would go ahead and
post it should other readers come across this same situation.  Here goes..

Raw data:
MHK,76.53,05/21/2004,5/4/2004 4:00:00 PM,60
MHK,76.53,06/21/2004,5/5/2004 4:00:00 PM,60
MHK,76.53,07/21/2004,5/6/2004 4:00:00 PM,65
MHK,76.53,08/21/2004,5/7/2004 4:00:00 PM,65
MHK,76.53,09/21/2004,5/8/2004 4:00:00 PM,70

Code:
read_file <- function(file,nrows=-1) {

   # create temp classes
   setClass("t_class_",representation("character"))
   setAs("character", "t_class_", function(from)
as.POSIXct(strptime(from,format="%m/%d/%Y")))
  
   setClass("t_class2_", representation("character"))
   setAs("character", "t_class2_", function(from)
as.POSIXct(strptime(from,format="%m/%d/%Y %I:%M:%S %p")))

   # read the file
   file <- read.csv(file,
header=FALSE,
comment.char = "",
nrows=nrows,
as.is=FALSE,
col.names=c("c_field_1",
"n_field_2",
"d_field_3",
"d_field_4",
"n_field_5),
 colClasses=c("character",
  "numeric",
  "t_class_",
  "t_class2_",
  "numeric")
 )

   # remove them now that we are done with them
   removeClass("t_class_")
   removeClass("t_class2_")

   return(file)

}

If any of you folks know a better way and/or have comments/enhancements to
this code, feel free to post/email your critique.


Thanks,
Charles




> _ 
> From: Charles and Kimberly Maner [mailto:[EMAIL PROTECTED]
> 
> Sent: Thursday, February 03, 2005 8:35 AM
> To:   'r-help@stat.math.ethz.ch'
> Subject:  Reading Dates in a csv File
> 
> 
> Hi all.  I'm reading in a flat, comma-delimited flat file using read.csv.
> It works marvelously for the most part.  I am using the colClasses
> argument to, basically, create numeric, factor and character classes for
> the columns I'm reading in.  However, a couple of the fields in the file
> are date fields.  I'm fully aware that POSIXct can be used as a class,
> however the field must obey, (I think), the standard/default POSIXct
> format.  Hence the following question:  Does anyone have a method they can
> share to read in a non-standard formatted date to convert to POSIXct?  I
> can read it in then convert it, but that's a two pass approach and not as
> elegant as a single pass through read.csv.  I've read, from the
> documentation, that "[o]therwise there needs to be an as method (from
> package methods) for conversion from "character" to the specified formal
> class" but I do not know and have not figured out how to do that.
> 
> Any suggestion(s) would be greatly appreciated.
> 
> 
> Thanks,
> Charles

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Reading Dates in a csv File

2005-02-03 Thread Charles and Kimberly Maner

Hi all.  I'm reading in a flat, comma-delimited flat file using read.csv.
It works marvelously for the most part.  I am using the colClasses argument
to, basically, create numeric, factor and character classes for the columns
I'm reading in.  However, a couple of the fields in the file are date
fields.  I'm fully aware that POSIXct can be used as a class, however the
field must obey, (I think), the standard/default POSIXct format.  Hence the
following question:  Does anyone have a method they can share to read in a
non-standard formatted date to convert to POSIXct?  I can read it in then
convert it, but that's a two pass approach and not as elegant as a single
pass through read.csv.  I've read, from the documentation, that "[o]therwise
there needs to be an as method (from package methods) for conversion from
"character" to the specified formal class" but I do not know and have not
figured out how to do that.

Any suggestion(s) would be greatly appreciated.


Thanks,
Charles

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] an R script editor for Mac

2005-01-23 Thread Charles and Kimberly Maner

Also, you might want to consider using VIM, http://vim.org or
http://macvim.org/.  I run it on my 17" PB as it is my editor of choice.  As
with the emacs varieties, if you are not familiar with it, it does have a
bit of a learning curve.  However, it absolutely does syntax highlighting,
auto-indent, etc.  At least there are a couple different very capable open
source editors out there for you to choose from which do what you asking.


Good luck,
Charles


On Jan 21, 2005, at 6:40 AM, Sean Davis wrote:

> Consider using ESS and xemacs or emacs.  You get syntax highlighting, 
> auto-indent, command auto-complete, transcripts for your session,
> integrated help, and the tools of one of the most powerful text editors 
> on the planet.  The learning curve is a bit steep, but if you use R 
> much, it is worth it.

> Sean

On Jan 21, 2005, at 5:35 AM, Jacques VESLOT wrote:

> Dear all,
>
> Could someone please make me know if there is a nice script editor 
> available
> under Mac, similar to Crimson, that offers R syntax highlighting (and 
> pairs
> of parentheses underlining) ?
>
> Thanks in advance,
>
> Jacques VESLOT
> Cirad
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R packages on Mac

2005-01-08 Thread Charles and Kimberly Maner

Hi Sam.  I have R 2.0.0, (haven't upgraded to 2.0.1 yet), on my Mac
Powerbook 17" and it works like a complete champ.  I've had no trouble
whatsoever w/installing it, packages or the like.  In fact, IMHO the good
folks on the dev team for R have a bit more of a GUI for Mac than even for
Windows, (def not trying to start a debate here.)  Also, as an aside, I was
prev running, FreeBSD 4.10 and could not install a few R packages due to the
fact that I was running an older gcc compiler, (2.95 to be exact.)  Since
Mac's gcc is gcc 3.x, (3.2 I think), I've had no probs installing/compiling
packages for R.  So, from my POV, you really can't go wrong w/a Mac OSX
product.  I heartily recommend it as a user-friendly UNIX platform for R and
related analytics.

If you've specific questions, reply back to me or the newsgroup.  There is
an open source package called Fink, (http://fink.sourceforge.net/), which
you will find invaluable for installing some of the base software(s) that
may be req for some R packages such as the gcc Fortran compiler.  It's a
snap to install sources using Fink and it does all the managing for you.
Fink is the Mac analog of Debians "apt" package manager.

Good luck and, should you choose to go with Mac I'm relatively confident you
will not be disappointed.


Thanks,
Charles

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] JDBC DB access in R

2004-10-24 Thread Charles and Kimberly Maner

Hi.  One thing you might also want to consider is the RDBI/RdbiPgSQL suite
at GRASS found at http://grass.itc.it/statsgrass/r_and_dbms.html.  These are
PostgreSQL drivers.  For MySQL, just use the DBI and RMySQL found on CRAN at
http://cran.at.r-project.org/src/contrib/PACKAGES.html.  I primarily run R
on Win32, FreeBSD and Mac OSX.  The DBI PostgreSQL drivers work impressively
well on the FreeBSD/Mac OSX platforms, (which are "kissing cousins", per
se.)  As Prof Ripley alluded to, using Java sounds hard just to retrieve a
dataframe and there are, IMHO, far easier ways to pull data.

On Win32, RODBC works well, however I found absolutely no joy on FreeBSD and
PostgreSQL.  I have used RODBC on Win32 to pull MS SQL, MS Access, Teradata,
etc. predicated that there are appropriately installed ODBC drivers for them
on your PC.  FYI, I work for a really large bank and my group is basically a
"SAS shop" as well.  While SAS is great at some things, I argue R is better
for others.  So, while as not to start a thread on R vs. SAS merits, I wish
you luck integrating R in your work/workplace.  It's a great/powerful
analysis language/package whose adoption I hope continues to expand.


Charles


-Original Message-
Thanks for the reply - thru R i have large data sets in oracle, mssql,
postgres and we have jdbc drivers for all of them - most of these systems
are on UNIX/LINUX and ODBC is not used - we use JDBC to hit the DB's usually
in java applications we have.  other than that we are a large SAS shop and i
am trying to find an alternative to SAS, i think R has a good chance.

For R and SQL - i assume using the wrapper below is the easiest way to hit
databases via SQL - are there any other ways i am missing?  or is JDBC route
the easiest when ODBC is not available?

not sure if R contains some standard database routines that i am not seeing?

also

does R have some good data manipulations function - if so, could you point
me in the right direction (similiar to DATA steps in SAS)

-thx!



[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Another NEWBIE

2004-06-20 Thread Charles and Kimberly Maner

Hi Frank.  I am (somewhat) new to R as well, but almost a 10 yr SAS veteran.
I work for a very large US Bank and have spent a considerable part of my
career in Corp Mktg leveraging data for, arguably, data mining, next
purchase, attrition, balance diminishment and the like.  I am now managing
an Operations Research group in their Customer Service and Support (aka
Telephone/Call Center Support) within the forecasting and analytics group.
What I have found, broadly and personally, regarding R vs. sAS is the
following:

1.  You simply can't beat the price of R vs. Insightful Corp.'s S-Splus, not
to mention SAS.
2.  The support folks for R are among the very best, (e.g., most helpful,
energetic and enthusiastic to help)
3.  R is far, far leaner from what I have seen thus far for modeling,
binning/discretizing, graphing, etc. vs. SAS.
4.  SAS is, per a previous post, (quite debatably) superior for manipulation
and handling of fantastically large datasets.  I have found that R's
strength is not really in merging datasets and dataset manipulation.
Although, major caveat here, it greatly depends on what you need done to the
data.  For lagging, diffing, binning, R is superior.  For match merging, at
this stage, I vote for SAS.  (Again, I stress I've only 6-8 mos of moderate
R experience.)
5.  The challenge with R is, perhaps, it's very strength--language density.
Once I learn how to do something in R vs. SAS, R's code is fractionally as
large as SAS.  Literally, it may take 10 lines of code in SAS vs. a one
liner in R.  That's powerful.  However, due to my SAS experience, I've
banged out the SAS code and am still looking/hunting for the R equivalent.
However, once doing so, it's, borrowing from a popular vegetable drink
slogan, "Wow, I could have done that in R."
6.  And, lastly, while R is well documented, I seem to find one of the areas
of documentation somewhat lacking is a great big R "recipe" book.
(Suggestions, BTW, are welcome here.)  Documentation of the R language is in
place with more being published, (alongside S-Plus), annually.  However,
there does not appear to be, for example, an "R Transition Recipes for
Experienced SAS Users" book.  That, ultimately, is what would help me, (I
think.)  Again, the issue really is simply learning and using the language.
Experienced R users, I'm convinced, could do everything R I'm doing in SAS,
(with money left over for a few coffees at Starbuck's).

In conclusion, I still think that, given one's budget and projects, there's
a place for SAS and R to co-exist.  But, that paradigm diminishes as (1) the
size of the datasets become smaller and, (2) your problems are more
academic/researchy/specific in nature.  For graphing, esp. w/the Lattice
package, R is simply superior (IMHO), period, to SAS.  (For some reason, SAS
has just not felt the need to improve their graphics, at least the SAS/Graph
part of their offering.)  And, for the SAS lovers out there, this opinion is
mine only as I continue to be primarily a SAS client attempting to
transition to R.

Frank, while I've probably been too wordy, I've attempted to provide another
perspective for you.  Good luck.


Thanks,
Charles


--

Message: 7
Date: Sat, 19 Jun 2004 18:15:19 +0200 (MEST)
From: "F.Kalder" <[EMAIL PROTECTED]>
Subject: Re: [R] Another NEWBIE
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"

Hi,

Thank you all who anwered me. 

I think, I mainly thought to understand the difference between SPSS /SAS and
R, but didn't really get the point (what explains the question, wich metods
R can't do). Maybe, because I don't have much experience with programming
(near to none). My background in stats goes also only back to indroductory
classes and an advanced course in multivariate statistics. To this, I'm
working with Hair, Anderson, Tatham & Blacks's "Multivariate Data Analysis"
(5th Ed.) as my ressource, mainly with questionnaire analysis (Reliability
Analysis and Factor Analysis, also MDS, Conjoint etc. plus sometimes
standard MANOVA, Multiplke Regression etc.). So, maybe my stats aren't
sophisticated enough to use R, I'm just a standard user of applied
statistical methods, not an academic researcher or even a statistician. It
was mainly a descision by costs, because R is free software. 
With the concept, I completely mistook the R concept as a programming
environment more as a kind of advanced SPSS Syntax (because I also would
call it "programming" when using it), which I now know, is completely wrong.

So, I again thank for your help.


Cheers, Frank.

--

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] RE: [R-sig-finance] Rmetrics - New Built 190.10055

2004-06-13 Thread Charles and Kimberly Maner

Hello and thank you.  I look forward to using the new packages under both
Win32 as well as FreeBSD.

Quick question.  Any chance this package collection could be added, say, as
a new category under the package directory at http://cran.us.r-project.org/?
Perhaps it's not appropriate and/or not the scope as this area is under a
non-traditional category.  (Although, I think that's one of the aims of this
forum is to introduce R to an additional audience.)  Anyway, I thought I'd
ask/propose the idea.

Thanks,
Charles

-Original Message-
From: Diethelm Wuertz [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 13, 2004 3:33 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [R-sig-finance] Rmetrics - New Built 190.10055

*June 13, 2004
Rmetrics - new Built 190.10055

Rmetrics is an environment and a collection of functions for teaching
financial engineering and computational finance

*The new built should now run out of the box under Windows, Linux, and Mac
OSX. In addition new functionality has been added, and some fixes has been
done. New functions and example files have been added. Please inspect the
FAQ and CHANGES  files. Goto: www.rmetrics.org .

Suggestions are welcome!

Diethelm Wuertz
www.rmetrics.org

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Printing Lattice Graphs from Windows

2004-06-06 Thread Charles and Kimberly Maner

Hi.  This did not work for me per my R output/session below:

> library(lattice)
> win.metafile()
> trellis.par.set('background', list('white'))
> trellis.par.set('plot.symbol',list(cex=0.8, col="blue", font=1, pch=1))
> xyplot(1 ~ 1)
Error in unit(rep(1 * xaxis.cex[1], length(strbar)), "strheight", strbar) : 
x and units must have length > 0
> dev.off()
null device 
  1 
>  

When I pasted the result into MS Word, I got the same paste--blank.  And,
yes, another default bg color such as "white" or "transparent" would be
great as I am definitely not a fan of the standard "gray" either.  I
researched how to default it to something else, but it seems to have to be
done manually when a lattice/trellis graph is fired up.  Strange, though, as
the standard/base graph/plotting does default to a "white" background.


--Charles

-Original Message-
From: Spencer Graves [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 06, 2004 10:00 PM
To: Duncan Murdoch
Cc: Deepayan Sarkar; [EMAIL PROTECTED]; Charles and Kimberly Maner
Subject: Re: [R] Printing Lattice Graphs from Windows

Hi, Duncan: 

  Thanks.  It worked for me, complete with the gray background and
pastel blue dot.  The following also worked to eliminate the (to me
ugly) gray background, etc.: 

win.metafile()
trellis.par.set('background', list('white')) trellis.par.set('plot.symbol',
  list(cex=0.8, col="blue", font=1, pch=1))
xyplot(1 ~ 1)
dev.off()

  Thanks again.  spencer graves

Duncan Murdoch wrote:

>On Sun, 06 Jun 2004 17:43:42 -0700, Spencer Graves 
><[EMAIL PROTECTED]> wrote:
>
>  
>
>>Hi, Deepayan: 
>>
>> Following your suggestion, I tried the following in Rgui.exe: 
>>
>>
>>
>>>xyplot(1~1)
>>>win.metafile()
>>>graphics.off()
>>>  
>>>
>> I then switched to MS Word, pasted, and got the same blank plot 
>>as before.  (I actually tried other things as well, but came to this 
>>after reading the documentation.)
>>
>>
>
>You should open the device *first*.  Then you plot to it, then close it 
>and the graphics are saved.
>
>That is,
>
>  
>
>>library(lattice)
>>win.metafile()
>>xyplot(1 ~ 1)
>>dev.off()
>>
>>
>
>This worked for me in a single attempt; I haven't tested it thoroughly.
>
>Generally speaking, you get better graphics results by plotting to the 
>final graphics device rather than plotting to the screen and copying 
>somewhere, because the graphics system makes some choices based on the 
>target device capabilities, and those choices might not be appropriate 
>on a different device.  I notice lines are often too thin when printed 
>from a plot on screen, for example.
>
>Duncan Murdoch
>  
>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Printing Lattice Graphs from Windows

2004-06-06 Thread Charles and Kimberly Maner

Hi.  Another curious observation.  When executing the following:

> trellis.device(bg="transparent")
> xyplot(1~1)

I can then copy and paste in MS Word fine.  But, printing directly
(right-click, print) still will not work--prints a blank sheet.


--Charles

-Original Message-
From: Spencer Graves [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 06, 2004 8:44 PM
To: Deepayan Sarkar
Cc: [EMAIL PROTECTED]; Charles and Kimberly Maner
Subject: Re: [R] Printing Lattice Graphs from Windows

Hi, Deepayan: 

  Following your suggestion, I tried the following in Rgui.exe: 

 > xyplot(1~1)
 > win.metafile()
 > graphics.off()

  I then switched to MS Word, pasted, and got the same blank plot as
before.  (I actually tried other things as well, but came to this after
reading the documentation.) 

  ???
  spencer graves

Deepayan Sarkar wrote:

>On Sunday 06 June 2004 18:10, Charles and Kimberly Maner wrote:
>  
>
>>Hi folks.  It looks like it's stirred some discussion ultimately 
>>resulting/concluding that this phenomena is a possible bug either in 
>>the lattice package or in R 1.9.0/1.9.1 itself.  So, I'll stay tuned, 
>>so to speak, for either an update in the lattice package or R as it 
>>seems that that's where the bug may lie.  FYI, the resulting plot, 
>>(e.g., plot(1~1)), worked as it should either printing or as a copy 
>>and paste as a metafile which causes me to believe it's in the lattice 
>>package.
>>
>>I appreciate you guys looking into this.  (As you may/may not, for 
>>some us corporate folk, data mining is (1) pulling data, (2) producing 
>>a graphical representation of a story/hypothesis from the data and (3) 
>>pasting it into MS Word and/or MS PowerPoint for presentation quickly.  
>>So, to much of you all's potential satisfaction, a number of us use R 
>>instead of S-Plus.)
>>
>>
>
>I can't check myself, but I believe a possible workaround is to use the 
>respective devices directly (e.g. pdf() or win.metafile()) instead of 
>copying from the GUI menu (at least I haven't heard anyone say that 
>this does not work).
>
>Deepayan
>
>__
>[EMAIL PROTECTED] mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! 
>http://www.R-project.org/posting-guide.html
>  
>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Printing Lattice Graphs from Windows

2004-06-06 Thread Charles and Kimberly Maner

Hi folks.  It looks like it's stirred some discussion ultimately
resulting/concluding that this phenomena is a possible bug either in the
lattice package or in R 1.9.0/1.9.1 itself.  So, I'll stay tuned, so to
speak, for either an update in the lattice package or R as it seems that
that's where the bug may lie.  FYI, the resulting plot, (e.g., plot(1~1)),
worked as it should either printing or as a copy and paste as a metafile
which causes me to believe it's in the lattice package.

I appreciate you guys looking into this.  (As you may/may not, for some us
corporate folk, data mining is (1) pulling data, (2) producing a graphical
representation of a story/hypothesis from the data and (3) pasting it into
MS Word and/or MS PowerPoint for presentation quickly.  So, to much of you
all's potential satisfaction, a number of us use R instead of S-Plus.)


Thanks,
Charles

-Original Message-
From: Spencer Graves [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 06, 2004 5:02 PM
To: Spencer Graves
Cc: Dirk Eddelbuettel; [EMAIL PROTECTED]; Ulises Mora Alvarez;
[EMAIL PROTECTED]; Charles and Kimberly Maner
Subject: Re: [R] Printing Lattice Graphs from Windows

Hi, Duncan: 

  I just did "plot(1:2)" in Rgui.exe, and that copied fine as a metafile
into MS Word via the clipboard. 

  Then I exited and restarted Rterm.exe under ESS and tried it again.
This time, I got a blank image copied into MS Word.  However, after I
modified the Lattice defaults via, "trellis.par.set('background',
list('white')); trellis.par.set('plot.symbol',  list(cex=0.8, col=1, font=1,
pch=1))", I was able to copy the results of "xyplot(1~1)" as a metafile into
Word.  
Unfortunately, when I tried modifying the Lattice defaults the same way
under Rgui.exe. I again got a blank image copied into Word. 

  hope this helps.  spencer graves

###
Duncan Murdoch wrote:

On Sun, 6 Jun 2004 15:00:52 -0500, Dirk Eddelbuettel <[EMAIL PROTECTED]>
wrote:


>But isn't it a bug in the windows version of R if the Rgui.exe cannot 
>copy to the clipboard where Rterm.exe can?
>  
>

Yes, definitely.  Can someone distill this down to code that uses only the
base packages (e.g. just grid)?  Lattice is a recommended package, so I'd
refer you to its maintainer, but it's probably something in a base package
that's going wrong.

Once you've done that, please submit it as a bug report with reproducible
code.  I've never looked at the Windows metafile device driver, so it's
unlikely I'll fix this by 1.9.1, but it is something that should be fixed.

Duncan Murdoch

Spencer Graves wrote:

>  I agree:  It sounds like a  bug, as you said, Irk, in that 
> Rgui.exe cannot copy a metafile to the clipboard, at least under MS 
> Windows 2000, 5.00.2195, Service Pack 3, even though Rterm.exe can.
> Therefore, I'm including "[EMAIL PROTECTED]" in the list of 
> addresses to this email.
>  Spencer Graves
>
> Irk Eddelbuettel wrote:
>
>> On Sun, Jun 06, 2004 at 12:26:45PM -0700, Spencer Graves wrote:
>>  
>>
>>> Using R 1.9.1 alpha via XEmacs with ESS under Windows 2000, I 
>>> did the following:
>>> library(lattice)
>>> xyplot(1~1)
>>>
>>> I got the plot in a separate window, from which I did File -> 
>>> Copy to the clipboard -> as a metafile.  I then changed to MS Word,
>>> and it pasted fine.   
>>
>>
>> Ok.
>>
>>  
>>
>>> When I started R 1.9.1 alpha directly (without XEmacs) and tried 
>>> the same thing, I got a standard lattice plot.  However, when I 
>>> tried File -> Copy to the clipboard -> as a metafile, I got a blank 
>>> plot when copying into MS Word.  When I copied as a bitmap, it came
>>> through fine.  However, I suspect that is unacceptable.   
>>
>>
>> Not ok.
>> But isn't it a bug in the windows version of R if the Rgui.exe cannot 
>> copy to the clipboard where Rterm.exe can?
>>
>> I may be missing some subtle detail, though...
>> Irk
>>
>>  
>>
>
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Printing Lattice Graphs from Windows

2004-06-06 Thread Charles and Kimberly Maner

Hello.  I have researched this topic and have found no answers.  I am
running R 1.9.0 and am trying to print a lattice graph, (e.g., xyplot(1~1)),
using mouse right click -> print.  It produces a blank page.  Also, I right
clich, copy the metafile and paste into a MS Office document, (e.g., .ppt,
.doc) and, same thing, a blank.  I have updated to the latest lattice
package and still no printing.  Any help/advice?


Thanks,
Charles

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] RODBC on FreeBSD 4.9

2004-04-09 Thread Charles and Kimberly Maner

Hello.  I have found a number of posts/threads on this subject and
remain unsuccessful to determine the solution.  In brief, my situation
is:

1.  Running FreeBSD 4.9 Stable in x86
2.  Installed, and running, R 1.8.1
3.  Installed, and running, postgreSQL 7.4.2
4.  Installed, and running, unixODBC 2.2.8
5.  Failed, repeatedly, to install RODBC.  The
following is my error log:

tsunami# R CMD INSTALL RODBC
* Installing *source* package 'RODBC' ...
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler...
yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none
needed
checking for library containing SQLTables... no
configure: error: "no ODBC driver manager found"
ERROR: configuration failed for package 'RODBC'
** Removing '/usr/local/lib/R/library/RODBC'

I have set up the DSN/databases using ODBCConfig, viewed/confirmed
through DataManager and have even used isql to further confirm that all
is set up correctly.  I have read, numerous times, the README within
RODBC.  Unfortunately, I am out of ideas.  Therefore, I am asking for
ideas of others.

Also, I found, and employed, the results from a previous post,
https://stat.ethz.ch/pipermail/r-help/2001-October/014693.html, and
reset my LIBS and LD_LIBRARY_PATH to those suggested by the author.
Again, no joy.

So, any thoughts, with successful ones perhaps resulting in an
FAQ/how-to, would be most appreciated.

(Also, please let me know what more info you may need to help and I will
gladly provide it.)


Charles

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] RODBC on FreeBSD 4.9

2004-04-07 Thread Charles and Kimberly Maner

Hello.  I have found a number of posts/threads on this
subject and remain unsuccessful to determine the
solution.  In brief, my situation is:

1.  Running FreeBSD 4.9 Stable in x86
2.  Installed, and running, R 1.8.1
3.  Installed, and running, postgreSQL 7.4.2
4.  Installed, and running, unixODBC 2.2.8
5.  Failed, repeatedly, to install RODBC.  The
following is my error log:

tsunami# R CMD INSTALL RODBC
* Installing *source* package 'RODBC' ...
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler...
yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none
needed
checking for library containing SQLTables... no
configure: error: "no ODBC driver manager found"
ERROR: configuration failed for package 'RODBC'
** Removing '/usr/local/lib/R/library/RODBC'

I have set up the DSN/databases using ODBCConfig,
viewed/confirmed through DataManager and have even
used isql to further confirm that all is set up
correctly.  I have read, numerous times, the README
within RODBC.  Unfortunately, I am out of ideas. 
Therefore, I am asking for ideas of others.

Also, I found, and employed, the results from a
previous post,
https://stat.ethz.ch/pipermail/r-help/2001-October/014693.html,
and reset my LIBS and LD_LIBRARY_PATH to those
suggested by the author.  Again, no joy.

So, any thoughts, with successful ones perhaps
resulting in an FAQ/how-to, would be most appreciated.

(Also, please let me know what more info you may need
to help and I will gladly provide it.)


Charles

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html