[R] [OT] Is data copyrightable?

2007-05-13 Thread Michael Sumner
A relevant book on this important (and evolving) topic is 

Math You Can't Use: Patents, Copyright, and Software
by Ben Klemens (2006)

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] A question about POSIXct

2007-05-03 Thread Michael Sumner
Hello,

It seems that danish is a numeric vector with attributes attached - 
the attribute vector is POSIXct and is the same length as danish.

You can create this from a data frame like this:

 x - data.frame(Date = ISOdate(2007, 5, 1:10), Value = rnorm(10))
str(x)
'data.frame':   10 obs. of  2 variables:
 $ Date :'POSIXct', format: chr  2007-05-01 12:00:00 2007-05-02 
12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...
 $ Value: num   1.891  0.741 -0.368  1.701 -0.660 ...

 xx - x$Value
attr(xx, times) - x$Date
str(xx)
 atomic [1:10]  0.0414 -0.7124 -1.2976  0.3101  0.4343 ...
 - attr(*, times)='POSIXct', format: chr [1:10] 2007-05-01 12:00:00 
2007-05-02 12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...


HTH

Cheers, Mike.

 Dear List:

 I have a simple two-column data set in .csv format, with the first column
 being the date and second column being some value.  I use read.csv() to
 import the data as follows:



 x - read.csv(myfile.csv,header=T, dec=., colClasses=c(Date=POSIXct))



 The structure of x is:



  str(x)

 `data.frame':   2959 obs. of  2 variables:

  $ Date:'POSIXct', format: chr  1998-01-01 1998-01-01 1998-01-01
 1998-01-01 ...

  $ Value: num  0.07379 0.07181 0.01555 0.00630 0.00688 ...



 This is not what I want.  Instead, I want the structure to be the same as
 that of the following data set:



  str(danish)

  atomic [1:2167] 1.68 2.09 1.73 1.78 4.61 ...

  - attr(*, times)='POSIXct', format: chr [1:2167] 1980-01-02 18:00:00
 1980-01-03 18:00:00 1980-01-04 18:00:00 1980-01-06 18:00:00 ...



 danish is a data set that the package evir comes with.


 Any help would be appreciated.

   [[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] A question about POSIXct

2007-05-03 Thread Michael Sumner
Jacques Wagnor wrote:
 A follow-up question:  The example in ?attr uses a character string of
 dim.  Besides dim and times, what other character strings are
 available or can be used?
Ah, it's not limited to those. Any character string would do (guru 
caveats aside).  
I suspect my narrow answer to your question might lead you astray, 
perhaps you should cut to the chase and ask how to get your data file 
into which  function in evir . . .

Cheers, Mike.

 On 5/3/07, Michael Sumner [EMAIL PROTECTED] wrote:

 Hello,

 It seems that danish is a numeric vector with attributes attached -
 the attribute vector is POSIXct and is the same length as danish.

 You can create this from a data frame like this:

 x - data.frame(Date = ISOdate(2007, 5, 1:10), Value = rnorm(10))
 str(x)
 'data.frame':   10 obs. of  2 variables:
 $ Date :'POSIXct', format: chr  2007-05-01 12:00:00 2007-05-02
 12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...
 $ Value: num   1.891  0.741 -0.368  1.701 -0.660 ...

 xx - x$Value
 attr(xx, times) - x$Date
 str(xx)
 atomic [1:10]  0.0414 -0.7124 -1.2976  0.3101  0.4343 ...
 - attr(*, times)='POSIXct', format: chr [1:10] 2007-05-01 12:00:00
 2007-05-02 12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...


 HTH

 Cheers, Mike.

__
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
and provide commented, minimal, self-contained, reproducible code.


[R] using alpha transparency for lines in levelplot

2007-03-26 Thread Michael Sumner
Hello, I'm having trouble with using the alpha channel for transparency
with lines with lattice levelplots.

If I use transparency via the alpha argument to rgb to overplot lines on
levelplot the transparent colour affects all of the region colours in the
plot.

Can anyone explain why the difference in region colours?

 Warning: this code attempts to create PDF files in working 
directory - they may be downloaded, see below

library(lattice)

## prepare data
data(volcano)
xy - expand.grid(x = 1:nrow(volcano), y = 1:ncol(volcano))
xy$z - as.vector(volcano)

## panel function to add lines with grey(0.3)
my.panel - function(...) {
panel.contourplot(...);
panel.xyplot(1:60, runif(60, 1, 60), type = l, lwd = 3, col = 
grey(0.3))
}

## this works fine
pdf(plot.pdf, version = 1.4)
levelplot(z~x+y, xy, panel = my.panel)
dev.off()

## panel function to add lines with grey transparency
my.paneltransp - function(...) {
panel.contourplot(...);
panel.xyplot(1:60, runif(60, 1, 60), type = l, lwd = 3, col = 
rgb(0.3, 0.3, 0.3, 0.5))
}

## this results in grey bleeding on the coloured regions of the plot
pdf(alpha.pdf, version = 1.4)
levelplot(z~x+y, xy, panel = my.paneltransp)
dev.off()

I've put the pdfs created here for reference:

http://staff.acecrc.org.au/~mdsumner/R/

Cheers, Mike.

I'm using Windows XP, SP2:

sessionInfo()
R version 2.4.1 (2006-12-18)
i386-pc-mingw32

locale:
LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252

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

other attached packages:
  lattice
0.14-16

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using alpha transparency for lines in levelplot

2007-03-26 Thread Michael Sumner
Deepayan Sarkar wrote:

 I don't understand what you are trying to say. Here's a modified
 version of your code:



Sorry, it's not that the transparency affects the plot regions but the 
colour of the lines darkens the region
colours. I.e. with grey lines the regions are greyed. In your PDF the 
regions are greyed (darker)
in both plots than the colours I see with the usual lattice colour scheme.
Do you notice any difference between the region colours of the plots if 
you write
them to separate files?

If not it must be my viewer.

Cheers, Mike.

 --
 ## panel function to add lines with grey(0.3)
 my.panel - function(...) {
panel.xyplot(1:60, runif(60, 1, 60), type = l, lwd = 3,
 col = grey(0.3))
panel.contourplot(...);
panel.xyplot(1:60, runif(60, 1, 60), type = l, lwd = 3,
 col = grey(0.3))
 }

 ## panel function to add lines with grey transparency
 my.paneltransp - function(...) {
   panel.xyplot(1:60, runif(60, 1, 60), type = l, lwd = 3,
col = rgb(0.3, 0.3, 0.3, 0.5))
   panel.contourplot(...)
   panel.xyplot(1:60, runif(60, 1, 60), type = l, lwd = 3,
col = rgb(0.3, 0.3, 0.3, 0.5))
 }

 pdf(alpha.pdf, version = 1.4)

 ## this works fine
 levelplot(z~x+y, xy, panel = my.panel)

 ## this doesn't?
 levelplot(z~x+y, xy, panel = my.paneltransp)

 dev.off()
 --

 and the resulting 2-page PDF file is at

 http://dsarkar.fhcrc.org/R/alpha.pdf

 I don't see any evidence of transparency in the 'region' colors (the
 lines behind the level plot never show up). Are you sure whatever you
 are seeing is not an artifact of your display application?

 Deepayan



__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using alpha transparency for lines in levelplot - SUMMARY

2007-03-26 Thread Michael Sumner
Hello, thanks to Deepayan Sarkar for sorting me out on this one.

The problem with transparent lines affecting region colour in lattice 
plot appears
when using Adobe Reader (v 8 in my case). I've only viewed the file on 
Windows XP.

I've tried using Foxit Reader to view the file and there's no problem.

Cheers, Mike.

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reading BMP into R

2007-03-13 Thread Michael Sumner
Another way:

require(sp)
require(rgdal)

library(rgdal)

## read using one of the many GDAL drivers
d - readGDAL(im.bmp)
summary(d)

## map colours for RGB and display
col - SGDF2PCT(d)
d$idx - col$idx
image(d, idx, col = col$ct)

## Available drivers:
gdalDrivers()



Milton Cezar Ribeiro wrote:
 / Hi R-gurus
// // How can I read my bmp files into R?
// // Kind regards,
// // // miltinho
// Brazil /
 / /

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R software to place points on Yahoo maps

2007-03-04 Thread Michael Sumner
 Is there any R software that create an image from Yahoo maps together 
 with points of known UTM coordinates (or lat/long marked? Note that my 
 region of interest is not covered in sufficient detail by Google maps. 
 It actually does not have to be Yahoo maps as long as it has 
 sufficient coverage of my region but that's the one I have found with 
 coverage of my region. The scale I am interested in is a city block. 
 Thanks.

rgdal in combination with sp. You'll need to georegister the image, as 
the yahoo maps interface is unlikely to provide a format supporting this 
metadata, but you can do that easily with two reference coordinates.

The workflow might go like this (untested).  You could continue the 
query on R-Sig-Geo. Hope this helps.

There are freely available tools for reading image data directly from 
Yahoo, Google and Virtual Earth in georeferenced
versions, but I've only used them via commercial GIS. If you can 
describe the map you want I'd be interested in
exploring that option.

Cheers, Mike.

library(rgdal)
im - readGDAL(yahooMap.png)  ## a file saved from Yahoo Maps

## create index for RGB colours
col - SGDF2PCT(im)  ## im is a spatialGridDataFrame with 3 bands

im$ind - col$idx  ## add the colour index to the data frame

image(im, ind, col = col$ct)

## BUT you won't be able to plot UTM on this yet

## you'll need to create a new GridTopology with appropriate 
cellcentre.offset and cellsize

ogt - getGridTopology(im)
. . . find values for offsets and pixel size

gt - GridTopology(cc.offset, csize,  [EMAIL PROTECTED])

## recreate the object
im - SpatialGridDataFrame(gt, [EMAIL PROTECTED])

image(im, idx, col = col$ct)
points(utm.x, utm.y)  ## etc.

__
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
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] trip package on CRAN

2006-12-07 Thread Michael Sumner
 Hello,

 The 'trip' package provides extensions to the 'sp' spatial classes for 
animal track data.

 Trip objects are created from SpatialPointsDataFrame objects by 
specifying the columns containing ID and date-time data. Argos formats 
can be read directly, and there are functions for basic speed filtering 
and spatial gridding of time spent. Tight integration with 'sp' means 
that projections and general I/O can be handled using 'rgdal'. (This 
really is excellent and so I thank the developers of these and 
supporting packages).

Trip is intended for use with location data that are irregularly spaced 
in time - this contrasts with the rationale behind the traj class in 
'adehabitat'. Primarily it has been developed with marine animal data in 
mind, but the validation of trip classes used should general for many 
applications.

 There is a short vignette available from here -  it's not integrated 
into the CRAN-available package yet.

 http://staff.acecrc.org.au/~mdsumner/Rutas/trip.pdf

 Cheers, Michael Sumner

___
R-packages mailing list
R-packages@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Do you know if you can map a large minmum spanning tree in R?

2004-08-18 Thread Michael Sumner
At 09:47 AM 8/19/2004, Briggs, Meredith M wrote:

Do you know if you can map in R?
I have my minimum spanning tree, but as there are 1371 nodes (all 
over Australia) I'd like to be able to graph them as they actually 
would be on the map.
Do you know if this is possible?
You can certainly map in R.  Depending on the coordinate system of your 
data . . .
but, e.g. - if it's lat/lon - perhaps the easiest way is to install the 
maps package and you can add the continental outlines to an existing plot:

## display nodes code here . . .
library(maps)
map('world',add=T,xlim=c(109,157),ylim=c(-47,-7))
There are plenty of other options, if you have your own map data (or want 
to use another source).  Feel free to provide more detail about your 
current plotting methods and coordinate system.

Also, the package mapdata contains a high resolution continental dataset 
-worldHires

Hope that helps, Mike.


###
Michael Sumner - PhD. candidate
Maths and Physics (ACE CRC  IASOS) and Zoology (AWRU)
University of Tasmania
Private Bag 77, Hobart, Tas 7001, Australia
Phone: 6226 1752
__
[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