Re: [R] Writing to a UDP server from R?

2009-07-27 Thread Warren Young

Saptarshi Guha wrote:


This does not work
 u -  socketConnection('localhost',9000)


UDP and TCP are entirely different worlds.  They don't share the same 
port space; TCP port 9000 and UDP port 9000 are different things.  Plus, 
UDP is connectionless, so you can't connect to a UDP port.  All you 
can do is throw packets at a server, which may or may not be listening 
for those packets.


You will either have to rely on an external program to do the UDP 
communication for you, or write an extension to R to provide this 
functionality.


Suitable helper programs are 'nc' and 'ncat'.  nc is abandonware, so the 
nmap folk built their own version of the same idea and added it to nmap 
v5.  nmap v5 is very new, though, so you might have nc on your system 
already, but and old version of nmap, and prefer to use the defunct 
program rather than upgrade your nmap.


__
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] downsampling

2009-07-24 Thread Warren Young

Michael Knudsen wrote:

On Fri, Jul 24, 2009 at 9:32 AM, Jan Wienerjan.wie...@tuebingen.mpg.de wrote:


x=sample(1:5, 115, replace=TRUE)

How do I downsample this vector to 100 entries? Are there any R
functions or packages that provide such functionality.


What exactly do you mean by downsampling? 


It means that the original 115 points should be treated as a continuous 
function of x, or t, or whatever the horizontal axis is, with new values 
coming from this function at 100 evenly-spaced points along this function.


This procedure is how a sound editing program can produce a 
good-sounding 44.1 kHz CD quality file from material recorded at 48 kHz, 
for instance.  Something similar happens when you ask your photo editing 
program to give you a smaller version of, say, a 12 Mpix picture for 
emailing or putting up on the web.  These are all forms of interpolation.


There's a degenerate case, where the number of output samples divides 
evenly into the number of input samples.  For instance, to downsample a 
96 kHz audio file to 48 kHz, just throw away every other sample.


I, too, wish I know how to do the harder interpolation case in R.  I've 
been in the OP's shoes, fighting with zoo and failing.  The last time I 
had to do this, I gave up on R and did it in Mathematica.  I also 
remember that it was easy to do this in Igor Pro when I played with its 
demo version.


__
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] productivity tools in R?

2009-07-02 Thread Warren Young

Michael wrote:


I saw my friend has a R Console window which has automatic syntax
reminder when he types in the first a few letters of R command. And
he's using R under MAC. Is that a MAC thing, or I could do the same on
my PC Windows?


Yes, the Mac GUI for R is a lot nicer than the Windows version.  I guess 
it's just a matter of what interested the people who wrote each, as 
there's no technical reason it has to be that way.  Maybe someone will 
port some of the Mac GUI's features over to the Windows version.


__
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] can you tell what .Random.seed *was*?

2009-05-15 Thread Warren Young

Duncan Murdoch wrote:

1) can you tell me what my original set.seed() value was?  (I wouldn't
be able to figure it out, but maybe someone can)


The only way I know is to test all 2^32 possible values of the seed.  I 
think cryptographers would know faster ways.


Well, I'm not a cryptographer, but I know a faster way: rainbow tables.

http://en.wikipedia.org/wiki/Rainbow_table

Given that the algorithm to generate these images is known and that each 
seed always gives the same image as output, you can simply precompute 
all possible images, hash them using your favorite algorithm -- say, 
SHA-256 -- and record the seed-to-hash correspondence on disk.  Then 
given an output image, you can hash it and use that to look up the seed.


It can take a long time to generate all the images, but then you have 
database like lookup speeds for image-to-seed correspondence.


This is not just a theoretical idea.  There are underground sites where 
you can put in, say, an MD5 password hash and get out the likely 
password that was actually used.  This allows a black hat to break into 
one site, grab their password hash database, reverse engineer the 
passwords, and then go use them to bang on the front door of other sites 
users of that site he first compromised also use.  There are defenses 
against this: salting the passwords and using passwords too big to 
appear in rainbow tables are easiest.


Now, if the seed was removed just before the values were generated, the 
seed would be generated from the system clock.  If you knew the time 
that this occurred approximately, the search could be a lot faster.


This also helps with the rainbow table approach.

Given that the seed for the generation algorithm is always the current 
wall time, you can restrict the needed rainbow table size greatly.  You 
simply have to know when the algorithm was first put into use, then 
start your rainbow table with that time's value as the first seed, and 
only compute up to now plus whatever you need for future operations.


For instance, you can cover about 3 years worth of image production in 
about 1/45 the time as it takes to cover all 2^32 possible images.  Say 
it takes a month to generate a rainbow table covering those 3 years. 
Full coverage would then take nearly 4 years.


__
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] can you tell what .Random.seed *was*?

2009-05-15 Thread Warren Young

G. Jay Kerns wrote:


I want it to be *difficult* for students to figure out the seed and
automatically generate solutions on their own.


Hmmm Would it really be a bad thing if someone reverse engineered 
this to generate answers given the problem set?  If it's hard enough to 
do that, it'd be more worth solving than the given problem set.  I call 
that extra credit.



a brute force search of set.seed() is really
pretty easy and fast... even for students at this level.


Either you're misunderstanding Stavros' benchmark results, or I am. 
Could easily be the latter...I'm an R newbie.


As far as I can tell, the inner part of the loop does very little.  If 
that's right, Stavros is saying it will take 18 hours to try every 
possible seed when the algorithm based on that seed takes almost no time 
to run.  But, if generating each problem set takes, say, a minute, it 
will take 4.7 million years to generate a complete rainbow table when 
there are 2^32 possible seeds.



what if the Instructor
inserted an *unknown* very large number of calls to the RNG near the
beginning of the .Rnw (but after the set.seed)...  and did not
distribute this information to the students...  that would make it
much harder, yes?


There are better ways.

As above, one key to making rainbow tables impractical is making the 
per-iteration time long enough.  Even if it only takes a second to 
generate each possible problem set, that's enough when multiplied by 
high enough powers of 2.


The other key is using big enough powers of 2.

I hadn't looked into R's random number generation before, but it appears 
quite robust.  Seeding it with the current wall clock time (a 32-bit 
integer on most systems) is an insult to its capability.


The default pseudo-random number generator (PRNG) in my copy of R is the 
Mersenne Twister, a truly awesome algorithm.  It's capable of very high 
quality results, as long as you give it a good seed.  It will take a 
vector of *many* integers as a seed, not just one.  It's not clear to me 
from the R docs if you can pass an arbitrary array of integers with any 
value, or if it needs something special.


Assuming you can give it any old passel of randomness as a seed, you 
just have to find a good source of randomness to create that seed.  On a 
Linux box, you could concatenate several dozen bytes read from 
/dev/random, the current wall clock time in microseconds, the inode of 
the R script being run, the process ID of the R interpreter, and the 
current mouse cursor position into a single string.  Feed all that into 
a hash algorithm, and break off pieces of that 4 bytes long, cast them 
to integers, and send that array of ints to set.seed().


If you use SHA-256 as the hash algorithm, that scheme should give you 
enough input randomness to get any of the possible 2^256 hash outputs, 
making that the amount of possible problem sets.  That's more than a 
rainbow table buster...there aren't enough atoms in the visible universe 
to construct a computer big enough to cope with 2^256 possible outputs.


That said, the quality of the PRNG just *allows* you to avoid screwing 
up.  It doesn't make it impossible make a weak algorithm.


__
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] Do you use R for data manipulation?

2009-05-12 Thread Warren Young

Farrel Buchinsky wrote:

Is R an appropriate tool for data manipulation and data reshaping and data
organizing? I think so but someone who recently joined our group thinks not.
The new recruit believes that python or another language is a far better
tool for developing data manipulation scripts that can be then used by
several members of our research group. Her assessment is that R is useful
only when it comes to data analysis and working with statistical models.


It's hard to shift people's individual preferences, but impressive 
objective comparisons are easy to come by.  Ask her how many lines it 
would take to do this trivial R task in Python:


data - read.csv('original-data.csv')
write.csv('scaled-data.csv', data * 10)

R's ability to do something to an entire data structure -- or a slice of 
it, or some other subset -- in a single operation is very useful when 
cleaning up data for presentation and analysis.  Also point out how easy 
it is to get data *out* of R, as above, not just into it, so you can 
then hack on it in Python, if that's the better language for further 
manipulation.


If she gives you static about how a few more lines are no big deal, 
remind her that it's well established that bug count is always a simple 
function of line count.  This fact has been known since the 70's.


While making your points, remember that she has a good one, too: R is 
not the only good language out there.  You should learn Python while 
she's learning R.


__
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] Beyond double-precision?

2009-05-12 Thread Warren Young

joaks1 wrote:

I need to perform some calculations with some extremely small numbers


The R package Brobdingnag does this.  It uses logarithmic 
representation, as recommended by others in this thread, but wraps it 
all up for you in a custom numeric class so you can use them as any 
other numeric type.


http://cran.r-project.org/web/packages/Brobdingnag/vignettes/brobpaper.pdf

__
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] Plotting C++ output in R

2009-04-16 Thread Warren Young

andrew@lshtm.ac.uk wrote:


I want to be able to continuously plot the output from the model in R
each time a new run generates data.


From the C++ program, run the R script that plots the data.  Something 
like this:


system(Rscript myplotter.R);

That assumes Rscript is in the PATH, and that it works on Windows.  I'll 
assume you can figure out the details.


You might also consider making the C++ program write the R script, so 
bits can vary.  For instance, each iteration of the model could write 
out to a different data file, then call R from a new thread, so the R 
analysis stage doesn't interfere with the generation of the next 
iteration's results.  Remove the now-unwanted data file when system() 
returns, and end the thread.


__
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] RES: R on netbooks et al?

2009-03-05 Thread Warren Young

Leandro Marino wrote:

I use it on an ASUS EEE 701 PC! It works with some limitation,
because this model have only 512mb of RAM. But it is working fine.
The OS is Windows XP.


Ditto, except that I put Ubuntu Eee on my 701.  (Since renamed Easy 
Peasy http://www.geteasypeasy.com/)


A nice thing about using Ubuntu is that R and a lot of common R packages 
are in the standard repositories.  Start with apt-get install 
r-cran-base, and work from there with packages discovered via 
apt-cache search r-cran.  Only thing I wish is that they'd update to R 
2.8.1...the repository still only has 2.7.2.


__
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] Python and R

2009-02-17 Thread Warren Young

Esmail Bonakdarian wrote:


I am just wondering if any of you are doing most of your scripting
with Python instead of R's programming language and then calling
the relevant R functions as needed?


No, but if I wanted to do such a thing, I'd look at Sage: 
http://sagemath.org/


It'll give you access to a lot more than just R.


Is there much of a performance hit either way? (as both are interpreted
languages)


Are you just asking, or do you have a particular execution time goal, 
which if exceeded would prevent doing this?  I ask because I suspect 
it's the former, and fast enough is fast enough.


__
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] R on Mobile Devices (Android)

2009-02-11 Thread Warren Young

Gustaf Rydevik wrote:

3.3.2 [...]No interpreted code may be downloaded and used in
an Application except for code that is interpreted and run by Apple's
Published APIs and built-
in interpreter(s).
and

An Application may not itself install or launch other executable code
by any means, including without limitation through the use of a plugin
architecture, calling other frameworks, other APIs or otherwise.


I'm not too familiar with programming speech, but it seems this would
cover R, no?


Mmmm...I think there's wiggle room here for a limited version of R.

The first clause says you couldn't have an R interpreter on the device 
that downloaded an R script and ran it.  It doesn't say you can't type 
an R script into the phone and run it there.  They're trying to block 
things like Flash and Silverlight with this restriction.  That, and the 
general security risks of running remotely-sourced content.


The second clause says install.packages() won't be allowed.  I don't see 
that it prevents you from distributing R with a pre-selected group of 
packages, however.


Keep in mind that all apps have to be approved by Apple, who haven't 
been entirely fair in their selection criteria.  And, you don't get to 
find out if they will accept the app until you finish it and submit it. 
 You risk wasting a lot of time, doing the port and then being rejected.


If you go ahead anyway, I hope you go beyond just customizing the stock 
keyboard.  I'd like to see:


- Instead of customizing the default keyboard, I'd rather have a 
calculator-like UI, with just a line or two of text at the top so you 
can see the expression, and the rest of the screen having an extended 
keyboard: letters, numbers, operator symbols, even custom buttons like 
an arrow button for assignment instead of having to type two math operators.


- Automatic parens, brackets, and quotes inference: when you've typed 
the name of a known function, add open and closed parens, and put the 
cursor between them.  In case of ambiguity -- can't do this for 
functions like print(), since you don't know if a dot is about to be 
typed to select a particular print method -- let user type open paren 
and add closed paren automatically.  Similarly, when the user types a 
bracket, quote, etc., supply the matching one and put the cursor between 
them.  Several text editors for Eclipse do this well, but not all.  A 
tricky bit is editing, where adding another quote, for instance, might 
not require the matching one to be added.


- Buttons for common functions, like plot()

- A button for downloading a data set from a web or FTP server and 
assigning it to a variable.  Basically, a wrapper around download.file() 
and read.table(), with automatic variable assignment and memory for the 
last variable name and URL used.


This is what I mean by changing the UI to match the capabilities of the 
device.


You'll probably end up excising a lot of stuff.  PDF support for 
instance: unless Cocoa Touch includes access to PDF rendering abilities, 
I don't know that I'd bloat the binary by adding it, particularly with 
the lack of a user-visible file system.  Yes, I'm aware that there are 
tools that let you poke around in the file system, but it's not the way 
the device is meant to be used.  Maybe you could justify it if there 
were a built-in way to send the generated PDF off elsewhere, such as an 
email attachment.


Bottom line: if it were available and worked well, I'd sure use it.  I 
just don't think a straight port would do it for me.


__
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] R on Mobile Devices (Android)

2009-02-10 Thread Warren Young

Harsh wrote:


At the cost of sounding far-fetched and almost incredulous, I would
like to know if any R user is remotely considering the use of R on
Mobile devices, and Android in particular.


In addition to the other objections in the other replies, I add this 
one: the assignment operator and the parens are up on ALT keys on the 
Android keyboard.  Typing R expressions would be pretty painful.


You can demo this by installing an ssh client and logging in remotely to 
a machine with R on it, and trying to use it remotely.  A local one 
wouldn't be better...it might not even be faster, because the faster CPU 
on the machine running R might matter more than the speed of the network 
link between client and server.


I briefly thought of what it would take to port R to an iPhone or iPod 
touch, and the keyboard issues would be even worse.


Bottom line, R has the idiom of a real keyboard written into its bones. 
 To be popular, a statistical analysis tool for such devices would have 
to work differently, taking advantage of the platform's native input 
mechanisms.



mobile phone would allow for micro statistics to be collected from the
log files reflecting number of calls dropped, average time spent
talking, a time series of the amount of time taken for battery
recharge, and a host of other information that could be collated and
analyzed.


I agree with the other person that the program to write to cover this 
case would be just a stat gatherer, which somehow gets the data off the 
device for analysis by R running elsewhere.  It could be a web service, 
or you could write a CSV file that somehow gets downloaded from the 
device for use on the computer the phone syncs to.


__
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] Passing data among multiple instances

2009-02-04 Thread Warren Young

Feng Li wrote:


I have two R instances running at the same time, 


On the same computer, or on different computers?

Is the number of Rs likely to change, or will it always be just the two?

Is this a simple one-off problem, or are you breaking the problem up 
into pieces so you can throw lots of hardware at it?



Is there a simpler way to pass the data in A to B?


Perhaps the simplest option is to write the data structure to a file, 
using any of the several R ways to do that.  When instance 2 sees that a 
file is available, it slurps its contents in and works on it.  The hard 
part is making the second instance wait until the whole file is written 
out by the first.  You wouldn't want it to read in half the file then 
hit the end because the first process hasn't finished writing out the 
file.  I don't see any good mechanism in R to fix this.


A more robust option is to use sockets.  This is suitable even within a 
single machine.  See ?make.socket.  This solves the how do I know when 
I've got the full data structure problem because the second process can 
just keep reading until it gets an error indicating that the remote peer 
closed the connection.  Once you have the data structure in string form, 
you can eval() it to get an R object suitable for munching on.  Figuring 
out how to pass the data might be the hardest part.  deparse() might be 
the easiest way.


If you're hoping to scale this up to lots of processes, look into Rmpi. 
 This provides a very clean way for an R program on one computer to 
start slaves on other computers and then pass data to them in native R 
structures.  Setting up MPI itself is not trivial, however.  It's best 
when you already have a cluster of computers linked with MPI.


__
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] Statistics today on xkcd

2009-02-04 Thread Warren Young

http://xkcd.com/539/

Not entirely on topic here, but how often do you see a box plot in a 
cartoon?


__
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] How to import HTML and SQL files

2009-02-04 Thread Warren Young

Arup wrote:

I can't import any HTML or SQL files into R..:confused:


Yeah, I'm confused, too.

What exactly is it you're trying to do?  Not the technical task you 
asked about, but the effect you're trying to achieve?  Can you give 
details about the exact nature of your data sources, or, better, examples?


I ask because actually importing HTML and SQL files is almost certainly 
the wrong approach.  You almost never want to handle texts in either 
language directly in R.


For SQL, you usually don't have SQL files: files literally containing 
SQL queries.  Or if you do happen to have SQL query files, you probably 
don't want to parse them with R.  I expect what you really want is to be 
able to query a database using SQL.  For that, look up DBI on CRAN. 
This will let you connect R to a database server, and use SQL to get 
data from it in a format that R can process directly.


For HTML, the problem is that HTML is a very difficult language to parse 
correctly in the general case.  Much of the reason for that is that few 
web pages are actually legal HTML, but browsers will quietly cope with 
many classes of errors.  To parse such stuff in R, it's usually best to 
take a case-by-case approach, matching particular structures within the 
file so you can extract the few bits of data you want.  You might want 
to post a snippet of the HTML here to get suggestions.


If you really do have to be able to accept arbitrary HTML, I'd suggest 
running the HTML through a filter that converts it to XHTML, then use 
the XML package from CRAN to load it up into R.


You might also want to look into the RCurl package, if the HTML lives on 
a web server.  You can download it directly instead of saving it out to 
an HTML file.  Then you can use the methods above to process it.


__
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] Problems in Recommending R

2009-02-03 Thread Warren Young

Stavros Macrakis wrote:

anti-alias the demonstration graphic.  The current graphic
makes R graphics seem (falsely!) to be very primitive. I'm afraid I
don't know how to do the anti-aliasing myself.


Simply re-plotting it in 2.8.1 built with Cairo support produces 
something better:


http://etr-usa.com/tmp/swiss-cairo-281.png

The text is antialiased, as are some of the graph lines.  The dots in 
the largest plot aren't, though.


Outputting to PDF and then scaling down does even better:

http://etr-usa.com/tmp/swiss-from-pdf.png

The command at the end to do this is:

pdf(file=swiss.pdf, width=12, height=8)

The R webmasters are welcome to use either of these in place of the 
current graphic, but it might be good to change the script to fix up 
some of the changes in the way the script is interpreted first.


Fair warning: I won't be hosting these pictures for very long.  Download 
'em if you want 'em now.



Replacing the fixed-width, typewriter-style font with something a bit
more elegant might also be good


The choice of fonts on the web is pretty limited, unless you want to get 
clever.  I prefer to work with the few standard web fonts, building up 
improved styles relative to the defaults with CSS.  It might be 
interesting to keep the current font, but experiment with letter 
spacing, for instance.


Far more serious problems:

- Use of frames.  The usability problems of frames are well known, and 
are justified only in a few special cases.  A content-heavy site like 
r-project.org is not one of them, if only because of the bookmarking issue.


- Use of Times as the standard font.  Times was commissioned by a 
newspaper, with a primary goal of reducing paper costs.  Its creators 
succeeded by creating something compact and spindly, and thus uncommonly 
ugly and hard to read considering its popularity.  It is marginally 
justifiable on paper, its design target.  It should never be used on 
computer screens; at least, not until they get to 300 dpi or so.  In 
general, use sans serif fonts on computer screens.  There are rare 
exceptions, like Georgia (designed for PC screens from the start) and 
Courier (heavy slab serifs that come out okay on low-res screens).  Look 
at the default fonts used on every OS, and every device with an LCD 
screen you own: they're all sans serif, aren't they?  There's a reason 
for that...


- HTML tables using the default 3D chiseled look.  Nothing says 1995 
better, except maybe blink tags, rainbow colored separator bars, and 
under construction graphics.


__
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] Problems in Recommending R

2009-02-03 Thread Warren Young

friedrich.lei...@stat.uni-muenchen.de wrote:


For technical reasons there are some conditions: the homepage is
maintained via SVN like the R sources, so all should be plain HTML, no
content management system etc.


Consider using a static templating system, or a higher-level document 
language like DocBook's website variant; perhaps even Sweave?


The idea is, you write your pages in a non-HTML format that gets 
compiled to HTML, just like building a program.  Such tools let you do 
things like add a common navigation bar to all pages, so you can stop 
using frames for the nav bar, add common tags to all pages such as CSS 
includes, generate parts of the page programmatically, etc.


I have sites using GTML and WPP for this:

http://sunnyspot.org/wpp/
http://www2.lifl.fr/~beaufils/gtml/

Unfortunately, both are basically abandonware now.  I keep using them 
because they still work, but if I were starting a new site design, I'd 
first look for better-maintained tools.


One option would be to build something similar in R.  A simple 
templating system might only take a few thousand LOC.  R is flexible 
enough that the page source could be R code.  Something like this:


#!/usr/bin/Rscript
require('rhtml')
foo - 'bits'
page - ('
pPage body text goes here./p

pSome [[foo]] of the page can be replaced, or you can
call functions to calculate bits, such as to insert the
current date: [[R(date())]]/p
')
rhtml::generate(page, navbar = 'templates/navbar.R',
header = 'templates/header.R')

Call the script index.R, run it, and get index.html as output.

A side benefit is that you could generate inline graphics with R.  This 
would fix the antialiasing problem brought up above: as better graphics 
drawing code gets put into R, just rebuild the web site on a machine 
with the current version of R.


__
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] Problems in Recommending R

2009-02-03 Thread Warren Young

Neil Shephard wrote:


Perhaps this is a deliberate design and serves as an intelligence test. 
If you can't navigate through to find the correct download you're really

going to struggle getting started with R ;-D


Yyeahhh...look how much that sort of stance has helped the cause of 
Linux on the desktop.  World domination has been a year or two away for 
the last 10 years.  (Speaking as one who uses Linux every day, and used 
it as his main desktop at home for many years before switching to OS X.)


It's easy to pick apart the 6-step process posted above point by point, 
but the main thing to realize is that there really is no good technical 
reason why there have to be 6 decision points between arriving at the 
home page and getting an installable package.


Take a look at how, say, getfirefox.com works.  The download button is 
the biggest thing on the home page, impossible to miss.  The site 
detects what platform you're on, and sets up the button to download that 
platform's latest version.  No doubt they're using a CDN or mirror 
system on the back end, but detection of geographical location is done 
automatically based on client IP, not bothering the user.


I think that's the earlier poster's main point: this can be a one-click 
process.  Why make the human tell the computer things it already knows?


__
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] How do I get my IT department to bless R?

2009-02-03 Thread Warren Young

Stavros Macrakis wrote:


Condescendingly assuming that the IT department is run by idiots whose
decisions are ruled by emotional attachments (as one correspondent
suggested), or that they are irrationally prejudiced against free/open
source, and that it is obvious and irrefutable that you know better
than them (as was implied by some correspondents), may make you feel
better, but probably won't help much.


I assume that I am that one correspondent.

My longer post above was one-sided to drive a point.  I suspect everyone 
here is a logically-leaning sort, who has more than once fallen into the 
trap of thinking that if you just present a logical argument, your 
interlocutor will have no choice but to come over to your side of the 
issue.  This can work, but it's not all that common.  A likelier path to 
success includes an element of emotional jujutsu.


Something I neglected to touch on above is that we should also be aware 
of our own emotional tie-ups.  Most of those of us here *like* R, and 
not entirely for rational reasons.  Perhaps you enjoy the aesthetics of 
the language; maybe you think the default graph types look especially 
nice; maybe you think free software is the only ethical sort; maybe some 
of the people here are friends of yours.


If someone tells us R is no good, those emotions can turn on us, and you 
get a typical ugly advocacy battle.


On the other hand, our feelings about R and its community can give us a 
reason to develop and pursue an emotionally forceful argument, which can 
win the day where a purely rational one wouldn't.  It takes a certain 
amount of charisma or backing force for this to work; emotion again.



It also won't help much if you don't explain clearly and calmly *why*
exactly you need to use R for your work.


Certainly.  Just don't rely wholly on rational reasons.

Don't forget that you are trying to change a human organization, and 
that this is much harder than swapping two columns in an R matrix.



Some companies will be
more careful, wanting to vet any software that can open a TCP
connection (which most non-trivial software systems, including both
Excel and R, can).


Well, yes, I suppose I can't argue that there are probably some 
companies that do actually do this.  I can't prove otherwise.  What is 
obvious from just with a quick look-around, though, is that the vast 
majority of organizations don't.  If they did, it wouldn't have taken a 
decade to get from ActiveX to UAC.



Even if the IT department *is* behaving irrationally, responding
irrationally yourself probably won't help your cause.


I never said you should pursue the cause irrationally.  I just said you 
should never forget that those you're trying to convince are never 
wholly rational.  (A wholly rational human being is actually a pretty 
scary thing, so thankfully rare.)  If you pursue your campaign thinking 
your audience will respond to your questions with T's and F's, the only 
way you can succeed is if they were inclined to support you regardless. 
 Otherwise, you are lost.


By the way, another reading suggestion I kicked myself for leaving out:

http://www.issurvivor.com/
http://weblog.infoworld.com/lewis/

Want to know how IT management thinks and how to work with them to 
effect change?  Read Bob's blog and InfoWorld column.  Some selections 
that are particularly on-point here:


http://www.weblog.keepthejointrunning.com/wordpress/?p=1594
http://www.weblog.keepthejointrunning.com/wordpress/?p=1603
http://www.weblog.keepthejointrunning.com/wordpress/?p=1623
http://www.weblog.keepthejointrunning.com/wordpress/?p=2552
http://www.weblog.keepthejointrunning.com/wordpress/?p=2691

__
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] Problems in Recommending R

2009-02-03 Thread Warren Young

Neil Shephard wrote:



Why make the human tell the computer things it already knows?


Because sometimes the human has a better idea as to what they want than the
computer?


I think the computer can guess the right answer in the solid majority of 
cases.  Up in the 90th percentile certainly, probably much higher.  It 
gets all it needs to make that guess in the HTTP request.


If the default doesn't work, fine, the user can go through the same 
6-step process as now, losing nothing.  This is no argument against 
trying to make a good default.



Example - I've found it infuriating when I've wanted to download browser
source code (as the distro I use compiles from source) for firefox and only
been presented with pre-compiled binaries (if I'm browsing at home) or
windows versions (if I'm at work), then wasting more time trying to find FTP
mirrors where the most recent source tar-balls are available, and as I
remember that took far longer than being able to choose what OS and version
I wanted from a series of clearly written pages.


Granted, Mozilla's leaning strongly toward the end-user binary-only 
case.  People in the R world are more likely to want source than Firefox 
users.  But, it's still less than 1% of all downloads, I'd bet.


__
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] How do I get my IT department to bless R?

2009-01-29 Thread Warren Young

Daniel Viar wrote:

I'd like to get our company to feel
comfortable with open source


Anyone still denying, here in 2009, that open source offers serious 
business value is a dinosaur, doomed to extinction.  Their cerebella 
have calcified.  The balance tipped a decade ago.


Just like the real dinosaurs, extinction will only be fast on a 
geological time scale.  Don't expect your job to evaporate next year 
because they won't use open source.  Just expect that over the coming 
decades to be routinely outcompeted by the mammals.


Chances are, your company actually has embraced open source in some way. 
 One facile argument is to ask if they use Google.  Yes?  Google uses 
Linux, MySQL, and yes, even R, so your company does too, if indirectly. 
 Likely, some bit of open source has crept into your actual operation 
elsewhere besides your little R enclave.



How does one get an all Microsoft
shop on board with allowing users to user R?


Proceed the same way you already are.

It is as Gandhi said: First they ignore you, then they laugh at you, 
then they fight you, then you win.


Every revolution in corporate IT happened this way, including 
Microsoft's own rise to dominance.  (Remember Big Blue?)


__
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] How do I get my IT department to bless R?

2009-01-29 Thread Warren Young

Erik Iverson wrote:


First, you should try to figure out why they would 
not want you to run R, so you can address those reasons specifically.  


Reasons imply reasoning.  It's usually the case that decisions like this 
are made on an emotional basis, not a rational one.


All of my business associates use Microsoft.
All of my friends use Microsoft.
Microsoft is dominant.
I like Microsoft.

These are not reasons.  They are expressions of emotional state. 
Envision a person saying such things wrapped in a security blanket 
printed with the colorful Windows flag logo, sucking their thumb. 
Works, doesn't it?  They are telling you that Microsoft makes them feel 
comfortable.


I don't call this vision into your mind to belittle the people saying 
these things.  We all have these emotional responses; everyone can be 
tarred by this brush.  The point is, if you want to fight such a thing, 
you can be as rational as you like, but never forget that your opponent 
is not being rational.  Tell them this other blanket is better, and 
they'll deny it.  Give them the other blanket, and they'll either drop 
it or attack you for offering it.  Rip away their blanket and you will 
face a tantrum.


A true revolution is unstoppable; open source is such a thing. 
Eventually your opponent will pick up the other blanket all on their own.


You can push things along faster with the tools of statecraft.  This 
field has two main branches.


One branch is war.  This is the practice of applying a combination of 
superior will, strategy, and force to defeat an opponent.  This is the 
rational argument option.  Yes, I call that war.  Why?  It's the 
emotion vs. rationality thing again.  You're using the wrong tool for 
the job, so your only hope of success is to make the opponent capitulate 
through that combination of superior will, strategy and force.  Since 
the OP isn't in a position to mount a frontal assault, this leaves only 
the uglier option, guerrilla war.  This has a good outcome even less 
often than traditional war.


The other branch is diplomacy.  This takes longer, is not as direct, and 
requires a deft touch, but usually works better in the long term.  It 
also requires a certain amount of backing strength.  You can't hope to 
succeed at diplomacy when there is no possibility of war.  If war is 
out, diplomacy is out, too.  If I read the OP's post correctly, he isn't 
in a position to directly wield strength, so he'll need to work through 
channels that give him access to that strength.  He needs to find strong 
allies, and support them.


If there are no such allies, he has no way to prosecute war, and thus no 
way to back diplomacy.  That forces him down a minor branch of 
statecraft, which I call the Switzerland model: keep your head down, and 
continue to be useful to those around you who practice the other forms 
of statecraft.


There are other ways to run a state, but they don't work.

Reading suggestions for anyone who thinks I'm full of it:

http://www.gutenberg.org/files/132/132.txt
http://www.miyamotomusashi.com/gorin.htm
http://www.gutenberg.org/files/15772/15772-h/15772-h.htm
http://catb.org/esr/writings/

__
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] How do I get my IT department to bless R?

2009-01-29 Thread Warren Young

Michael Olschimke wrote:

Could you please share a link to the NY Times article?


http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html

__
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.