Re: [R] How to deal with a dataframe within a dataframe?

2012-05-09 Thread Robert Latest
On Tue, May 8, 2012 at 3:38 PM, R. Michael Weylandt
michael.weyla...@gmail.com wrote:
 So this actually looks like something of a tricky one: if you wouldn't
 mind sending the result of dput(head(agg)) I can confirm, but here's
 my hunch:

Hi Michael,

while I'm trying to get my head around the rest of your post, here's
the output of dput():

 dput(head(agg))
structure(list(`df$quarter` = c(09Q3, 10Q1, 10Q2, 10Q3,
11Q1, 11Q2), `df$tool` = structure(c(1L, 1L, 1L, 1L, 1L,
1L), .Label = c(VS1A, VS1B, VS2A, VS2B, VS3A, VS3B,
VS4A, VS4B, VS5B), class = factor), `df$value` = structure(list(
`0` = c(1.80053430839867, 1.62848325226279), `1` = c(1.29965212329278,
1.26130173276939), `2` = c(1.69901753654472, 1.38156952313768
), `3` = c(1.31168126092175, 1.06723157138633), `4` = c(1.54165763354293,
1.21619657757276), `5` = c(1.29925171313276, 1.18276707678292
)), .Names = c(0, 1, 2, 3, 4, 5))), .Names = c(df$quarter,
df$tool, df$value), row.names = c(NA, 6L), class = data.frame)


I would like this in either the form of a flat data frame (i.e., the
contents of df$value as two separate columns), or -- even preferable
-- learn a better way to retrieve multiple numeric results from a call
to aggregate().

Thanks,
robert

__
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] Problem with Median

2012-05-09 Thread Petr PIKAL
Hi

 
 
 I might be silly but if I was going to type in dput() then how should I 
 send the data over here? 

 dput(zdrz20)

outputs tou your console

structure(list(sklon = c(95, 95, 40, 40, 40, 40, 20, 20, 20, 
20, 20, 20, 20), ot = c(15, 4, 10, 15, 4, 1.5, 1.5, 4, 10, 15, 
4, 10, 15), doba = c(5.88333, 15.75, 12.5, 9.16667, 27, 
65.1667, 88, 38.25, 17., 12.5, 38.2, 17.3, 12.5)), .Names = 
c(sklon, 
ot, doba), row.names = c(NA, 13L), class = data.frame)

you can copy it to your mail and anybody can just paste this and assign it 
to an object.

a.AC - subset(data, class == A-C, select = a)
This result probably in data frame (you can check by str(a.AC)) and as 
such you can not put it directly to median function.

Regards
Petr


 Instead, I've just uploaded the image online, you can access it via the 
link below.
 http://i1165.photobucket.com/albums/q585/halfpirate/data.jpg 
 
  Date: Mon, 7 May 2012 14:55:24 -0400
  Subject: Re: [R] Problem with Median
  From: sarah.gos...@gmail.com
  To: bell_beaut...@hotmail.com
  CC: r-help@r-project.org
  
  Please use dput() to give us your data (eg dput(data) ) rather than
  simply pasting it in.
  
  Sarah
  
  On Mon, May 7, 2012 at 2:52 PM, Suhaila Haji Mohd Hussin
  bell_beaut...@hotmail.com wrote:
  
   Hello.
   I'm trying to compute median for a filtered column based on other 
 column but there was something wrong. I'll show how I did step by step.
   Here's the data:
   a b c  class
  
   1   12   0  90 A-B2   3 9711 A-B3   78   NA 123
 A-C4   NA   NA12A-C5   8 33 2 A-B6   12   NA 0  
A-D
   On the command I typed:
   1) data = read.csv(data.csv)
  
   2) a.AC - subset(data, class == A-C, select = a)
   3) median(a.AC)Error in median.default(a.AC) : need numeric data
   4) is.numeric(a.AC)FALSE
   5) as.numeric(a.AC)Error: (list) object cannot be coerced to type 
'double'
   How can I fix this? Please help.
   Cheers,Suhaila
  
  
  -- 
  Sarah Goslee
  http://www.functionaldiversity.org
   __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] registry vulnerabilities in R

2012-05-09 Thread Barry Rowlingson
On Tue, May 8, 2012 at 4:10 PM, Paul Martin pamar...@alum.mit.edu wrote:

   Kirtland Air Force Base has denied approval for the use of R on its
   Windows network. Some of their objections seem a bit strange, but some
   appear  to  be  legitimate. In particular, they have detected registry
   vulnerabilities
   which are detailed in the attachment.
   I know nothing about Windows registry vulnerabilities. If any of these
   issues are
   legitimate concerns, I would like to see them fixed for everyone's benefit.
   I would
   appreciate a referral to the appropriate forum for this information. I am
   willing
   to  assist  in  getting  questions  answered  and gathering additional
   information.

My thoughts on this matter will be mitigated by my desire not to get
on the no-fly list so I can attend UseR! this year...

Firstly we don't know what the NIPRNet is. The analyst does say this
[software? process?] can be continued for standalone systems, which
seems to imply you can have it on your desktop, but not on NIPRNet. If
NIPRNet is some kind of multi-user system running a variant of Windows
then maybe the security testing is looking for the sort of problems
that occur when you try and mash a single-user operating system into a
multi-user environment. We've never had any problems running R on
Windows Server OSes. It's always been proprietary software that has
insisted on writing to C:\TMP\TEMP.DAT for every user, and with closed
source programs we can't change that...

Secondly, we don't know what the security analysis tool did. I'm
guessing its essentially looking at the difference in the registry
before and after installation or running of R/RStudio, or just
monitoring registry access.

 Numerous forbidden file extensions.
 Numerous registry vulnerabilities
 Network connections to foreign IP address

 The file extensions section of this 'security audit' relate to Adobe
Acrobat Reader and a registry key with USAF_PKI_SPO in the name.
Somehow I don't think R did this. It doesn't mention .r files, which
should be one file extension that R uses. So at least that's not
forbidden.

 The long list of registry vulnerabilities is also equally odd. It
looks like a standard set of registry keys plus a whole bunch of
firewall configuration. Has R tried to modify these? Has R tried to
read these? It almost certainly didn't write them. Googling for
Windows registry vulnerabilities doesn't find anything specific. It
doesn't seem to be a class of security problems.

 After completing the vulnerability analysis, we decided to decline to
 approve R/RStudio software on the NIPRNet. We discovered many unmitigated
 risks and numerous registry vulnerabilities.  Above mentioned open source
 software poses high risks to the NIPRNet. We recommend using software from
 the Kirtland Base approved list. Here are some examples of the base approved
 statistical software:

  Here's where we all face-palmed. High risk?

 I apologize this may cause interruption in your project. Most proprietary
 software are safe for NIPRNet use but this one caused some concerns.
 However, this can be continued for standalone system. Please accept my
 humble apology.

 Maybe if you shell out for a proprietary version of R you'll get it approved.

 So, given the large quantity of unknowns (both known unknowns and
unknown unknowns) there's not much we can do. It seems that a security
tool which I doubt the analyst understands and which I doubt we are
allowed to know much about has just decided to block you.

 The great irony being of course that open source software is more
secure than any close-source proprietary system.

Barry


Barry

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


Re: [R] two Y Axes (in the same scale) in ggplot2

2012-05-09 Thread Jim Lemon

On 05/09/2012 05:29 AM, wudadan wrote:

Dear R users,

I'm plotting housing prices in City A over past 30 years in ggplot2. The Xs
are years since 1980. I have two housing price variables: new home prices
and old home prices, both of them measured by $/sqft. I have searched
related threads on multiple Y axes in ggplot2 and I understand that multiple
Y axes in different scales are not possible. I'm wondering if it is possible
to have multiple Y axes with the same scale in ggplot2, like in my case. If
still not possible, is there a easy way to do it in R's default plot
function? Thanks.


Hi Gary,
Perhaps twoord.plot (plotrix) will do what you want.

Jim

__
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] PPM to BMP converter

2012-05-09 Thread Jan van der Laan


I don't know if any R-packages exist that can do this, but you could  
install imagemagick (http://www.imagemagick.org), which provides  
command line tools for image manipulation and conversion, and call  
these from R using system. Something like:


system(convert yourimage.ppm yourimage.bmp)

HTH,

Jan



ZHANG Yingqi zhangyin...@ivpp.ac.cn schreef:


Dear all,
Several days ago, I posted How to write a bmp file pixel by  
pixel. Instead of bmp, I succeeded in writing a PPM file by using  
the pixmap package. Thanks for the hint generously provided by Uwe  
Ligges.
Now I have a new question. How to convert a PPM file to BMP  
file in R? I know I can do this in photoshop or by some other  
softwares, but I think if I Can do this in R, that would be great!  
Would anyone please give me any hints? just hints, I will dig it  
out! Thanks a lot!



Yingqi


Yingqi ZHANG

Beijing P.O. Box 643, China 100044
Institute of Vertebrate Paleontology and Paleoanthropology (IVPP)
Chinese Academy of Sciences
Tel: +86-10-88369378 Fax: +86-10-68337001
Email: arvico...@gmail.com

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


__
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] How to import .accda database into R

2012-05-09 Thread Tammy Ma

Dear R user:

How to import .accda database into R?

I have tried many ways, still doesn't work. Thanks in advance.

Kind regards,
Tammy
  
[[alternative HTML version deleted]]

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


Re: [R] glmmADMB

2012-05-09 Thread rbuxton
Update!  

I changed the site categories.  I noticed that I had coded them as North,
South, East, West on different islands, which may have caused confusion in
the model.

Now I get a whole new error message!


Error in glmmadmb(LESP.CHUCKLE ~ 1 + (1 | SITE/ISLAND), data = callsna,  : 
  The function maximizer failed (couldn't find STD file)
In addition: Warning message:
running command 'C:\windows\system32\cmd.exe /c
C:/Users/Rachel/Documents/R/win-library/2.14/glmmADMB/bin/windows32/glmmadmb.exe
-maxfn 500 -maxph 5 -noinit -shess' had status 1 

I followed the instruction you gave to a similar error message posted in
google groups (I downloaded version 0.7 and installed it):
http://groups.google.com/group/admb-users/browse_thread/thread/56d665acfb756ac4

With no avail! Still get the same lousy error message!

The following models work ok: 

mod - glmmadmb(LESP.CHUCKLE~ 1+(1|SITE), data=callsna, zeroInflation=TRUE,
family=nbinom)

and 

mod - glmmadmb(LESP.CHUCKLE~ 1+(1|ISLAND), data=callsna,
zeroInflation=TRUE, family=nbinom)

Any thoughts?

Thanks so so much!

Rachel Buxton

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

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


[R] Barplots inside loop - several data errors, workaround needed

2012-05-09 Thread Lee
I have a series of data which is managed through a loop. The loop creates
pivot tables of my data using the *cast* function in the
*reshape*library. For the most part, the data is all plotted
correctly.
Unfortunately, there are a couple of data sets which create errors and halt
the loop.

One of the tables looks like the following:

  dbh Black Walnut
1   8 38.19722
2  10 48.89244
3  12 38.19722

When the loop attempts the barplot() function, the following error is
returned:
Error in seq_len(p) : argument must be coercible to non-negative integer

In other cases, there is simply no data in the specified set of data.
Therefore, the table is full of NA's. Obviously, this does not need to be
plotted, but I cannot simply remove it from the larger database. I need my
loop to continue regardless of if it runs into these issues.

*Question: What can I do to ensure the above single variable table will
plot correctly? and what can I do to suppress errors on the datasets which
do not have data so the loop continues?*

full code: http://pastebin.com/LB88hpfM

Thank you in advance.

--
all the best,
Lee Mueller
ISA Certified Arborist MI-4148A
Registered Forester #46043

[[alternative HTML version deleted]]

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


Re: [R] Matrix heatmap

2012-05-09 Thread fjucks
this would be the same, like, I need color higher for larger numbers, type,
variations of 5 om 5, for example, 0 is white, a little darker 1-5, 6-10
darker still, and so on ...

--
View this message in context: 
http://r.789695.n4.nabble.com/Matrix-heatmap-tp4619084p4619334.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Matrix heatmap

2012-05-09 Thread fjucks
arq -read.table(file) 
 arq_matrix -data.matrix(arq) 
dput(arq)
 arq_heatmap - heatmap(arq_matrix, Rowv = NA, Colv = NA,col = heat.colors
 (256), scale = column, margins =c(5,10)) 

dput done with this command, but still gave the same ..

I do it before generating the heatmap?

would be this way?

--
View this message in context: 
http://r.789695.n4.nabble.com/Matrix-heatmap-tp4619084p4619284.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] How to run this model using nonlinear least square in R.

2012-05-09 Thread tpham3
http://r.789695.n4.nabble.com/file/n4619404/pic1.jpg 

cesres_ext - nls(lnGDP85~ intercept + (alpha/(1-alpha-beta)) *
lns_ikonngdelta + (beta/(1-alpha-beta)) * lns_ihonngdelta + 0.5 *
((sigma-1)/sigma) * (1/((1-alpha-beta)*(1-alpha-beta))) * (alpha * taylor1 +
beta * taylor2 - alpha*beta*taylor3) ,start = list(intercept=8, alpha=0.2,
beta=0.4, sigma=1.2),data=data)

I have this model. I use the command above in R, and it gives me a desirable
result. It gives me implied alpha, implied beta, and implied xicma just
fine.

 However next I have to run another model, which is pretty much similar,
however now it has theta in there. In my paper that I replicate, they only
report implied alpha, implied beta, and implied xicma just like the above
model, there's no theta report. So I wonder how would I put theta in this
function. What role theta plays in this model. What could be the command. It
seems like there's no estimation of theta. Is that theta given. In the paper
they say : theta = 1 - exp(-Lt)) where L is like a convergence rate. The
model looks like this:

http://r.789695.n4.nabble.com/file/n4619404/pic2.jpg 



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-run-this-model-using-nonlinear-least-square-in-R-tp4619404.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Panel MNP

2012-05-09 Thread rajeshpaleti
Thanks for the information... the repeated posts were a mistake on my part
..intention was not to spam the list...

On Tue, May 8, 2012 at 9:58 PM, Mark Leeds-3 [via R] 
ml-node+s789695n4619286...@n4.nabble.com wrote:

 Hi: I sent you an email earlier privately. why you keep sending the same
 email over
 and over is not clear to me. ? the package by rossi et al, called
 bayesm,
 has a function in it that supposedly does what you want. I don't know the
 details of the function because I was using
 their package for something else.  the textbook associated with the
 package
 is difficult to follow
  ( just my opinion of course. someone else may love it ) but might be
 worth
 purchasing for understanding purposes because there's is a bayesian probit
 example  in the text.  that's all I can tell you so it's probably best to
 stop sending the same email over and over again.










 On Tue, May 8, 2012 at 2:48 PM, rajeshpaleti [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=4619286i=0wrote:


  Hi All,
 
  Sorry for posting the same question again. I was not sure if the message
  was
  sent initially since it was my first post the forum.
 
  Can the MNP package available in R be used to analyze panel data as
 well?
 
  i.e., if there are 3 observed discrete choices for three time periods
 for
  the same individual , can i estimate a panel multinomial probit model
 which
  allows correlated errors across time periods and individual
 heterogeneity
  (random coefficients) using the MNP package?
 
  In the case that it doesn't work, is there any other Bayesian inference
  based R package for estimating panel MNP models?
 
  Thanks,
  Rajesh
 
  --
  View this message in context:
  http://r.789695.n4.nabble.com/Panel-MNP-tp4618340.html
  Sent from the R help mailing list archive at Nabble.com.
 
  __
  [hidden email] 
  http://user/SendEmail.jtp?type=nodenode=4619286i=1mailing 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.
 

 [[alternative HTML version deleted]]

 __
 [hidden email] http://user/SendEmail.jtp?type=nodenode=4619286i=2mailing 
 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.


 --
  If you reply to this email, your message will be added to the discussion
 below:
 http://r.789695.n4.nabble.com/Panel-MNP-tp4618340p4619286.html
  To unsubscribe from Panel MNP, click 
 herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4618340code=ZHVyZ2FyYWplc2gxMjNAZ21haWwuY29tfDQ2MTgzNDB8LTMzNzQ4NDMzMw==
 .
 NAMLhttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




-- 
Cheers
Rajesh


--
View this message in context: 
http://r.789695.n4.nabble.com/Panel-MNP-tp4618340p4619419.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

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


Re: [R] Lattice side by side boxplots with average

2012-05-09 Thread maxbre
thanks ilai

that's exactly what I was looking for!

in fact, I've been in trouble with:
-  the assignment of mean values to each factor (which is correctly sorted
out by mean.values[x] as your example clearly show up)
- and also with the position of mean values along x axis (because that x +
(group.number-1.5)/3 is still something not fully undertstood to myself)

thank you again

best

massimo

--
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-side-by-side-boxplots-with-average-tp4617831p4619488.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Dotchart showing mean and median by group

2012-05-09 Thread maxbre
Given this example

mean.values-colMeans(VADeaths)

mean.values-apply(VADeaths, 2, mean)
median.values-apply(VADeaths, 2, median)

dotchart(VADeaths, gdata=mean.values)
dotchart(VADeaths, gdata=median.values)

is it possible to “combine” a single dotchart showing both the mean and the
median for each single group (with different plotting symbols)?

…is it that possible with the use of the standard graphics or it is
necessary (better) to use of a different package? 

Any example for this in my favourite (even almost always too much complex
for myself) package lattice?

thank you

--
View this message in context: 
http://r.789695.n4.nabble.com/Dotchart-showing-mean-and-median-by-group-tp4619597.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] RJMCMC.

2012-05-09 Thread DINESH



Dennis Murphy djmuser at gmail.com writes:

 
 Hi:
 
 library(sos)  # install first if you don't already have it
 
 findFn('reversible jump')
 
 It appears that a good starting point might be the RJaCGH package,
 which is concerned with reversible jump MCMC in CGH arrays. Other
 possiblilities may be found in the bim, evdbayes and ape packages.
 
 HTH,
 Dennis
 

Hi,
Is there any sample tutorial/code to understand RJMCMC in image segmentation? 
Initially, I want to understand how an image can be obtained from a probability 
distribution like a gaussian mixture...

__
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] Matrix heatmap

2012-05-09 Thread Petr PIKAL
Hi

 
 arq -read.table(file) 
  arq_matrix -data.matrix(arq) 

Are you sure that arg_matrix is numeric? Did you check it somehow?

 dput(arq)

You forgot to include dput(arg) result. Without that only you know what 
arg is.

  arq_heatmap - heatmap(arq_matrix, Rowv = NA, Colv = NA,col = 
heat.colors
  (256), scale = column, margins =c(5,10)) 
 
 dput done with this command, but still gave the same ..
 
 I do it before generating the heatmap?
 
 would be this way?

Which way?

Regards
Petr

 
 --
 View this message in context: http://r.789695.n4.nabble.com/Matrix-
 heatmap-tp4619084p4619284.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] file path

2012-05-09 Thread Wincent
Dear all, is there any function to assert whether a file path is
legitimate, and to convert any potential file path to a legitimate
file path?

I automate a batch of files and write them to plain text files with
cat(). The file argument of cat() is generated automatically which may
contain characters such as ?  , unacceptable in Windows OS. What I
do at this moment is to strip such characters off with gsub(). Is
there any direct way to make legitimate file path without detailed
knowledge about the naming rule specific to a OS?

Best

-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://homepage.fudan.edu.cn/rghuang/cv/

__
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] Matrix heatmap

2012-05-09 Thread BrittD
I would leave my table as a heatmap where darker colors represent higher
similarity, and the lighter colors represent less level of similarity.
 
I'm using version 2.11 of R.


I once used this code, maybe it will help you:

#dendogram
plot(dendro15, labels = cellType)  ### I first made a dendrogram of my data

#heatmap specifications
# Filter genes on variance otherwise the heatmap cannot be shown.
em - exprs(ALL)[which(apply(exprs(ALL), 1, sd)  1.75), ]    I had so
many genes I had to filter them
pal - maPalette(low=blue, high=yellow, mid=NULL, k=25)    You can
make a color palet here to specify
## the light and dark colors. 

### Heatmap
heatmap(em, Colv=as.dendrogram(dendro15), col=pal, labCol=cellType)  


--
View this message in context: 
http://r.789695.n4.nabble.com/Matrix-heatmap-tp4619084p4619683.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Barplots inside loop - several data errors, workaround needed

2012-05-09 Thread Jim Holtman
?try

Sent from my iPad

On May 8, 2012, at 22:03, Lee muell...@gmail.com wrote:

 I have a series of data which is managed through a loop. The loop creates
 pivot tables of my data using the *cast* function in the
 *reshape*library. For the most part, the data is all plotted
 correctly.
 Unfortunately, there are a couple of data sets which create errors and halt
 the loop.
 
 One of the tables looks like the following:
 
  dbh Black Walnut
 1   8 38.19722
 2  10 48.89244
 3  12 38.19722
 
 When the loop attempts the barplot() function, the following error is
 returned:
 Error in seq_len(p) : argument must be coercible to non-negative integer
 
 In other cases, there is simply no data in the specified set of data.
 Therefore, the table is full of NA's. Obviously, this does not need to be
 plotted, but I cannot simply remove it from the larger database. I need my
 loop to continue regardless of if it runs into these issues.
 
 *Question: What can I do to ensure the above single variable table will
 plot correctly? and what can I do to suppress errors on the datasets which
 do not have data so the loop continues?*
 
 full code: http://pastebin.com/LB88hpfM
 
 Thank you in advance.
 
 --
 all the best,
 Lee Mueller
 ISA Certified Arborist MI-4148A
 Registered Forester #46043
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] There must be a better way to do this

2012-05-09 Thread Jim Lemon

On 05/09/2012 03:59 AM, David Perlman wrote:

I made this rather cool plot which I am quite pleased with:
http://brainimaging.waisman.wisc.edu/~perlman/data/BeeswarmLinesDemo.pdf

However, I feel there must be a better way to do it than what I did.  I'm 
attaching the code to create it, which downloads the data by http so it should 
run for you if you have the current version of beeswarm installed (which was 
just updated today, incidentally).  It might also work with a non-current 
version of beeswarm.

The problem is that I jumped through all kinds of hoops to:

a) get the subject numbers for each point associated with the point xy coordinates output 
by beeswarm.  The order of the points is not the same as the order in the input file; 
they are shuffled in a way that I think depends on the input formula.  The trick I used 
(ok, I hope you're sitting down when you read this) is to run beeswarm a second time with 
pwcol=Subj, so then the col column of the output becomes the subject numbers. 
 I know, horrible.  But I don't know how else to do it.  I feel like there is probably 
some logic to the way the cases were reordered by the formula, but I don't know how to 
work with that.

b) get the lines() function to pair the xy coordinates properly.  I did this by 
reshaping the whole thing into wide format, with separate columns for x.1 y.1 
x.2 y.2, and then add a third pair of columns x.3 y.3 which is all NA, and then 
reshaping it back into long format.  Then the lines() function automatically 
does the right thing, but I feel like that was a horrible hack and there must 
be a smarter way to do it.



Hi Dave,
This plot looks like the offspring of a boxplot, a beeswarm plot and a 
bumpchart after a heavy night on the grog. Beauty is in the eye of the 
beholder, I guess.


Let's see, first you plot the boxplots, then the beeswarm on the 
centerlines of the boxplots, then you want to add the lines. Okay, try this:


paindat-data.frame(
 HEP1=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10))),
 HEP2=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10))),
 MBSR1=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10))),
 MBSR2=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10))),
 Wait1=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10))),
 Wait2=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10
boxplot(paindat,ylim=c(0,20),
 col=c(pink,pink,lightgreen,lightgreen,lightblue,lightblue))
require(beeswarm)
bsinfo-beeswarm(tangledat,add=TRUE)
segments(bsinfo$x[bsinfo$x.orig==HEP1],bsinfo$y[bsinfo$x.orig==HEP1],
 bsinfo$x[bsinfo$x.orig==HEP2],bsinfo$y[bsinfo$x.orig==HEP2])
segments(bsinfo$x[bsinfo$x.orig==MBSR1],bsinfo$y[bsinfo$x.orig==MBSR1],
 bsinfo$x[bsinfo$x.orig==MBSR2],bsinfo$y[bsinfo$x.orig==MBSR2])
segments(bsinfo$x[bsinfo$x.orig==Wait1],bsinfo$y[bsinfo$x.orig==Wait1],
 bsinfo$x[bsinfo$x.orig==Wait2],bsinfo$y[bsinfo$x.orig==Wait2])

and let me say right here that the beeswarm function is a crackerjack 
piece of work.


Jim

__
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] Numerical integration of a two dimensional function over a disk

2012-05-09 Thread yingfu xie
Hello,
 
I understand that the standard way out is the Polar Conversion. I was almost 
there, but I must have thought something wrong. I will try that again. Thanks 
for your reply!
 
Best regards,
Yingfu



From: Jeff Newmiller jdnew...@dcn.davis.ca.us

ect.org 
Sent: Tuesday, May 8, 2012 1:44 PM
Subject: Re: [R] Numerical integration of a two dimensional function over a disk

Simply impossible seems an odd description for a technique described in every 
elementary calculus text under the heading integration in cylindrical 
coordinates.
---
Jeff Newmiller                        The    .      
.  Go Live...
DCN:jdnew...@dcn.davis.ca.us        Basics: ##.#.      ##.#.  Live 
Go...
                                      Live:  OO#.. Dead: 
OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.      #.O#.  with
/Software/Embedded Controllers)              .OO#.      .OO#.  
rocks...1k
---
Sent from my phone. Please excuse my brevity.



Hello, there!
�
Basically my problem is very clear. I would like to take a
(numerical)�integration of a function f(x,y) which can be quite complex
of x and y, over a disk (x-a)^2+(y-b)^2= r^2 (with r constant).
However, after some search in R, I just cannot find a function in R
that suits my purpose. Function Integrate applies to one dimensional,
and adaptIntegrate to�rectangle. In my case, it is not easy or
simply�impossible�to transform�the definition area�to a rectangle with
constant�boundaries. ��I must have missed something, but is there any R
function which can solve the integration without going to ex. Monto
[[elided Yahoo spam]]
�
Best regards,
Yingfu
    [[alternative HTML version deleted]]

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

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


[R] white lines in barplot

2012-05-09 Thread Marion Wenty
Dear R-helpers,

I would like to draw white lines in my barplots to improve the
visualization.

I include an example:

barplot(sample(1:100,15),width=0.59,horiz=T,col=steelblue,border=NA,axes=F,ylim=c(0,10),xlim=c(0,100))
  abline(v = seq(10, zehnind, by = 10), col = white)
axis(1,at=ticks,las=1,labels=paste(ticks,%,sep=))

my problem is, that the white lines are not long enough at the top.

I also tried the function lines and asix, which didn't work either, neither
did changing the ylim.

Does somebody know how to do this?

Marion

[[alternative HTML version deleted]]

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


Re: [R] white lines in barplot

2012-05-09 Thread Jim Lemon

On 05/09/2012 07:12 PM, Marion Wenty wrote:

Dear R-helpers,

I would like to draw white lines in my barplots to improve the
visualization.

I include an example:

barplot(sample(1:100,15),width=0.59,horiz=T,col=steelblue,border=NA,axes=F,ylim=c(0,10),xlim=c(0,100))
   abline(v = seq(10, zehnind, by = 10), col = white)
axis(1,at=ticks,las=1,labels=paste(ticks,%,sep=))

my problem is, that the white lines are not long enough at the top.

I also tried the function lines and asix, which didn't work either, neither
did changing the ylim.


Hi Marion,
Try this:

...
par(xpd=TRUE)
abline(v = seq(10, zehnind, by = 10), col = white)
par(xpd=FALSE)
...

Jim

__
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] white lines in barplot

2012-05-09 Thread Marion Wenty
Yes, this worked!
Thank you very much!!
Marion

2012/5/9 Jim Lemon j...@bitwrit.com.au

 On 05/09/2012 07:12 PM, Marion Wenty wrote:

 Dear R-helpers,

 I would like to draw white lines in my barplots to improve the
 visualization.

 I include an example:

 barplot(sample(1:100,15),**width=0.59,horiz=T,col=**
 steelblue,border=NA,axes=F,**ylim=c(0,10),xlim=c(0,100))
   abline(v = seq(10, zehnind, by = 10), col = white)
 axis(1,at=ticks,las=1,labels=**paste(ticks,%,sep=))

 my problem is, that the white lines are not long enough at the top.

 I also tried the function lines and asix, which didn't work either,
 neither
 did changing the ylim.

  Hi Marion,
 Try this:

 ...
 par(xpd=TRUE)

 abline(v = seq(10, zehnind, by = 10), col = white)
 par(xpd=FALSE)
 ...

 Jim


[[alternative HTML version deleted]]

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


Re: [R] PPM to BMP converter

2012-05-09 Thread Michael Sumner
You could write it to BMP with rgdal, i.e. with dummy world coordinates:

x1 - list(x = 1:5, y = 1:4, z = matrix(1:20, 5, 4))

require(sp)
x2 - image2Grid(x1)

require(rgdal)
writeGDAL(x2, file.bmp, driver = BMP, type = Byte, mvFlag = 255)

(I am not familiar with the details of what BMP can support, so I just
limit to Byte and stay safe. )

To show the round trip, convert back to image xyz list:

as.image.SpatialGridDataFrame(readGDAL(file.bmp))$z
file.bmp has GDAL driver BMP
and has 4 rows and 5 columns
 [,1] [,2] [,3] [,4]
[1,]16   11   16
[2,]27   12   17
[3,]38   13   18
[4,]49   14   19
[5,]5   10   15   20

I was a bit surprised to find that there seem to be no coercion
functions to convert to/from pixmap within the family of packages that
include maptools, sp, spatstat  and raster , they would be useful. I
would say that raster would be the best bet in the first instance
since it can store the different colour models directly. There is also
new rasterImage support in the graphics package that is worth
mentioning. All of these packages have different data structures, but
there is a growing set of coercion functions and it's not too hard
once you understand them to do it yourself.

Cheers, Mike.




On Wed, May 9, 2012 at 8:31 AM, ZHANG Yingqi zhangyin...@ivpp.ac.cn wrote:
 Dear all,
        Several days ago, I posted How to write a bmp file pixel by pixel. 
 Instead of bmp, I succeeded in writing a PPM file by using the pixmap 
 package. Thanks for the hint generously provided by Uwe Ligges.
        Now I have a new question. How to convert a PPM file to BMP file in R? 
 I know I can do this in photoshop or by some other softwares, but I think if 
 I Can do this in R, that would be great! Would anyone please give me any 
 hints? just hints, I will dig it out! Thanks a lot!


 Yingqi
 

 Yingqi ZHANG

 Beijing P.O. Box 643, China 100044
 Institute of Vertebrate Paleontology and Paleoanthropology (IVPP)
 Chinese Academy of Sciences
 Tel: +86-10-88369378     Fax: +86-10-68337001
 Email: arvico...@gmail.com

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



-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsum...@gmail.com

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


[R] plot betadisper, change of pch

2012-05-09 Thread Albin Blaschka


Hello!

After performing an analysis with betadisper, package vegan I would like 
to plot the results - so far, so good. But I would also like to tune a 
little bit the plotting characters, as '+' and 'x' are a little to 
similar...


My (boiled down) code:

[See session info at the bottom of the mail, vegan is vegan_2.0-3]

mod - betadisper(mydata, mygroups, type='median')
syms - c(rep(1:4, each = 16))
modplot - plot(mod, axes = c(1,2), main='', pch=syms)

I get the error message (roughly translated from german):
formal argument 'pch' fits to more given arguments
[formales Argument pch passt zu mehreren gegebenen Argumenten]

What do I have to change?

Thank you in advance!
Albin

 sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-linux-gnu (64-bit)

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


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

other attached packages:
[1] rgl_0.92.798  reshape_0.8.4 plyr_1.7.1MASS_7.3-16 
vegan_2.0-3   permute_0.7-0 RPostgreSQL_0.3-2

[8] DBI_0.2-5

loaded via a namespace (and not attached):
[1] grid_2.15.0lattice_0.20-6 tools_2.15.0


--
| Albin Blaschka, Mag.rer.nat.
| Etrichstrasse 26, A-5020 Salzburg
| * www.albinblaschka.info * www.thinkanimal.info *
| - It's hard to live in the mountains, hard but not hopeless!

__
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] ergm model, nodematch with diff=T

2012-05-09 Thread Florian Weiler
Dear all,

I am new to network analysis, but since I have good data I started to read
about it and learned how to use the ergm and related packages.  I generally
get interesting results, but when I run a model including sociality and
selective mixing effects for different groups, the model runs (and
converges) but I get a warning as follows:

mod - ergm(network ~ edges + gwesp(0, fixed=T) + nodefactor(code) +
nodematch(code, diff=T)+ nodecov(vulnEVI) + absdiff(vulnEVI))
Observed statistic(s) nodematch.code.5, nodematch.code.6, and
nodematch.code.8 are at their smallest attainable values. Their coefficients
will be fixed at -Inf.

The model nevertheless runs and converges and produces the following output:
==
Summary of model fit
==

Formula:   network ~ edges + gwesp(0, fixed = T) + nodefactor(code) + 
nodematch(code, diff = T) + nodecov(vulnEVI) + absdiff(vulnEVI)

Iterations:  20 

Monte Carlo MLE Results:
  Estimate Std. Error MCMC % p-value
edges -5.345310.66468 NA  1e-04 ***
gwesp.fixed.0  2.179070.27527 NA  1e-04 ***
nodefactor.code.3 -0.194240.20055 NA 0.33283
nodefactor.code.4 -0.457330.21730 NA 0.03538 *  
nodefactor.code.5 -0.490810.22815 NA 0.03151 *  
nodefactor.code.6 -1.194680.25695 NA  1e-04 ***
nodefactor.code.7 -1.262900.24369 NA  1e-04 ***
nodefactor.code.8 -1.263650.38244 NA 0.00096 ***
nodematch.code.2   0.100711.31137 NA 0.93879
nodematch.code.3   2.703980.53684 NA  1e-04 ***
nodematch.code.4   0.671570.26456 NA 0.01117 *  
nodematch.code.5  -Inf NA NA  NA
nodematch.code.6  -Inf NA NA  NA
nodematch.code.7   0.586400.81906 NA 0.47407
nodematch.code.8  -Inf NA NA  NA
nodecov.vulnEVI0.225620.07024 NA 0.00133 ** 
absdiff.vulnEVI   -0.010860.11925 NA 0.92742
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 


Hence the model is unable to obtain estimates for three of the groups and I
don't understand why. When I include the nodematch with diff=F there is no
problem (although of course I only get one coefficient). Does anyone know
what the problem might be? At first I though there might not be any edges
connecting members of groups 5, 6, and 8, but I checked this and they
certainly do cooperate among them. Any help would be greatly appreciated.
Thank you!

Best,
Florian


--
View this message in context: 
http://r.789695.n4.nabble.com/ergm-model-nodematch-with-diff-T-tp4620052.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] optim question

2012-05-09 Thread John C Nash
When I run your problem in optimx (with all.methods=TRUE), L-BFGS-B fails 
because the
function is evaluated out of range. optimx (actually the optfntools package) 
from R-forge
can trap these, and it is usually a good idea to stop and figure out what is 
going on.
Nevertheless, it seems a solution can be found by other methods, and even by 
L-BFGS-B if
one is prepared to ignore these glitches.

A big +++ for including an executable example. Of course, I would not have 
answered otherwise.

Note that the optimx and optfntools on R-forge are at the moment undergoing a 
lot of
review and change.

Best, JN


 Message: 4
 Date: Tue, 8 May 2012 14:35:10 -0500
 From: Wenhao Gui guiwen...@gmail.com
 To: r-help@r-project.org
 Subject: [R] optim question
 Message-ID:
   CABZdO=zKr1wsXmTOQ54UieVQfpkAx=cyt0dzip7yt1cjb6e...@mail.gmail.com
 Content-Type: text/plain
 
 Hello,
 
 I used optim to find the MLE estimates of some parameters.  See the code
 below.  It works for data1(x). but It did not work for data2 and the error
 says L-BFGS-B needs finite values of 'fn' .
 
 data2:   c(x, 32)  that is, if I added the number 32 at the end of data1.
 The error appears non-finite function value etc.
 
 Any comments or suggestions?
 
 Thanks!
 
 Wenhao


__
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] barplot: legend: two rows

2012-05-09 Thread Marion Wenty
dear r-helpers,

i have got another question:

i am using the functions

par(xpd=T)
legend

to create a legend below the x-axis. i used the parameter horiz=T.

now i would like to put the elements of the legend in two rows:

e.g. if my legend has got 5 elements, i would like 3 elements in one row
and the last two elements in the next row.

does anyone know how to do that?

thank you very much for your help in advance!

marion

[[alternative HTML version deleted]]

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


Re: [R] some R exercises

2012-05-09 Thread Florian Weiler
On Exercise 5, how about this (I'm rather new to R as well, so no guarantee
this is right and I'm sure there are more efficient ways to do this!):

fun1 - function(x) {
  y - 0
  for (i in 1:length(x))
  {y[i] - (x[i]-mean(x))^2}
  sum(y)/(length(x)+1)
}

fun2 - function(x) {
  y - 0
  for (i in 1:length(x))
  {y[i] - (x[i]-mean(x))^2}
  sum(y)/(length(x))
}

x - rexp(15)
fun1(x)
fun2(x)

--
View this message in context: 
http://r.789695.n4.nabble.com/some-R-exercises-tp4619850p4620143.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] some R exercises

2012-05-09 Thread Florian Weiler
Just thought about it, you can have this of course cheaper without the
loops. Like this:

fun1 - function(x) sum((x-mean(x))^2)/(length(x)+1)
fun2 - function(x) sum((x-mean(x))^2)/(length(x))

x - rexp(15)
fun1(x)
fun2(x)

--
View this message in context: 
http://r.789695.n4.nabble.com/some-R-exercises-tp4619850p4620163.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Automating R for Hypothesis Testing

2012-05-09 Thread meredith
dput:  http://r.789695.n4.nabble.com/file/n4620188/milwaukeephos.csv
milwaukeephos.csv 

# Feb-march
 modelH_febmarch-lm(llfeb_march~lffeb_march)
modelHa_febmarch-lm(llfeb_march~X1feb_mar+lffeb_march)
 anova(modelHa_febmarch)
 coefficients(modelH_febmarch)
(Intercept) lffeb_march 
  -2.4298901.172821 
 coefficients(modelHa_febmarch)
(Intercept)   X1feb_mar lffeb_march 
 -2.8957776  -0.5272793   1.3016303 
 bres_fm-matrix(c(-2.429890,0,1.172821),nrow=3)
 bunres_fm-matrix(c(-2.8957776,-0.5272793,1.3016303),nrow=3)
bfm-t(bunres_fm-bres_fm)
 fmvect-seq(1,1,length=34)
 X1a_febmar-seq(0,0,length=9) # dummy variable step 1
 X1b_febmar-seq(1,1,length=25) # dummy variable step 2
 X1feb_mar-c(X1a_febmar,X1b_febmar) #dummy variable creation
# Test Stat Equation for Chisq
 fmxx-cbind(fmvect,X1feb_mar,lffeb_march)
 tfmx-t(fmxx)
 xcom_fm-(tfmx %*% fmxx)
 xinv_fm-ginv(xcom_fm)
 var_fm-xinv_fm*0.307
 chi_fm-bfm %*% var_fm %*% (bunres_fm-bres_fm)
 chi_fm # chisq value for recording
if less than CV move onto to slope modification
 modelH2_febmarch-lm(llfeb_march~X3feb_march)
 modelH2a_febmarch-lm(llfeb_march~X3feb_march+X4feb_march)
 anova(modelH2a_febmarch)
 coefficients(modelH2_febmarch) # get coefficients to make beta vectors for
 test
(Intercept) X3feb_march 
   5.3421301.172821 
 coefficients(modelH2a_febmarch)
(Intercept) X3feb_march X4feb_march 
  5.2936263   1.0353752   0.2407557 
# Test Stat
 bsres_fm-matrix(c(5.342130,1.172821,0),nrow=3)
 bsunres_fm-matrix(c(5.2936263,1.0353752,0.2407557),nrow=3)
 bsfm-t(bsunres_fm-bsres_fm)
 #X matrix
 fmxs-cbind(fmvect,X3feb_march,X4feb_march)
 tfmxs-t(fmxs)
 xcoms_fm-(tfmxs %*% fmxs)
 xinvs_fm-ginv(xcoms_fm)
 var_fms-xinvs_fm*0.341
 chi_fms-bsfm %*% var_fms %*% (bsunres_fm-bsres_fm)
 chi_fms
# Record Chisq value

Does this help?
Here lffeb_march is the combination of Feb and March log flows
and llfeb_march is the combination of Feb and March log loads
X3: lffeb_march-mean(feb_march)
X4: X1*X3

Thanks

Rui Barradas wrote
 
 Hello,
 
 I'm not at all sure if I understand your problem. Does this describe it?
 
 
 test first model for months 1 and 2
 if test statistic less than critical value{
   test second model for months 1 and 2
   print results of the first and second tests? just one of them?
 }
 move on to months 2 and 3
 etc, until months 12 and 1
 
 
 Please post example data using dput(dataset).
 Just copy it's output and paste it in your post.
 
 And example code, what you're already doing.
 (Possibly simplified)
 
 Rui Barradas
 
 
 meredith wrote
 
 R Users-
   I have been trying to automate a manual code that I have developed for
 calling in a .csv file, isolating certain rows and columns that
 correspond to specified months:
 something to the effect
 i=name.csv
 N=length(i$month)
 iphos1=0
 iphos2=0
 isphos3=0
 for i=1,N
  if month=1
 iphos1=iphos+1
 iphos1(iphos1)=i
 
 an so on to call out the months into there own arrays (unless there is a
 way I can wrap it into the next automation)
 
 Next: I would like to run a simple linear regression combining each of
 the months 1 by 1:
 for instance I want to run a regression on a combined model from months 1
 and 2 and a dummy model for 1 and 2, compare them using a Chi-sq
 distribution, if Chi-sq is less than the Critical value, we accept and go
 on to test another set of models with both 1 and 2. If it rejects, then
 we proceed to months 2 and 3.  If we move on to the second set on months
 1 and 2, and the critical value is accepted, I want to print an accept or
 reject and move on to months 2 and 3, until finally comparing months 12-1
 at the end.
 Is there a way to loop or automate this in R?
 
 Thanks
 Meredith
 
 

Rui Barradas wrote
 
 Hello,
 
 I'm not at all sure if I understand your problem. Does this describe it?
 
 
 test first model for months 1 and 2
 if test statistic less than critical value{
   test second model for months 1 and 2
   print results of the first and second tests? just one of them?
 }
 move on to months 2 and 3
 etc, until months 12 and 1
 
 
 Please post example data using dput(dataset).
 Just copy it's output and paste it in your post.
 
 And example code, what you're already doing.
 (Possibly simplified)
 
 Rui Barradas
 
 
 meredith wrote
 
 R Users-
   I have been trying to automate a manual code that I have developed for
 calling in a .csv file, isolating certain rows and columns that
 correspond to specified months:
 something to the effect
 i=name.csv
 N=length(i$month)
 iphos1=0
 iphos2=0
 isphos3=0
 for i=1,N
  if month=1
 iphos1=iphos+1
 iphos1(iphos1)=i
 
 an so on to call out the months into there own arrays (unless there is a
 way I can wrap it into the next automation)
 
 Next: I would like to run a simple linear regression combining each of
 the months 1 by 1:
 for instance I want to run a regression on a combined model from months 1
 and 2 and a dummy model for 1 and 2, compare them using a Chi-sq
 distribution, if Chi-sq is less than the 

Re: [R] Value of Hurst exponent (R/S) method 1

2012-05-09 Thread Barun Saha
Hello All,

I'm coming across multiple data sets for which the R/S estimate of H
is greater than 1. Could someone please explain this to me?

On Mon, May 7, 2012 at 4:13 PM, Barun Saha barun.sah...@gmail.com wrote:

 Hello,

 I'm using fArma package to estimate the value of Hurst exponent using R/S
 method. However, for a certain set of data I get H ~ 1.8. How do I interpret
 this?

 Following are the output that I get for this set:

  mean(data[,2])
 [1] 400.5433
  sd(data[,2])
 [1] 1139.786
 
  rsFit(data[,2], levels = 64)

 Title:
  Hurst Exponent from R/S Method

 Call:
  rsFit(x = data[, 2], levels = 64)

 Method:
  R/S Method

 Hurst Exponent:
  H beta
   1.826240 1.826240

 Hurst Exponent Diagnostic:
    Estimate  Std.Err   t-value  Pr(|t|)
 X 1.826240 3.352896 0.5446755 0.5919988

 Parameter Settings:
    n   levels  minnpts cut.off1 cut.off2
    11895   64    3    5  316

 Description:
  Mon May  7 16:16:59 2012 by user:

 Warning messages:
 1: In rsFit(data[, 2], levels = 64) :
   Integer overflow in 'cumsum'; use 'cumsum(as.numeric(.))'
 2: In (1:m) * Y[m] : NAs produced by integer overflow
 3: In (1:m) * Y[m] : NAs produced by integer overflow
 4: In (1:m) * Y[m] : NAs produced by integer overflow
 5: In (1:m) * Y[m] : NAs produced by integer overflow
 6: In lsfit(log10(M), log10(RS), wt) : 37 missing values deleted
 


 --
 Thanks,
 Barun Saha
 JPA
 IIT, Kharagpur

 http://pothi.com/pothi/book/barun-saha-swapner-kheya
 http://delay-tolerant-networks.blogspot.com/p/one-tutorial.html




--
Thanks,
Barun Saha
JPA
IIT, Kharagpur

http://pothi.com/pothi/book/barun-saha-swapner-kheya
http://delay-tolerant-networks.blogspot.com/p/one-tutorial.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.


[R] Auto Reg with AR(1)

2012-05-09 Thread anil
I am trying to match the SAS Proc Autoreg with AR(1) (Nlag = 1 option)  with
R.

I am able to Regression in R and it's value matches with SAS. However i am
not able to find the Autoreg with AR(1) Estimates value which is matching
with SAS output.

Kindly help.

--
View this message in context: 
http://r.789695.n4.nabble.com/Auto-Reg-with-AR-1-tp4619733.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] file path

2012-05-09 Thread Tal Galili
Hi Wincent,
Have a look at:
?file.path



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 9, 2012 at 11:03 AM, Wincent ronggui.hu...@gmail.com wrote:

 Dear all, is there any function to assert whether a file path is
 legitimate, and to convert any potential file path to a legitimate
 file path?

 I automate a batch of files and write them to plain text files with
 cat(). The file argument of cat() is generated automatically which may
 contain characters such as ?  , unacceptable in Windows OS. What I
 do at this moment is to strip such characters off with gsub(). Is
 there any direct way to make legitimate file path without detailed
 knowledge about the naming rule specific to a OS?

 Best

 --
 Wincent Ronggui HUANG
 Sociology Department of Fudan University
 PhD of City University of Hong Kong
 http://homepage.fudan.edu.cn/rghuang/cv/

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


[[alternative HTML version deleted]]

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


[R] R exercises - too confusing for me.

2012-05-09 Thread UdVBIA
Hi!

I tried everything to avoid asking somebody but I have absolutely no clue
how to solve this tasks. I'll be really glad if someone could explain that
to me...

1. 

http://r.789695.n4.nabble.com/file/n4619850/task1.gif 

Well, the first part is of course no problem but I have really trouble with
the tasks i) and ii). just don't know how to write the function and why I
should use rexp...

2.
http://r.789695.n4.nabble.com/file/n4619850/task2.gif 

Oh I love loops. Well - I think I have to solve the first task to solve
this...

Well there is more but I'll tried to fight with it a few more hours. 

Thanks for helping!


--
View this message in context: 
http://r.789695.n4.nabble.com/R-exercises-too-confusing-for-me-tp4619850.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Survival data with time dependent covariate

2012-05-09 Thread BrittD
http://r.789695.n4.nabble.com/file/n4619765/survival_file.png 

Hi everyone,

This is what my data looks like, I haven't included the covariates, the
example would get too large.

 uid id  date   feverstart  
dumfever
130  75  3464652011-04-11   NA   0
131  75  3602872011-04-18   NA   0
132  75  3731952011-04-25   NA   0
133  75  3885402011-05-02   NA   0
134  76  43692010-11-02   2010-10-19 1
135  76  19789  2010-11-09   NA   0
136  76  33347  2010-11-16   NA   0
137  76  48872  2010-11-23   NA   0
138  76  62967  2010-11-30   NA   0
139  76  77395  2010-12-07   NA   0
140  76  92703  2010-12-14   NA   0
141  76 106219 2010-12-21   NA   0
142  76 119836 2010-12-28   NA   0
143  76 134060 2011-01-04   NA   0
144  76 151495 2011-01-13   2011-01-10 1
145  76 166549 2011-01-20   NA   0
146  76 182783 2011-01-27   NA   0
147  76 196972 2011-02-03   NA   0
148  76 213502 2011-02-10   NA   0
149  76 230432 2011-02-17   NA   0
150  76 245159 2011-02-24   NA   0

The uid variable is a number for a person.
The id variable is a number corresponding to a specific measurement on an
indivudual. 
The date is the date of the measurement.
Feverstart is the day the fever of a person started and dumfever is a
dummy-variable which tells use whether the person had a fever or not.

I need to build a dateset with a start and a stop variable for each day and
a variable that tells me whether the person got a fever that day, like this:

start stop   fever   
2011-04-11 2011-04-12   0 
2011-04-12 2011-04-13   0 

I already started to write a piece of code for this:

survival = as.numeric(NULL, NULL, 3)
for(i in 1:nrow(data2010)) {
start = data$date[i];   #first date
stop = data$date[i] + 86400;   #first date plus 1 day (day is in seconds)
sick = if(is.na(data[i, 7])) { 0 } else if (stop == data[i,7]){ 1 } else  0;
#if startfever is NA or date is not the same as

  
#mentioned sick = 0, if date matches startfever

  
#then sick = 1
if(stop == data$date[i+1]) {  # if the stop matches the next date in
the data, go to the next line. 
start = data$date[i+1] } else if {
start = stop }
}

My problem is, that if this loop is at the last measurement of a person, so
the last id of the uid, to get it to the first measurement of the next uid.
Maybe this whole way of programming is around the bush, than please tell me.

Greetings,

Britt

--
View this message in context: 
http://r.789695.n4.nabble.com/Survival-data-with-time-dependent-covariate-tp4619765.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] interpolation of climate data

2012-05-09 Thread Mintewab Bezabih
Dear R-users,  
 
I am working on interpolating the station level temperature data to farm level 
data. I have z vector consisting  of station level temperature observations and 
my x and y are latitude and longitude corresponding to a farm. My understanding 
is I can use raster combined with tps. While I am clear with the tps bit, I am 
not sure how I can construct the raster with teh data I have. Here is the 
reproducable example I made

Many thanks in advance
regards, 
Mintewab 

 

 library(fields)
x -1:20
y- runif(20)
z- c(11, 15, 17, 2, 18, 6, 7, NA, 12, 10,21, 25, 27, 12, 28, 16,
17, NA, 12, 10)
 
mydataset-data.frame(z, y, z)
mydataset[complete.cases(mydataset),]
tpsfit - Tps(cbind(x, y), z, scale.type=unscaled)
 
library(raster) 
r - raster(system.file(external/test.grd, package=raster))
p - raster(r)
p - interpolate(p, tpsfit)
p - mask(p, r)
plot(p)
se - interpolate(p, tpsfit, fun=predict.se)
se - mask(se, r)
plot(se)

__
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] rjags dmnorm error

2012-05-09 Thread hatty_m
I am having trouble initializing a bayesian model, with multivariate normal
likelihood.

*model{*

for (i in 1:N) {

mu1[i]-(pow(10,(pka1-ph[i]))*da1[2]+da1[1])/(1+pow(10,(pka1-ph[i])))+K[1]
}
for (i in 1:N) {

mu2[i]-(pow(10,(pka2-ph[i]))*da2[2]+da2[1])/(1+pow(10,(pka2-ph[i])))+K[2]
}

Y[1:N,1]-y1
Y[1:N,2]-y2

MU[1,1:N]-mu1
MU[2,1:N]-mu2
Y ~ dmnorm(MU,SIGMA)

SIGMA ~ dwish(R,2)

K[1] ~ dnorm(0,t2[1])
t2[1]-1/p[1]
p[1] ~ dgamma(2,0.5)
K[2] ~ dnorm(0,t2[2])
t2[2]-1/p[2]
p[2] ~ dgamma(2,0.5)
pka1 ~ dnorm(A,1)
da1[1] ~ dunif(0,10)
da1[2] ~ dunif(0,10)

pka2 ~ dnorm(A,1)
da2[1] ~ dunif(0,10)
da2[2] ~ dunif(0,10)

A ~ dunif(0,14)
*}*

y1 and y2 are vectors of length N, whilst the matrix R is the N-dim identity
matrix.

When attempting to initialize, I get the following error:

 / RUNTIME ERROR:
Non-conforming parameters in distribution dmnorm/


--
View this message in context: 
http://r.789695.n4.nabble.com/rjags-dmnorm-error-tp4620137.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Error in outer() : dimension mismatch

2012-05-09 Thread Pinar Ceyhan
Dear R users,

I am a new R user and have some difficulty
understanding the functioning of “outer”, where my question is from. I have
read the posts related to the questions on the outer function, but
unfortunately could not figure out where my mistake is.

I have a function with two variables and
three parameters (a density function that is not standard) and I want to draw
the contourplot along two parameters while keeping the third fixed. When I run
the program it gives an error which is due to the outer function. I have tested
the program with another simpler function and it works. So, I know that the
problem is in the function that I have written.  Below I copy the error and 
the part of the
program (the function) which causes the error:
 
Error: outer(par1, par2, y1, y2, FUN = function.subplot, KERNEL = KERNEL,:
dims [product 25921] [1] does not match the length of the object.
 
 
par1 - seq(-3,3,0.1)
par2- seq(-3,3,0.1)
x-cbind(par1,par2)       # par1:parameter1,
par2: parameter2, sigma is the third parameter that I fix
densityfunction - function(x, y1,y2, sigma=0.2){   # y1 and y2: the data
x - matrix(x, nrow = 1)
        function.value - 0  
        for (i in 1:T){       # T: the length of the data
        k - y1[i] - x[,2]*y2[i] - (1-x[,2])*x[,1]
        kk - t(k)%*%k
        density - -((T+2)/2)*log(sigma^2) - (kk/(2*(sigma^2)))
        function.value - function.value + density
        as.vector(function.value)
        return(function.value)
        }
}
 
Thank you very much in advance for your
suggestions.

Best regards,

P.
[[alternative HTML version deleted]]

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


Re: [R] Dotchart showing mean and median by group

2012-05-09 Thread Tal Galili
Hi Max,
I see that dotchart does not have a add parameter.
For the fun of it, I added this feature, you can see the source code of the
new function here:
https://raw.github.com/talgalili/R-code-snippets/master/dotchart.with.add.r
With your example at the end of the file.

Here is a page showing the changes I've made to the original function, so
to enable this feature:
https://github.com/talgalili/R-code-snippets/commit/26b4104085808e6bcad49573ca2e060332467f39
This may not be the prettiest way, if someone on the list has ideas for
improvement, please let me know.

Cheers,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 9, 2012 at 10:25 AM, maxbre mbres...@arpa.veneto.it wrote:

 Given this example

 mean.values-colMeans(VADeaths)

 mean.values-apply(VADeaths, 2, mean)
 median.values-apply(VADeaths, 2, median)

 dotchart(VADeaths, gdata=mean.values)
 dotchart(VADeaths, gdata=median.values)

 is it possible to “combine” a single dotchart showing both the mean and the
 median for each single group (with different plotting symbols)?

 …is it that possible with the use of the standard graphics or it is
 necessary (better) to use of a different package?

 Any example for this in my favourite (even almost always too much complex
 for myself) package lattice?

 thank you

 --
 View this message in context:
 http://r.789695.n4.nabble.com/Dotchart-showing-mean-and-median-by-group-tp4619597.html
 Sent from the R help mailing list archive at Nabble.com.

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


[[alternative HTML version deleted]]

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


Re: [R] How to deal with a dataframe within a dataframe?

2012-05-09 Thread David Winsemius


On May 9, 2012, at 2:40 AM, Robert Latest wrote:


On Tue, May 8, 2012 at 3:38 PM, R. Michael Weylandt
michael.weyla...@gmail.com wrote:
So this actually looks like something of a tricky one: if you  
wouldn't

mind sending the result of dput(head(agg)) I can confirm, but here's
my hunch:


Hi Michael,

while I'm trying to get my head around the rest of your post, here's
the output of dput():


dput(head(agg))

structure(list(`df$quarter` = c(09Q3, 10Q1, 10Q2, 10Q3,
11Q1, 11Q2), `df$tool` = structure(c(1L, 1L, 1L, 1L, 1L,
1L), .Label = c(VS1A, VS1B, VS2A, VS2B, VS3A, VS3B,
VS4A, VS4B, VS5B), class = factor), `df$value` =  
structure(list(
   `0` = c(1.80053430839867, 1.62848325226279), `1` =  
c(1.29965212329278,

   1.26130173276939), `2` = c(1.69901753654472, 1.38156952313768
   ), `3` = c(1.31168126092175, 1.06723157138633), `4` =  
c(1.54165763354293,

   1.21619657757276), `5` = c(1.29925171313276, 1.18276707678292
   )), .Names = c(0, 1, 2, 3, 4, 5))), .Names = c(df 
$quarter,

df$tool, df$value), row.names = c(NA, 6L), class = data.frame)




I would like this in either the form of a flat data frame (i.e., the
contents of df$value as two separate columns), or -- even preferable
-- learn a better way to retrieve multiple numeric results from a call
to aggregate().


The reason you are having difficulty is a) that you have somehow  
(noting that you have omitted all context)  managed to construct  
column names with dollar-signs in them which the interpreter attempts  
to parse as a function and then b) the 'df$value' column is also a  
list rather than an atomic vector. It's a rather pathological  
construct in my opinion, but maybe one of the masteRs with think  
differently. This will pull the first element of that column's third  
entry:


 agg[3,3][[1]][1]
[1] 1.699018

This will return all of the first entries:

sapply(1:6, function(x) agg[x, 3][[1]][1])
[1] 1.800534 1.299652 1.699018 1.311681 1.541658 1.299252

You might start by renaming that objects columns with valid R names.

--
David.



Thanks,
robert

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


David Winsemius, MD
West Hartford, CT

__
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] interpolating climate data

2012-05-09 Thread Mintewab Bezabih

Dear R-users,  
 
I am working on interpolating the station level temperature data to farm level 
data. I have z vector consisting  of station level temperature observations and 
my x and y are latitude and longitude corresponding to a farm. My understanding 
is I can use raster combined with tps. While I am clear with the tps bit, I am 
not sure how I can construct the raster with teh data I have. Here is the 
reproducable example I made

Many thanks in advance
regards, 
Mintewab 

 

 library(fields)
x -1:20
y- runif(20)
z- c(11, 15, 17, 2, 18, 6, 7, NA, 12, 10,21, 25, 27, 12, 28, 16,
17, NA, 12, 10)
 
mydataset-data.frame(z, y, z)
mydataset[complete.cases(mydataset),]
tpsfit - Tps(cbind(x, y), z, scale.type=unscaled)
 
library(raster) 
r - raster(system.file(external/test.grd, package=raster))
p - raster(r)
p - interpolate(p, tpsfit)
p - mask(p, r)
plot(p)
se - interpolate(p, tpsfit, fun=predict.se)
se - mask(se, r)
plot(se)

__
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] Dotchart showing mean and median by group

2012-05-09 Thread Gabor Grothendieck
On Wed, May 9, 2012 at 3:25 AM, maxbre mbres...@arpa.veneto.it wrote:
 Given this example

 mean.values-colMeans(VADeaths)

 mean.values-apply(VADeaths, 2, mean)
 median.values-apply(VADeaths, 2, median)

 dotchart(VADeaths, gdata=mean.values)
 dotchart(VADeaths, gdata=median.values)

 is it possible to “combine” a single dotchart showing both the mean and the
 median for each single group (with different plotting symbols)?


Try this:

dotchart(VADeaths, gdata=mean.values)
par(new = TRUE)
dotchart(VADeaths, gdata=median.values, gpch = 20)

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

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


Re: [R] R exercises - too confusing for me.

2012-05-09 Thread Kenn Konstabel
Hi,

But what if your professor reads this list?

Anyway, who cares, two hints:

1. It might be useful to read the explanations provided with the
problem. For example, your exercise tells you that use the help
command ?rexp to read how to generate exponentially distributed
variables. On a careful reading, that may explain why they want you
to use rexp. Perhaps they want you to generate an exponentially
distributed variable?

2. If you're given an exercise on a topic that is not covered %in%
c(lectures, required.readings) and you can't figure it out by
yourself, maybe it would be useful to do some background reading
before you go on. You can find free books on R at
http://cran.r-project.org/other-docs.html . Or you could try
complaining the gray beard about asking you to do things he hasn't
taught you ... and then see what happens next.

Best regards,

K

On 5/9/12, UdVBIA arturrutkiew...@gmail.com wrote:
 Hi!

 I tried everything to avoid asking somebody but I have absolutely no clue
 how to solve this tasks. I'll be really glad if someone could explain that
 to me...

 1.

 http://r.789695.n4.nabble.com/file/n4619850/task1.gif

 Well, the first part is of course no problem but I have really trouble with
 the tasks i) and ii). just don't know how to write the function and why I
 should use rexp...

 2.
 http://r.789695.n4.nabble.com/file/n4619850/task2.gif

 Oh I love loops. Well - I think I have to solve the first task to solve
 this...

 Well there is more but I'll tried to fight with it a few more hours.

 Thanks for helping!


 --
 View this message in context:
 http://r.789695.n4.nabble.com/R-exercises-too-confusing-for-me-tp4619850.html
 Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] What is the most cost effective hardware for R?

2012-05-09 Thread John Laing
For 200,000 analyses at 1.5 seconds each, you're looking at ~83 hours
of computing time. You can buy time from Amazon at roughly $0.08 /
core / hour, so it would cost about $7 to run your analyses in the
cloud. Assuming complete parallelization you could fire up as many
machines as you need to get the work done in as little time as you
want, with the same fixed cost. I think that's a pretty compelling
argument, compared to the hassles of buying and maintaining hardware,
power supply, air conditioning, etc.

John

On Tue, May 8, 2012 at 1:12 PM, Hugh Morgan h.mor...@har.mrc.ac.uk wrote:
 On 05/08/2012 06:02 PM, Rich Shepard wrote:

 On Tue, 8 May 2012, Hugh Morgan wrote:

 Perhaps I have confused the issue. When I initially said data points I
 meant one stand alone analysis, not one piece of data. Each analysis
 point
 takes 1.5 seconds. I have not implemented running this over the whole
 dataset yet, but I would expect it to take about 5 to 10 hours. This is
 just about acceptable, but it would be better if this was quicker. As I
 say, the exact analysis method has not yet been determined, and if that
 was significantly more computationally intensive then that could be an
 issue.


  If I had to do what you write above, I would separate the data into
 chunks; one for each core/CPU in my system. Then I would invoke R to run
 on
 each core/CPU and have that instance process one data set. With sufficient
 memory for each core/CPU the processing will occur in parallel and cut the
 overall time by the number of instances running.

  You might want to turn up the air conditioning around the system 'cause
 that CPU is going to be working hard.


 That is roughly how I am working on getting it running currently, and the 5
 hour estimate assumes that is perfectly parallelisable.

 We have a server room with a reasonable air con.  I have only just thought
 about adding the extra cooling to the total cost, but I suspect that that
 will come from a different budget so may not matter so much.  I shall
 include it in the quote until told to do otherwise.



 Rich

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



 This email may have a PROTECTIVE MARKING, for an explanation please see:
 http://www.mrc.ac.uk/About/Informationandstandards/Documentmarking/index.htm

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

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


Re: [R] two Y Axes (in the same scale) in ggplot2

2012-05-09 Thread David Winsemius


On May 9, 2012, at 3:28 AM, Jim Lemon wrote:


On 05/09/2012 05:29 AM, wudadan wrote:

Dear R users,

I'm plotting housing prices in City A over past 30 years in  
ggplot2. The Xs
are years since 1980. I have two housing price variables: new home  
prices

and old home prices, both of them measured by $/sqft. I have searched
related threads on multiple Y axes in ggplot2 and I understand that  
multiple
Y axes in different scales are not possible. I'm wondering if it is  
possible
to have multiple Y axes with the same scale in ggplot2, like in my  
case. If

still not possible, is there a easy way to do it in R's default plot
function? Thanks.


Hi Gary,
Perhaps twoord.plot (plotrix) will do what you want.


There is also a two ordinate function in package latticeExtra for  
lattice plots.


(It does not really make sense to be requesting two ordinates that are  
on the same scale, or rather it would be somewhat redundant, wouldn't  
it? Are you really trying to get the results that lattice plots  
provide with the group parameter and base plotting provides with  
lines() and points() or matplot()?)




--

David Winsemius, MD
West Hartford, CT

__
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] What is the most cost effective hardware for R?

2012-05-09 Thread Barry Rowlingson
On Wed, May 9, 2012 at 2:22 PM, John Laing john.la...@gmail.com wrote:
 For 200,000 analyses at 1.5 seconds each, you're looking at ~83 hours
 of computing time. You can buy time from Amazon at roughly $0.08 /
 core / hour, so it would cost about $7 to run your analyses in the
 cloud. Assuming complete parallelization you could fire up as many
 machines as you need to get the work done in as little time as you
 want, with the same fixed cost. I think that's a pretty compelling
 argument, compared to the hassles of buying and maintaining hardware,
 power supply, air conditioning, etc.

 Noticing Hugh's .ac.uk email address you do have to factor in the
hassle of getting something as nebulous as cloud computing past the
red tape. How much will it cost? says the bureaucrat. Depends how
much CPU time I need, says the academic. So potentially, what's the
most? says the bureaucrat. Millions,, says the academic, honestly,
adding but that would only be if my job scheduling went a bit mad and
grabbed a few thousand Amazon cores and thrashed them for weeks
without me noticing. Okay, says the bureaucrat, now, can we send
Amazon a purchase order so that Amazon send us an invoice for this
unknown and potentially unpredictable cost first?. Oh no, says the
academic, we need a credit card

Maybe there are other ways of paying for Amazon cloud CPUs, I've not
investigated. Anyone in academia happily crunching on EC2?

Barry

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


Re: [R] what folder to run write_PACKAGES in?

2012-05-09 Thread Uwe Ligges



On 09.05.2012 01:14, Jeff Newmiller wrote:

I have not done this myself, but reading through your book I see no reference 
to actual sample file names. I mention this because UNIX-ish operating systems 
download the tar.gz source archives while Windows works with the zip binary 
packages, and I can't tell what files you are putting in the repository.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.us Basics: ##.#.   ##.#.  Live Go...
   Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
---
Sent from my phone. Please excuse my brevity.

Paul Johnsonpauljoh...@gmail.com  wrote:


I set up a local repo for testing packages. My packages are not
showing up from the repository when viewed by Linux clients. I suspect
this is a web administrator/firewall issue, but it could be I created
the repo wrongly.  I am supposed to run write_PACKAGES separately in
each R-version folder. Right?

Maybe other novices can use these scripts, if they are not wrong :)

Here's the file structure. On the file space that the Web server can
see, I create a folder /tools/kran and directories

bin
macosx
 leopard
  contrib
2.13
2.14
2.15

windows
 contrib
   2.13
   2.14
   2.15
src
contrib
   2.13
   2.14
   2.15




For source packages, you do not need the versioned subfolders and you 
have to have a PACKAGES (or a compressed alternative) in /src/contrib.


Uwe ligges



That's created by this:
#
create_repo_tree- function(local.repos, rversions){

folders-  c(/bin/windows/contrib,
/bin/macosx/leopard/contrib, /src/contrib)
for(dir in folders){
dirs- paste(local.repos, dir, /, rversions, sep='')
lapply(dirs, dir.create, recursive = TRUE, showWarnings = TRUE)
}
}

create_repo_tree(/tools/kran, c(2.13, 2.14, 2.15))
###

My CRAN mirror is in a sister folder /tools/cran and that works
properly to be served at the address http://rweb.quant.ku.edu/cran.

I want our local testing thing to show at similar
http://rweb.quant.ku.edu/kran.  Supposing the Apache web server magic
is done, I *believe* the following should work.

I dropped packages in the right version folders, and I wrote a script
that goes separately to each version number folder and runs
write_PACKAGES.

### Researchers can upload
### packages into the approrpriate folder.
### Administratively, we schedule this run run every night
write_PACKAGES_wrapper- function(local.repos) {
require(tools)

rversions-  dir(path = paste(local.repos,
/bin/windows/contrib, sep=), full.names = TRUE)
for (i in rversions) write_PACKAGES(dir = i, subdirs=TRUE,
type=win.binary)

#repeat
rversions-  dir(path = paste(local.repos,
/bin/macosx/leopard/contrib, sep=), full.names = TRUE)
for (i in rversions) write_PACKAGES(dir = i, subdirs=TRUE,
type=mac.binary)

rversions-  dir(path = paste(local.repos, /src/contrib,
sep=), full.names = TRUE)
for (i in rversions) write_PACKAGES(dir = i, subdirs=TRUE,
type=source)
}


write_PACKAGES_wrapper(/tools/kran)

#

Right?

After running that, I do see the PACKAGES files appear under the
version number directories.

However, from the linux clients I see this:


install.packages(rockchalk, repos=http://rweb.quant.ku.edu/kran;)

Installing package(s) into
‘/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.15’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository
http://rweb.quant.ku.edu/kran/src/contrib
Warning message:
package ‘rockchalk’ is not available (for R version 2.15.0)

The Web administrator here suggests I've done the write_PACKAGES
incorrectly because there is no PACKAGES file in
/tools/kran/src/contrib.  But I do have PACKAGES files in the
subfolders 2.15.


However, on a windows system, it does work.


install.packages(rockchalk, repos=http://rweb.quant.ku.edu/kran;)

trying URL
'http://rweb.quant.ku.edu/kran/bin/windows/contrib/2.15/rockchalk_1.5.5.06.zip'
Content type 'application/zip' length 486682 bytes (475 Kb)
opened URL
downloaded 475 Kb

package ‘rockchalk’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
  C:\Users\pauljohn32\AppData\Local\Temp\Rtmpq0m3Id\downloaded_packages

The Web admin folks say to me, if we did it wrong, nothing would
work. Some does, so it is your fault.

--
Paul E. Johnson
Professor, Political ScienceAssoc. Director
1541 Lilac Lane, Room 504 Center for Research Methods

[R] as.function parameters

2012-05-09 Thread jackl
Hi,

i have a question regarding the as.function functionality.
I need to save multiple functions with adjusted parameters in a list.
The adjusted parameters are changed via variables in a loop.
The problem I'm facing right now is that the functions saved in
the list don't have the values of the parameters but the variable parameter
itself. Is there a way to force a call-by-value instead of a
call-by-address?

Example(not the real function):
tmp - 4
f - as.function(alist(y=,x=tmp,y+x)
f(1)  5
tmp - 2
f(1)  3

thanks ahead and sorry if this question has already been asked before.
I could not really grasp the problem to one Subject.

--
View this message in context: 
http://r.789695.n4.nabble.com/as-function-parameters-tp4620390.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] plot betadisper, change of pch

2012-05-09 Thread Uwe Ligges

Runnig the examples from ?betadisper and adding a pch statement gives:

  plot(mod, pch=2)
Error in plot.xy(xy.coords(x, y), type = type, ...) :
  formal argument pch matched by multiple actual arguments

 traceback()
5: plot.xy(xy.coords(x, y), type = type, ...)
4: points.default(g$centroids, pch = 16, cex = 1, col = red, ...)
3: points(g$centroids, pch = 16, cex = 1, col = red, ...)
2: plot.betadisper(mod, pch = 2)
1: plot(mod, pch = 2)

This shows that the author hardcoded the pch in the code, hence you can 
only change it by changing the code - or send a feature request to the 
vegan maintainer (ideally including a patch, CCing).


Best,
Uwe Ligges



On 09.05.2012 12:20, Albin Blaschka wrote:


Hello!

After performing an analysis with betadisper, package vegan I would like
to plot the results - so far, so good. But I would also like to tune a
little bit the plotting characters, as '+' and 'x' are a little to
similar...

My (boiled down) code:

[See session info at the bottom of the mail, vegan is vegan_2.0-3]

mod - betadisper(mydata, mygroups, type='median')
syms - c(rep(1:4, each = 16))
modplot - plot(mod, axes = c(1,2), main='', pch=syms)

I get the error message (roughly translated from german):
formal argument 'pch' fits to more given arguments
[formales Argument pch passt zu mehreren gegebenen Argumenten]

What do I have to change?

Thank you in advance!
Albin

  sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

other attached packages:
[1] rgl_0.92.798 reshape_0.8.4 plyr_1.7.1 MASS_7.3-16 vegan_2.0-3
permute_0.7-0 RPostgreSQL_0.3-2
[8] DBI_0.2-5

loaded via a namespace (and not attached):
[1] grid_2.15.0 lattice_0.20-6 tools_2.15.0




__
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 deal with a dataframe within a dataframe?

2012-05-09 Thread Gabor Grothendieck
On Tue, May 8, 2012 at 9:19 AM, Robert Latest boblat...@gmail.com wrote:
 Hello all,

 I am doing an aggregation where the aggregating function returns not a
 single numeric value but a vector of two elements using return(c(val1,
 val2)). I don't know how to access the individual columns of that
 vector in the resulting dataframe though. How is this done correctly?
 Thanks, robert


 agg - aggregate(formula=df$value ~ df$quarter + df$tool,
 +     FUN=cp.cpk, lsl=1300, usl=1500)

Try this:

agg - aggregate(value ~ quarter + tool, df,
 FUN=cp.cpk, lsl=1300, usl=1500)

do.call(data.frame, agg)

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

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


[R] How to apply functions across columns?

2012-05-09 Thread Robert Latest
Hello,

me again.

I have a data frame that looks like this (actual dput output at bottom):

 head(tencor)
datelot wf.id   s1   s2   s3   s4   s5
1 08.05.2012 W0X3H0 9 1238 1263 1244 1200 1183
2 08.05.2012 W0X3H010 1367 1396 1371 1325 1311
3 08.05.2012 W0X3H011 1383 1417 1393 1346 1328

I'd like to add a column to this that gives, for each row, the
averages of the values in the columns s1 to s5. Really primitive. But
I totally absolute don't understand how to do this. I don't need any
intelligence, I know my values are always in columns 4:8.

Thanks,
robert

 dput(tencor)
structure(list(date = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L), .Label = 08.05.2012, class = factor), lot =
structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = W0X3H0, class = factor),
wf.id = c(9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L,
4L), s1 = c(1238L, 1367L, 1383L, 1395L, 1479L, 1411L, 1404L,
1398L, 1402L, 1380L, 1376L), s2 = c(1263L, 1396L, 1417L,
1420L, 1527L, 1452L, 1438L, 1432L, 1432L, 1412L, 1403L),
s3 = c(1244L, 1371L, 1393L, 1395L, 1497L, 1424L, 1410L, 1404L,
1398L, 1382L, 1385L), s4 = c(1200L, 1325L, 1346L, 1346L,
1444L, 1372L, 1361L, 1362L, 1359L, 1338L, 1334L), s5 = c(1183L,
1311L, 1328L, 1336L, 1426L, 1357L, 1347L, 1344L, 1339L, 1325L,
1322L)), .Names = c(date, lot, wf.id, s1, s2, s3,
s4, s5), class = data.frame, row.names = c(NA, -11L))


__
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] plot betadisper, change of pch

2012-05-09 Thread David Winsemius


On May 9, 2012, at 6:20 AM, Albin Blaschka wrote:



Hello!

After performing an analysis with betadisper, package vegan I would  
like to plot the results - so far, so good. But I would also like to  
tune a little bit the plotting characters, as '+' and 'x' are a  
little to similar...


My (boiled down) code:

[See session info at the bottom of the mail, vegan is vegan_2.0-3]

mod - betadisper(mydata, mygroups, type='median')
syms - c(rep(1:4, each = 16))
modplot - plot(mod, axes = c(1,2), main='', pch=syms)

I get the error message (roughly translated from german):
formal argument 'pch' fits to more given arguments
[formales Argument pch passt zu mehreren gegebenen Argumenten]

What do I have to change?


In such an instance you generally need to get the code of a possibly  
hidden function named plot.class-returned-by-betadisp where you  
get the class by running:


class(mod)  # then type
plot.that-result  # and if that fails
getAnywhere(plot.that-result)

Then go in and either add a 'pch' argument or change the hardcoded  
values in the function body.


As it turns out you can see the function without even loading vegan  
just by doing this:


vegan:::plot.betadisper

'pch' appears a couple of times and it is colliding with your values  
in the points() calls. The function should probably be written so that  
it can accept a 'pch' argument.


--
David.




Thank you in advance!
Albin

 sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=de_AT.UTF-8   LC_NUMERIC=C  
LC_TIME=de_AT.UTF-8LC_COLLATE=de_AT.UTF-8
[5] LC_MONETARY=de_AT.UTF-8LC_MESSAGES=de_AT.UTF-8 
LC_PAPER=CLC_NAME=C
[9] LC_ADDRESS=C   LC_TELEPHONE=C  
LC_MEASUREMENT=de_AT.UTF-8 LC_IDENTIFICATION=C


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

other attached packages:
[1] rgl_0.92.798  reshape_0.8.4 plyr_1.7.1 
MASS_7.3-16 vegan_2.0-3   permute_0.7-0 RPostgreSQL_0.3-2

[8] DBI_0.2-5

loaded via a namespace (and not attached):
[1] grid_2.15.0lattice_0.20-6 tools_2.15.0


--
| Albin Blaschka, Mag.rer.nat.
| Etrichstrasse 26, A-5020 Salzburg
| * www.albinblaschka.info * www.thinkanimal.info *
| - It's hard to live in the mountains, hard but not hopeless!

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


David Winsemius, MD
West Hartford, CT

__
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 apply functions across columns?

2012-05-09 Thread R. Michael Weylandt
Good reproducible example ;-)

Easiest is probably just:

cbind(tencor, ThisRowMean =  rowMeans(tencor[, 4:8]))

# Whatever you replace ThisRowMean with will become the column name

Best,
Michael

On Wed, May 9, 2012 at 10:12 AM, Robert Latest boblat...@gmail.com wrote:
 Hello,

 me again.

 I have a data frame that looks like this (actual dput output at bottom):

 head(tencor)
        date    lot wf.id   s1   s2   s3   s4   s5
 1 08.05.2012 W0X3H0     9 1238 1263 1244 1200 1183
 2 08.05.2012 W0X3H0    10 1367 1396 1371 1325 1311
 3 08.05.2012 W0X3H0    11 1383 1417 1393 1346 1328

 I'd like to add a column to this that gives, for each row, the
 averages of the values in the columns s1 to s5. Really primitive. But
 I totally absolute don't understand how to do this. I don't need any
 intelligence, I know my values are always in columns 4:8.

 Thanks,
 robert

 dput(tencor)
 structure(list(date = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
 1L, 1L, 1L, 1L), .Label = 08.05.2012, class = factor), lot =
 structure(c(1L,
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = W0X3H0, class = factor),
    wf.id = c(9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L,
    4L), s1 = c(1238L, 1367L, 1383L, 1395L, 1479L, 1411L, 1404L,
    1398L, 1402L, 1380L, 1376L), s2 = c(1263L, 1396L, 1417L,
    1420L, 1527L, 1452L, 1438L, 1432L, 1432L, 1412L, 1403L),
    s3 = c(1244L, 1371L, 1393L, 1395L, 1497L, 1424L, 1410L, 1404L,
    1398L, 1382L, 1385L), s4 = c(1200L, 1325L, 1346L, 1346L,
    1444L, 1372L, 1361L, 1362L, 1359L, 1338L, 1334L), s5 = c(1183L,
    1311L, 1328L, 1336L, 1426L, 1357L, 1347L, 1344L, 1339L, 1325L,
    1322L)), .Names = c(date, lot, wf.id, s1, s2, s3,
 s4, s5), class = data.frame, row.names = c(NA, -11L))


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

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


Re: [R] Two Y axes (same scale) in ggplot2 or plot

2012-05-09 Thread Duncan Murdoch

On 08/05/2012 3:23 PM, Gary Dong wrote:

Dear R users,

I'm plotting housing prices in City A over past 30 years in ggplot2. The Xs
are years since 1980. I have two housing price variables: new home prices
and old home prices, both of them measured by $/sqft. I have searched
related threads on multiple Y axes in ggplot2 and I understand that
multiple Y axes in different scales are not possible. I'm wondering if it
is possible to have multiple Y axes with the same scale in ggplot2, like in
my case. If still not possible, is there a easy way to do it in R's default
plot function? Thanks.


In base graphics, you can have as many axes as you like, displaying 
anything.  Use the axis() function.  See ?axis for the arguments that 
determine placement, ticks, etc.


I would guess the same flexibility is there in ggplot2, but I don't know 
how to do it.


Duncan Murdoch

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


Re: [R] file path

2012-05-09 Thread Duncan Murdoch

On 09/05/2012 4:03 AM, Wincent wrote:

Dear all, is there any function to assert whether a file path is
legitimate, and to convert any potential file path to a legitimate
file path?

I automate a batch of files and write them to plain text files with
cat(). The file argument of cat() is generated automatically which may
contain characters such as ?  , unacceptable in Windows OS. What I
do at this moment is to strip such characters off with gsub(). Is
there any direct way to make legitimate file path without detailed
knowledge about the naming rule specific to a OS?


I would just try to create the file, and if you fail, it's not 
legitimate.  Alternatively, you could look at the tests that R uses when 
it checks a package:  we try to keep filenames portable to all operating 
systems.  The rules seem to be strictest for vignettes:


## we specify ASCII filenames starting with a letter in R-exts
## do this in a locale-independent way.
OK - 
grep(^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz][ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-]+$, 
vignettes)


Duncan Murdoch

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


Re: [R] Two Y axes (same scale) in ggplot2 or plot

2012-05-09 Thread Duncan Murdoch

On 09/05/2012 10:46 AM, Gary Dong wrote:

Thanks, Duncan.

I tried axis(). It appears it allows you to add an axis, but does not 
say you can plot a second Y in the graph. Maybe I'm understanding it 
correctly. Any help will be appreciated!


I don't understand what you want.  Could you give an example that comes 
close, and explain what is wrong with it?


Duncan Murdoch



Gary


On Wed, May 9, 2012 at 7:26 AM, Duncan Murdoch 
murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com wrote:


On 08/05/2012 3:23 PM, Gary Dong wrote:

Dear R users,

I'm plotting housing prices in City A over past 30 years in
ggplot2. The Xs
are years since 1980. I have two housing price variables: new
home prices
and old home prices, both of them measured by $/sqft. I have
searched
related threads on multiple Y axes in ggplot2 and I understand
that
multiple Y axes in different scales are not possible. I'm
wondering if it
is possible to have multiple Y axes with the same scale in
ggplot2, like in
my case. If still not possible, is there a easy way to do it
in R's default
plot function? Thanks.


In base graphics, you can have as many axes as you like,
displaying anything.  Use the axis() function.  See ?axis for the
arguments that determine placement, ticks, etc.

I would guess the same flexibility is there in ggplot2, but I
don't know how to do it.

Duncan Murdoch




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


[R] Random resampling of columns in species association matrices

2012-05-09 Thread mariasve
I have a host-parasite association matrix in which parasite species are rows
and host species columns and cells contain the frequency of interactions.
Some parasites are associated with many hosts, and some hosts harbor several
parasites, and I want to repeatedly select only one single representative
host per generalized (multi-host) parasite to create a new matrix in which
no hosts are repeated. That is, I want multiple randomly generated symmetric
matrices in which a host and a parasite species appear only once.
Furthermore, I want to weight the probability of selecting a particular host
for a parasite by the frequency of interactions between the two. Finally, a
handful of parasites associate with only one single host. I do not want to
lose these from the matrix, but rather fix these associations and only
randomly select hosts for the generalized parasite species.

My goal is to eventually perform generalized least squares regressions
between a parasite trait and several host traits, but the first major hurdle
for me to get over is how to randomly select only one host per parasite with
no repetition of species in the matrix. I am also generally interested in
how to resample columns instead of rows (in the package boot, for instance)
because of another analysis I'm working on, and I have been unable to find a
solution to this when searching the R help site.

Any suggestions would be most welcomed.

Maria



--
View this message in context: 
http://r.789695.n4.nabble.com/Random-resampling-of-columns-in-species-association-matrices-tp4620618.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Two Y axes (same scale) in ggplot2 or plot

2012-05-09 Thread Gary Dong
Thanks, Duncan.

I tried axis(). It appears it allows you to add an axis, but does not say
you can plot a second Y in the graph. Maybe I'm understanding it correctly.
Any help will be appreciated!

Gary


On Wed, May 9, 2012 at 7:26 AM, Duncan Murdoch murdoch.dun...@gmail.comwrote:

 On 08/05/2012 3:23 PM, Gary Dong wrote:

 Dear R users,

 I'm plotting housing prices in City A over past 30 years in ggplot2. The
 Xs
 are years since 1980. I have two housing price variables: new home prices
 and old home prices, both of them measured by $/sqft. I have searched
 related threads on multiple Y axes in ggplot2 and I understand that
 multiple Y axes in different scales are not possible. I'm wondering if it
 is possible to have multiple Y axes with the same scale in ggplot2, like
 in
 my case. If still not possible, is there a easy way to do it in R's
 default
 plot function? Thanks.


 In base graphics, you can have as many axes as you like, displaying
 anything.  Use the axis() function.  See ?axis for the arguments that
 determine placement, ticks, etc.

 I would guess the same flexibility is there in ggplot2, but I don't know
 how to do it.

 Duncan Murdoch


[[alternative HTML version deleted]]

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


Re: [R] registry vulnerabilities in R

2012-05-09 Thread Duncan Murdoch

On 08/05/2012 11:10 AM, Paul Martin wrote:

Kirtland Air Force Base has denied approval for the use of R on its
Windows network. Some of their objections seem a bit strange, but some
appear  to  be  legitimate. In particular, they have detected registry
vulnerabilities
which are detailed in the attachment.


I suspect their test is wrong, but I can't say for sure, because they 
apparently tested R within RStudio.  I know R didn't have anything to do 
with most of those registry entries that were listed, and I strongly 
suspect RStudio didn't either.


I'd suggest that if you want to use R, just ask them to test R.  It's 
nice to have the RStudio front end, but you don't need it.


Once R is accepted, you could ask for an RStudio test if you want.

On the other hand, R is not safe to install, in the sense that it does 
give programs access to anything the user has access to.   I am pretty 
sure that's also true of at least Matlab and Mathematica in the list of 
alternatives you were given.


Duncan Murdoch


I know nothing about Windows registry vulnerabilities. If any of these
issues are
legitimate concerns, I would like to see them fixed for everyone's benefit.
I would
appreciate a referral to the appropriate forum for this information. I am
willing
to  assist  in  getting  questions  answered  and gathering additional
information.
Thank you,
Paul Martin
Air Force Research Laboratory
Kirtland Air Force Base
Albuquerque, New Mexico
 Original Message 

Subject: FW: R/RStudio Software
Date: Fri, 4 May 2012 15:15:20 -0600
From: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
[1]paul.mar...@kirtland.af.mil
To: [2]pamar...@alum.mit.edu

-Original Message-
From: Goel, Suman K Civ USAF AFMC AFRL/RVIO
Sent: Friday, May 04, 2012 3:13 PM
To: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
Subject: RE: R/RStudio Software

Mr. Martin,

Rstudio is an IDE for writing R code. I installed Rstudio first but it
doesn't work without R so I tested them together.

When I test a software usually the registry analysis file is blank. But this
one happen to have numerous registry vulnerabilities - see attached. Most of
them I even don't know if affects the software.
Collaboration P2P Host In TCP/Out TCP allowed seemed troubling.

Thanks,
Suman

-Original Message-
From: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
Sent: Friday, May 04, 2012 2:51 PM
To: Goel, Suman K Civ USAF AFMC AFRL/RVIO
Subject: RE: R/RStudio Software

Ms. Goel,

Sorry to bother you again with this, but I have two more questions:

1. Were these vulnerabilities found in both R and RStudio?

2. Could you be more explicit about the registry vulnerabilities? This is
the only item
where I could potentially get some issues addressed. Even if I cannot get
this software
on the NIPRNET, I can pass along your discoveries and help the community
improve their
code.

Thank you,

Paul Martin

-Original Message-
From: Goel, Suman K Civ USAF AFMC AFRL/RVIO
Sent: Friday, May 04, 2012 2:34 PM
To: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
Cc: Goel, Suman K Civ USAF AFMC AFRL/RVIO
Subject: RE: R/RStudio Software

Mr. Martin,

Thank you for understanding. Here are some examples of vulnerabilities.

Numerous forbidden file extensions.
Numerous registry vulnerabilities
Network connections to foreign IP address

Many vulnerabilities are firewall policies related under restricted
services.

Once again Thank you,

Respectfully,
Suman


-Original Message-
From: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
Sent: Friday, May 04, 2012 2:12 PM
To: Goel, Suman K Civ USAF AFMC AFRL/RVIO
Subject: RE: R/RStudio Software

Suman,



Thank you for your reply. If it is not too much trouble, could you enumerate
the issues you found, so that I can forward the list to the team maintaining
the R software? I have no idea what kind of response to expect, but these
people should at least be aware of the issues.



Thank you.



Paul Martin



From: Goel, Suman K Civ USAF AFMC AFRL/RVIO
Sent: Friday, May 04, 2012 2:07 PM
To: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
Cc: Motes, Raymond A Civ USAF AFMC AFRL/RVSE; Serafico, Romeo G Civ USAF
AFMC AFRL/RVIO; Mickey, Dallas C Civ USAF AFMC AFRL/RVIO; Trujillo, Lloyd P
Civ USAF AFMC AFRL/RVIO
Subject: R/RStudio Software



Mr. Martin,



After completing the vulnerability analysis, we decided to decline to
approve R/RStudio software on the NIPRNet. We discovered many unmitigated
risks and numerous registry vulnerabilities.  Above mentioned open source
software poses high risks to the NIPRNet. We recommend using software from
the Kirtland Base approved list. Here are some examples of the base approved
statistical software:



SPSS v19.x

LISREL v8.x

JMP v8.x - Soon to be certify JMP v9 or 10

Matlab v7.x

Mathematica v8.x

OriginPro v8.x



If you like, we can add following statistical software on the base list,
which will be available on May 25th.




Re: [R] barplot: legend: two rows

2012-05-09 Thread Uwe Ligges



On 09.05.2012 13:23, Marion Wenty wrote:

dear r-helpers,

i have got another question:

i am using the functions

par(xpd=T)
legend

to create a legend below the x-axis. i used the parameter horiz=T.

now i would like to put the elements of the legend in two rows:

e.g. if my legend has got 5 elements, i would like 3 elements in one row
and the last two elements in the next row.

does anyone know how to do that?


Example:

bp - barplot(1)
par(xpd = TRUE)
legend(bp, 0, xjust=0.5, legend=letters[1:5], lwd=1:5, ncol=3)

Uwe Ligges



thank you very much for your help in advance!

marion

[[alternative HTML version deleted]]

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


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


Re: [R] Automating R for Hypothesis Testing

2012-05-09 Thread Rui Barradas
Hello,

Yes, it does help. Now we can see your data and what you're doing.
What follows is a suggestion on what you could do, not full solution.
(You forgot to say what X1 is, but I don't think it's important to
understand the suggestion.)
(If I'm wrong, say something.)


milwaukeephos - read.csv(milwaukeephos.csv, header=TRUE,
stringsAsFactors=FALSE)
# list of data.frames, one per month
ls1 - split(milwaukeephos, milwaukeephos$month)

#- if you want to keep the models, not needed if you don't.
#  (yoy probably don't)
modelH - vector(list, 12)
modelHa - vector(list, 12)
modelH2 - vector(list, 12)
modelH2a - vector(list, 12)
#- values to record, these are needed, create them beforehand.
chi_fm - numeric(12)
chi_fms - numeric(12)
#
seq_months - c(1:12, 1) # wrap months around.
for(i in 1:12){
month_this - seq_months[i]
month_next - seq_months[i + 1]

lload - c(ls1[[month_this]]$load_kg, ls1[[month_next]]$load_kg)
lflow - c(ls1[[month_this]]$flow, ls1[[month_next]]$flow)
modelH[[i]] - lm(lload ~ lflow)
# If you don't want to keep the models, use modelH only
# ( without [[i]] )
# and do the same with X1

# rest of your code for first test goes here
chi_fm[i] - bfm %*% var_fm %*% (bunres_fm - bres_fm)

# and the same for the second test
chi_fms[i] - ...etc...
}


Hope this helps,

Rui Barradas


meredith wrote
 
 dput:  http://r.789695.n4.nabble.com/file/n4620188/milwaukeephos.csv
 milwaukeephos.csv 
 
 # Feb-march
 modelH_febmarch-lm(llfeb_march~lffeb_march)
modelHa_febmarch-lm(llfeb_march~X1feb_mar+lffeb_march)
 anova(modelHa_febmarch)
 coefficients(modelH_febmarch)
 (Intercept) lffeb_march 
   -2.4298901.172821 
 coefficients(modelHa_febmarch)
 (Intercept)   X1feb_mar lffeb_march 
  -2.8957776  -0.5272793   1.3016303 
 bres_fm-matrix(c(-2.429890,0,1.172821),nrow=3)
 bunres_fm-matrix(c(-2.8957776,-0.5272793,1.3016303),nrow=3)
bfm-t(bunres_fm-bres_fm)
 fmvect-seq(1,1,length=34)
 X1a_febmar-seq(0,0,length=9) # dummy variable step 1
 X1b_febmar-seq(1,1,length=25) # dummy variable step 2
 X1feb_mar-c(X1a_febmar,X1b_febmar) #dummy variable creation
 # Test Stat Equation for Chisq
 fmxx-cbind(fmvect,X1feb_mar,lffeb_march)
 tfmx-t(fmxx)
 xcom_fm-(tfmx %*% fmxx)
 xinv_fm-ginv(xcom_fm)
 var_fm-xinv_fm*0.307
 chi_fm-bfm %*% var_fm %*% (bunres_fm-bres_fm)
 chi_fm # chisq value for recording
 if less than CV move onto to slope modification
 modelH2_febmarch-lm(llfeb_march~X3feb_march)
 modelH2a_febmarch-lm(llfeb_march~X3feb_march+X4feb_march)
 anova(modelH2a_febmarch)
 coefficients(modelH2_febmarch) # get coefficients to make beta vectors
 for test
 (Intercept) X3feb_march 
5.3421301.172821 
 coefficients(modelH2a_febmarch)
 (Intercept) X3feb_march X4feb_march 
   5.2936263   1.0353752   0.2407557 
 # Test Stat
 bsres_fm-matrix(c(5.342130,1.172821,0),nrow=3)
 bsunres_fm-matrix(c(5.2936263,1.0353752,0.2407557),nrow=3)
 bsfm-t(bsunres_fm-bsres_fm)
 #X matrix
 fmxs-cbind(fmvect,X3feb_march,X4feb_march)
 tfmxs-t(fmxs)
 xcoms_fm-(tfmxs %*% fmxs)
 xinvs_fm-ginv(xcoms_fm)
 var_fms-xinvs_fm*0.341
 chi_fms-bsfm %*% var_fms %*% (bsunres_fm-bsres_fm)
 chi_fms
 # Record Chisq value
 
 Does this help?
 Here lffeb_march is the combination of Feb and March log flows
 and llfeb_march is the combination of Feb and March log loads
 X3: lffeb_march-mean(feb_march)
 X4: X1*X3
 
 Thanks
 
 Rui Barradas wrote
 
 Hello,
 
 I'm not at all sure if I understand your problem. Does this describe it?
 
 
 test first model for months 1 and 2
 if test statistic less than critical value{
  test second model for months 1 and 2
  print results of the first and second tests? just one of them?
 }
 move on to months 2 and 3
 etc, until months 12 and 1
 
 
 Please post example data using dput(dataset).
 Just copy it's output and paste it in your post.
 
 And example code, what you're already doing.
 (Possibly simplified)
 
 Rui Barradas
 
 
 meredith wrote
 
 R Users-
   I have been trying to automate a manual code that I have developed for
 calling in a .csv file, isolating certain rows and columns that
 correspond to specified months:
 something to the effect
 i=name.csv
 N=length(i$month)
 iphos1=0
 iphos2=0
 isphos3=0
 for i=1,N
  if month=1
 iphos1=iphos+1
 iphos1(iphos1)=i
 
 an so on to call out the months into there own arrays (unless there is a
 way I can wrap it into the next automation)
 
 Next: I would like to run a simple linear regression combining each of
 the months 1 by 1:
 for instance I want to run a regression on a combined model from months
 1 and 2 and a dummy model for 1 and 2, compare them using a Chi-sq
 distribution, if Chi-sq is less than the Critical value, we accept and
 go on to test another set of models with both 1 and 2. If it rejects,
 then we proceed to months 2 and 3.  If we move on to the second set on
 months 1 and 2, and the critical value is accepted, I want to print an
 

Re: [R] registry vulnerabilities in R

2012-05-09 Thread Gavin Blackburn
Not sure if it helps, but Tinn-R could be used as a replacement for RStudio if 
the main things you were after were the syntax highlighting and R integration.

Cheers,

Gavin.

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Duncan Murdoch
Sent: 09 May 2012 15:57
To: pamar...@alum.mit.edu
Cc: r-help@r-project.org
Subject: Re: [R] registry vulnerabilities in R

On 08/05/2012 11:10 AM, Paul Martin wrote:
 Kirtland Air Force Base has denied approval for the use of R on its
 Windows network. Some of their objections seem a bit strange, but some
 appear  to  be  legitimate. In particular, they have detected registry
 vulnerabilities
 which are detailed in the attachment.

I suspect their test is wrong, but I can't say for sure, because they 
apparently tested R within RStudio.  I know R didn't have anything to do 
with most of those registry entries that were listed, and I strongly 
suspect RStudio didn't either.

I'd suggest that if you want to use R, just ask them to test R.  It's 
nice to have the RStudio front end, but you don't need it.

Once R is accepted, you could ask for an RStudio test if you want.

On the other hand, R is not safe to install, in the sense that it does 
give programs access to anything the user has access to.   I am pretty 
sure that's also true of at least Matlab and Mathematica in the list of 
alternatives you were given.

Duncan Murdoch

 I know nothing about Windows registry vulnerabilities. If any of these
 issues are
 legitimate concerns, I would like to see them fixed for everyone's 
 benefit.
 I would
 appreciate a referral to the appropriate forum for this information. I am
 willing
 to  assist  in  getting  questions  answered  and gathering additional
 information.
 Thank you,
 Paul Martin
 Air Force Research Laboratory
 Kirtland Air Force Base
 Albuquerque, New Mexico
  Original Message 

 Subject: FW: R/RStudio Software
 Date: Fri, 4 May 2012 15:15:20 -0600
 From: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
 [1]paul.mar...@kirtland.af.mil
 To: [2]pamar...@alum.mit.edu

 -Original Message-
 From: Goel, Suman K Civ USAF AFMC AFRL/RVIO
 Sent: Friday, May 04, 2012 3:13 PM
 To: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
 Subject: RE: R/RStudio Software

 Mr. Martin,

 Rstudio is an IDE for writing R code. I installed Rstudio first but it
 doesn't work without R so I tested them together.

 When I test a software usually the registry analysis file is blank. But this
 one happen to have numerous registry vulnerabilities - see attached. Most of
 them I even don't know if affects the software.
 Collaboration P2P Host In TCP/Out TCP allowed seemed troubling.

 Thanks,
 Suman

 -Original Message-
 From: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
 Sent: Friday, May 04, 2012 2:51 PM
 To: Goel, Suman K Civ USAF AFMC AFRL/RVIO
 Subject: RE: R/RStudio Software

 Ms. Goel,

 Sorry to bother you again with this, but I have two more questions:

 1. Were these vulnerabilities found in both R and RStudio?

 2. Could you be more explicit about the registry vulnerabilities? This is
 the only item
 where I could potentially get some issues addressed. Even if I cannot get
 this software
 on the NIPRNET, I can pass along your discoveries and help the community
 improve their
 code.

 Thank you,

 Paul Martin

 -Original Message-
 From: Goel, Suman K Civ USAF AFMC AFRL/RVIO
 Sent: Friday, May 04, 2012 2:34 PM
 To: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
 Cc: Goel, Suman K Civ USAF AFMC AFRL/RVIO
 Subject: RE: R/RStudio Software

 Mr. Martin,

 Thank you for understanding. Here are some examples of vulnerabilities.

 Numerous forbidden file extensions.
 Numerous registry vulnerabilities
 Network connections to foreign IP address

 Many vulnerabilities are firewall policies related under restricted
 services.

 Once again Thank you,

 Respectfully,
 Suman


 -Original Message-
 From: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
 Sent: Friday, May 04, 2012 2:12 PM
 To: Goel, Suman K Civ USAF AFMC AFRL/RVIO
 Subject: RE: R/RStudio Software

 Suman,



 Thank you for your reply. If it is not too much trouble, could you enumerate
 the issues you found, so that I can forward the list to the team maintaining
 the R software? I have no idea what kind of response to expect, but these
 people should at least be aware of the issues.



 Thank you.



 Paul Martin



 From: Goel, Suman K Civ USAF AFMC AFRL/RVIO
 Sent: Friday, May 04, 2012 2:07 PM
 To: Martin, Paul A Civ USAF AFMC AFRL/RVSEF
 Cc: Motes, Raymond A Civ USAF AFMC AFRL/RVSE; Serafico, Romeo G Civ USAF
 AFMC AFRL/RVIO; Mickey, Dallas C Civ USAF AFMC AFRL/RVIO; Trujillo, Lloyd P
 Civ USAF AFMC AFRL/RVIO
 Subject: R/RStudio Software



 Mr. Martin,



 After completing the vulnerability analysis, we decided to decline to
 approve R/RStudio software on the 

Re: [R] registry vulnerabilities in R

2012-05-09 Thread Marc Schwartz

On May 9, 2012, at 9:57 AM, Duncan Murdoch wrote:

 On 08/05/2012 11:10 AM, Paul Martin wrote:
Kirtland Air Force Base has denied approval for the use of R on its
Windows network. Some of their objections seem a bit strange, but some
appear  to  be  legitimate. In particular, they have detected registry
vulnerabilities
which are detailed in the attachment.
 
 I suspect their test is wrong, but I can't say for sure, because they 
 apparently tested R within RStudio.  I know R didn't have anything to do with 
 most of those registry entries that were listed, and I strongly suspect 
 RStudio didn't either.
 
 I'd suggest that if you want to use R, just ask them to test R.  It's nice to 
 have the RStudio front end, but you don't need it.
 
 Once R is accepted, you could ask for an RStudio test if you want.
 
 On the other hand, R is not safe to install, in the sense that it does give 
 programs access to anything the user has access to.   I am pretty sure that's 
 also true of at least Matlab and Mathematica in the list of alternatives you 
 were given.
 
 Duncan Murdoch

Just as an FYI, in response to Barry's post on this thread, NIPRNet is the US 
Dept of Defense (DOD) private network that supports the transmission of 
sensitive, but unclassified, information. It is hosted by DOD private routers, 
primarily for internal use, while providing external access as well. Some may 
know it by it's former name MILNet and it has a classified private network 
counterpart, known as SIPRNet.

As a consequence, the level of security oversight is higher and more 
restrictive than what one might find on typical commercial or academic networks.

Regards,

Marc Schwartz

__
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] file path

2012-05-09 Thread Wincent
Hmm, I don't think it gives what I want.

For example, I assign a file name to f,
 f - a?b.txt
 file.path(e:,f)
[1] e:/a?b.txt

The resultant character is not accepted as a file name by Windows OS.

On 9 May 2012 20:32, Tal Galili tal.gal...@gmail.com wrote:
 Hi Wincent,
 Have a look at:
 ?file.path



 Contact
 Details:---
 Contact me: tal.gal...@gmail.com |  972-52-7275845
 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
 www.r-statistics.com (English)
 --




 On Wed, May 9, 2012 at 11:03 AM, Wincent ronggui.hu...@gmail.com wrote:

 Dear all, is there any function to assert whether a file path is
 legitimate, and to convert any potential file path to a legitimate
 file path?

 I automate a batch of files and write them to plain text files with
 cat(). The file argument of cat() is generated automatically which may
 contain characters such as ?  , unacceptable in Windows OS. What I
 do at this moment is to strip such characters off with gsub(). Is
 there any direct way to make legitimate file path without detailed
 knowledge about the naming rule specific to a OS?

 Best

 --
 Wincent Ronggui HUANG
 Sociology Department of Fudan University
 PhD of City University of Hong Kong
 http://homepage.fudan.edu.cn/rghuang/cv/

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





-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://homepage.fudan.edu.cn/rghuang/cv/

__
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] [R-pkgs] ANN: bigml package for R bigml_0.1.tar.gz

2012-05-09 Thread Justin Donaldson
The bigml package is an R wrapper for the BigML API:
https://bigml.com/developers

It contains straightforward methods for most of the relevant API end
points, as well as some fancier methods that allow for direct translations
from R dataframes directly into datasets appropriate for BigML.

Excerpt from an upcoming blog post, which describes the package in more
detail:

Today BigML releases the bigml package for R.  R is already well known for
 its capabilities in statistics and data analysis, and we use it internally
 for a number of different day-to-day tasks.  The bigml package enables the
 R community to easily take advantage of our highly scalable cloud based
 machine learning infrastructure, while using familiar R data structures and
 workflows.



Apologies for sending this e-mail a bit late.

Best,
-Justin

-- 
blog: http://www.scwn.net
aim: iujjd
twitter: jjdonald

[[alternative HTML version deleted]]

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

__
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] What is the most cost effective hardware for R?

2012-05-09 Thread Whit Armstrong
I don't work for Amazon, but here is one of their promo pieces on
using 'spot' instances:
http://youtu.be/WD9N73F3Fao

at about 2:15, they cite University of Melbourne and Universitat de
Barcelona as customers...

My interest in all this cloud talk is that I'll be presenting a
tutorial on R in the cloud at R/Finance.
http://www.rinfinance.com/agenda/

It's really easy to use R in the cloud, even if you don't want to move
your data into s3.

-Whit



On Wed, May 9, 2012 at 9:36 AM, Barry Rowlingson
b.rowling...@lancaster.ac.uk wrote:
 On Wed, May 9, 2012 at 2:22 PM, John Laing john.la...@gmail.com wrote:
 For 200,000 analyses at 1.5 seconds each, you're looking at ~83 hours
 of computing time. You can buy time from Amazon at roughly $0.08 /
 core / hour, so it would cost about $7 to run your analyses in the
 cloud. Assuming complete parallelization you could fire up as many
 machines as you need to get the work done in as little time as you
 want, with the same fixed cost. I think that's a pretty compelling
 argument, compared to the hassles of buying and maintaining hardware,
 power supply, air conditioning, etc.

  Noticing Hugh's .ac.uk email address you do have to factor in the
 hassle of getting something as nebulous as cloud computing past the
 red tape. How much will it cost? says the bureaucrat. Depends how
 much CPU time I need, says the academic. So potentially, what's the
 most? says the bureaucrat. Millions,, says the academic, honestly,
 adding but that would only be if my job scheduling went a bit mad and
 grabbed a few thousand Amazon cores and thrashed them for weeks
 without me noticing. Okay, says the bureaucrat, now, can we send
 Amazon a purchase order so that Amazon send us an invoice for this
 unknown and potentially unpredictable cost first?. Oh no, says the
 academic, we need a credit card

 Maybe there are other ways of paying for Amazon cloud CPUs, I've not
 investigated. Anyone in academia happily crunching on EC2?

 Barry

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

__
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] What is the most cost effective hardware for R?

2012-05-09 Thread Michael Sumner
Barry, *fortunes* are very auspicious but you are already well represented.

Cheers, Mike.

On Thu, May 10, 2012 at 1:38 AM, Whit Armstrong
armstrong.w...@gmail.com wrote:
 I don't work for Amazon, but here is one of their promo pieces on
 using 'spot' instances:
 http://youtu.be/WD9N73F3Fao

 at about 2:15, they cite University of Melbourne and Universitat de
 Barcelona as customers...

 My interest in all this cloud talk is that I'll be presenting a
 tutorial on R in the cloud at R/Finance.
 http://www.rinfinance.com/agenda/

 It's really easy to use R in the cloud, even if you don't want to move
 your data into s3.

 -Whit



 On Wed, May 9, 2012 at 9:36 AM, Barry Rowlingson
 b.rowling...@lancaster.ac.uk wrote:
 On Wed, May 9, 2012 at 2:22 PM, John Laing john.la...@gmail.com wrote:
 For 200,000 analyses at 1.5 seconds each, you're looking at ~83 hours
 of computing time. You can buy time from Amazon at roughly $0.08 /
 core / hour, so it would cost about $7 to run your analyses in the
 cloud. Assuming complete parallelization you could fire up as many
 machines as you need to get the work done in as little time as you
 want, with the same fixed cost. I think that's a pretty compelling
 argument, compared to the hassles of buying and maintaining hardware,
 power supply, air conditioning, etc.

  Noticing Hugh's .ac.uk email address you do have to factor in the
 hassle of getting something as nebulous as cloud computing past the
 red tape. How much will it cost? says the bureaucrat. Depends how
 much CPU time I need, says the academic. So potentially, what's the
 most? says the bureaucrat. Millions,, says the academic, honestly,
 adding but that would only be if my job scheduling went a bit mad and
 grabbed a few thousand Amazon cores and thrashed them for weeks
 without me noticing. Okay, says the bureaucrat, now, can we send
 Amazon a purchase order so that Amazon send us an invoice for this
 unknown and potentially unpredictable cost first?. Oh no, says the
 academic, we need a credit card

 Maybe there are other ways of paying for Amazon cloud CPUs, I've not
 investigated. Anyone in academia happily crunching on EC2?

 Barry

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

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



-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsum...@gmail.com

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


Re: [R] file path

2012-05-09 Thread Uwe Ligges



On 09.05.2012 17:14, Wincent wrote:

Hmm, I don't think it gives what I want.

For example, I assign a file name to f,

f- a?b.txt
file.path(e:,f)

[1] e:/a?b.txt

The resultant character is not accepted as a file name by Windows OS.



Not on Linux if you write to a smb file system, and that system won't 
tell you in advance. hence you have to know it yourself or correctly 
interpret the corresponding error messages.


Uwe Ligges



On 9 May 2012 20:32, Tal Galilital.gal...@gmail.com  wrote:

Hi Wincent,
Have a look at:
?file.path



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 9, 2012 at 11:03 AM, Wincentronggui.hu...@gmail.com  wrote:


Dear all, is there any function to assert whether a file path is
legitimate, and to convert any potential file path to a legitimate
file path?

I automate a batch of files and write them to plain text files with
cat(). The file argument of cat() is generated automatically which may
contain characters such as ?  , unacceptable in Windows OS. What I
do at this moment is to strip such characters off with gsub(). Is
there any direct way to make legitimate file path without detailed
knowledge about the naming rule specific to a OS?

Best

--
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://homepage.fudan.edu.cn/rghuang/cv/

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









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


Re: [R] registry vulnerabilities in R

2012-05-09 Thread Barry Rowlingson
 Someone said:

 Once R is accepted, you could ask for an RStudio test if you want.

 I had another thought shortly after my initial email. Suppose yes, R
is accepted. Great. You run R.

 Then you think, Oh, I need ggplot2 (yes you do). Do you then have
to get security clearance for every package you want to download from
CRAN?

Barry

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


Re: [R] Random resampling of columns in species association matrices

2012-05-09 Thread David L Carlson
Sample data would make it possible to explore the options in more detail,
but here are two possibilities:

1. Convert each row of the matrix to row proportions and then take the
cumulative sum. Now draw a random uniform number between 0 and 1 and find
the first column that is larger than the random number. That column is your
randomly selected host. If there is one host, the cumulative sums will be
zero until you reach that column and then it will flip to 1 so that you will
always select that host.

2. For each parasite, create a vector of host names with each host repeated
by the number of interactions with that host. Use sample() to randomly draw
a host. You'll probably want to combine the vectors into a list to automate
the process over all parasites.

--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of mariasve
 Sent: Wednesday, May 09, 2012 9:35 AM
 To: r-help@r-project.org
 Subject: [R] Random resampling of columns in species association
 matrices
 
 I have a host-parasite association matrix in which parasite species are
 rows
 and host species columns and cells contain the frequency of
 interactions.
 Some parasites are associated with many hosts, and some hosts harbor
 several
 parasites, and I want to repeatedly select only one single
 representative
 host per generalized (multi-host) parasite to create a new matrix in
 which
 no hosts are repeated. That is, I want multiple randomly generated
 symmetric
 matrices in which a host and a parasite species appear only once.
 Furthermore, I want to weight the probability of selecting a particular
 host
 for a parasite by the frequency of interactions between the two.
 Finally, a
 handful of parasites associate with only one single host. I do not want
 to
 lose these from the matrix, but rather fix these associations and only
 randomly select hosts for the generalized parasite species.
 
 My goal is to eventually perform generalized least squares regressions
 between a parasite trait and several host traits, but the first major
 hurdle
 for me to get over is how to randomly select only one host per parasite
 with
 no repetition of species in the matrix. I am also generally interested
 in
 how to resample columns instead of rows (in the package boot, for
 instance)
 because of another analysis I'm working on, and I have been unable to
 find a
 solution to this when searching the R help site.
 
 Any suggestions would be most welcomed.
 
 Maria
 
 
 
 --
 View this message in context: http://r.789695.n4.nabble.com/Random-
 resampling-of-columns-in-species-association-matrices-tp4620618.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] Produce indicator values + variance explained tables of a MRT produced by mvpart (R)

2012-05-09 Thread jaZZerkill

How can I produce a table with the variance explained by each explain
variable and a table with indicator values of the explain variables of the
MRT produced by mvpart (R)

Example? -- table 2 and table 3 in the following document:
http://sav-harbor.com/GRS%20Info/MSM/Predicting_Tidal_Marsh_Vegetation_Communities.pdf


--
View this message in context: 
http://r.789695.n4.nabble.com/Produce-indicator-values-variance-explained-tables-of-a-MRT-produced-by-mvpart-R-tp4620933.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] glmmADMB

2012-05-09 Thread Paul Johnson
On Tue, May 8, 2012 at 9:06 PM, rbuxton moy...@hotmail.com wrote:

 Update!

 I changed the site categories.  I noticed that I had coded them as
 North,
 South, East, West on different islands, which may have caused confusion in
 the model.

 [...]



 mod - glmmadmb(LESP.CHUCKLE~ 1+(1|ISLAND), data=callsna,
 zeroInflation=TRUE, family=nbinom)

 Any thoughts?

 YES.

POST THE ENTIRE R PROGRAM YOU ARE RUNNING as well as a link to the EXACT
data set that is causing the problem.

pj




 Thanks so so much!

 Rachel Buxton





-- 
Paul E. Johnson
Professor, Political ScienceAssoc. Director
1541 Lilac Lane, Room 504 Center for Research Methods
University of Kansas   University of Kansas
http://pj.freefaculty.orghttp://quant.ku.edu

[[alternative HTML version deleted]]

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


Re: [R] There must be a better way to do this

2012-05-09 Thread David Perlman
Thanks, that is very helpful.  I agree that my example plot was a bit 
cluttered, but this is what I actually wanted:
http://brainimaging.waisman.wisc.edu/~perlman/data/MNPT1T2_h_unp_raw.pdf
I just needed to get example code out quickly.  You get better help when you 
have a self-contained demo of the question.  :)

I have replaced my old horrible code with the nice concise segments code.  
Thanks!


On May 9, 2012, at 3:55 AM, Jim Lemon wrote:

 On 05/09/2012 03:59 AM, David Perlman wrote:
 I made this rather cool plot which I am quite pleased with:
 http://brainimaging.waisman.wisc.edu/~perlman/data/BeeswarmLinesDemo.pdf
 
 However, I feel there must be a better way to do it than what I did.  I'm 
 attaching the code to create it, which downloads the data by http so it 
 should run for you if you have the current version of beeswarm installed 
 (which was just updated today, incidentally).  It might also work with a 
 non-current version of beeswarm.
 
 The problem is that I jumped through all kinds of hoops to:
 
 a) get the subject numbers for each point associated with the point xy 
 coordinates output by beeswarm.  The order of the points is not the same as 
 the order in the input file; they are shuffled in a way that I think depends 
 on the input formula.  The trick I used (ok, I hope you're sitting down when 
 you read this) is to run beeswarm a second time with pwcol=Subj, so then the 
 col column of the output becomes the subject numbers.  I know, horrible.  
 But I don't know how else to do it.  I feel like there is probably some 
 logic to the way the cases were reordered by the formula, but I don't know 
 how to work with that.
 
 b) get the lines() function to pair the xy coordinates properly.  I did this 
 by reshaping the whole thing into wide format, with separate columns for x.1 
 y.1 x.2 y.2, and then add a third pair of columns x.3 y.3 which is all NA, 
 and then reshaping it back into long format.  Then the lines() function 
 automatically does the right thing, but I feel like that was a horrible hack 
 and there must be a smarter way to do it.
 
 
 Hi Dave,
 This plot looks like the offspring of a boxplot, a beeswarm plot and a 
 bumpchart after a heavy night on the grog. Beauty is in the eye of the 
 beholder, I guess.
 
 Let's see, first you plot the boxplots, then the beeswarm on the centerlines 
 of the boxplots, then you want to add the lines. Okay, try this:
 
 paindat-data.frame(
 HEP1=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10))),
 HEP2=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10))),
 MBSR1=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10))),
 MBSR2=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10))),
 Wait1=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10))),
 Wait2=sample(1:20,30,TRUE,
 prob=c(seq(0,0.1,length.out=10),seq(0.1,0,length.out=10
 boxplot(paindat,ylim=c(0,20),
 col=c(pink,pink,lightgreen,lightgreen,lightblue,lightblue))
 require(beeswarm)
 bsinfo-beeswarm(tangledat,add=TRUE)
 segments(bsinfo$x[bsinfo$x.orig==HEP1],bsinfo$y[bsinfo$x.orig==HEP1],
 bsinfo$x[bsinfo$x.orig==HEP2],bsinfo$y[bsinfo$x.orig==HEP2])
 segments(bsinfo$x[bsinfo$x.orig==MBSR1],bsinfo$y[bsinfo$x.orig==MBSR1],
 bsinfo$x[bsinfo$x.orig==MBSR2],bsinfo$y[bsinfo$x.orig==MBSR2])
 segments(bsinfo$x[bsinfo$x.orig==Wait1],bsinfo$y[bsinfo$x.orig==Wait1],
 bsinfo$x[bsinfo$x.orig==Wait2],bsinfo$y[bsinfo$x.orig==Wait2])
 
 and let me say right here that the beeswarm function is a crackerjack piece 
 of work.
 
 Jim

-dave--
A neuroscientist is at the video arcade, when someone makes him a $1000 bet
on Pac-Man. He smiles, gets out his screwdriver and takes apart the Pac-Man
game. Everyone says What are you doing? The neuroscientist says Well,
since we all know that Pac-Man is based on electric signals traveling
through these circuits, obviously I can understand it better than the other
guy by going straight to the source!

__
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] What is the most cost effective hardware for R?

2012-05-09 Thread peter dalgaard

On May 9, 2012, at 17:46 , Michael Sumner wrote:

 Barry, *fortunes* are very auspicious but you are already well represented.

..as nebulous as cloud computing.., indeed!

 Cheers, Mike.
 
 On Thu, May 10, 2012 at 1:38 AM, Whit Armstrong
 armstrong.w...@gmail.com wrote:
 I don't work for Amazon, but here is one of their promo pieces on
 using 'spot' instances:
 http://youtu.be/WD9N73F3Fao
 
 at about 2:15, they cite University of Melbourne and Universitat de
 Barcelona as customers...
 
 My interest in all this cloud talk is that I'll be presenting a
 tutorial on R in the cloud at R/Finance.
 http://www.rinfinance.com/agenda/
 
 It's really easy to use R in the cloud, even if you don't want to move
 your data into s3.
 
 -Whit
 
 
 
 On Wed, May 9, 2012 at 9:36 AM, Barry Rowlingson
 b.rowling...@lancaster.ac.uk wrote:
 On Wed, May 9, 2012 at 2:22 PM, John Laing john.la...@gmail.com wrote:
 For 200,000 analyses at 1.5 seconds each, you're looking at ~83 hours
 of computing time. You can buy time from Amazon at roughly $0.08 /
 core / hour, so it would cost about $7 to run your analyses in the
 cloud. Assuming complete parallelization you could fire up as many
 machines as you need to get the work done in as little time as you
 want, with the same fixed cost. I think that's a pretty compelling
 argument, compared to the hassles of buying and maintaining hardware,
 power supply, air conditioning, etc.
 
  Noticing Hugh's .ac.uk email address you do have to factor in the
 hassle of getting something as nebulous as cloud computing past the
 red tape. How much will it cost? says the bureaucrat. Depends how
 much CPU time I need, says the academic. So potentially, what's the
 most? says the bureaucrat. Millions,, says the academic, honestly,
 adding but that would only be if my job scheduling went a bit mad and
 grabbed a few thousand Amazon cores and thrashed them for weeks
 without me noticing. Okay, says the bureaucrat, now, can we send
 Amazon a purchase order so that Amazon send us an invoice for this
 unknown and potentially unpredictable cost first?. Oh no, says the
 academic, we need a credit card
 
 Maybe there are other ways of paying for Amazon cloud CPUs, I've not
 investigated. Anyone in academia happily crunching on EC2?
 
 Barry
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 __
 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.
 
 
 
 -- 
 Michael Sumner
 Institute for Marine and Antarctic Studies, University of Tasmania
 Hobart, Australia
 e-mail: mdsum...@gmail.com
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


Re: [R] registry vulnerabilities in R

2012-05-09 Thread Marc Schwartz

On May 9, 2012, at 11:00 AM, Barry Rowlingson wrote:

 Someone said:
 
 Once R is accepted, you could ask for an RStudio test if you want.
 
 I had another thought shortly after my initial email. Suppose yes, R
 is accepted. Great. You run R.
 
 Then you think, Oh, I need ggplot2 (yes you do). Do you then have
 to get security clearance for every package you want to download from
 CRAN?
 
 Barry

That will depend upon their internal procedures/policies.

Presuming that the initial hurdle for R itself is overcome, for third party 
packages, whether from CRAN or elsewhere, Paul might see if the folks involved 
in the review process would allow him to install these to a local private 
folder tree, where it may be possible that security related concerns may be 
more mitigated and provide more flexibility than if for a system-wide install. 
In other words, see if there is some way to, in effect, sandbox the additional 
components, that would be acceptable.

A quick review of the lengthy output that Paul provided in the original post 
seems to suggest that the majority, if not all, of the registry related issues 
are specific to R-Studio itself and not to R.

Third party packages, of course, may have additional code that can perform a 
variety of activities (access/modify local system resources, access external 
IP's, etc.), so it would not be a surprise to me that there may need to be a 
package by package review and approval process.

Of course, the mere process of downloading and installing CRAN or other 
packages means that access to external IP's would be required, which appear to 
be part of the restrictions. It would be interesting to find out how updates 
over the net are handled for the approved applications. Are these allowed or 
are they controlled by a central authority?

So an internal discussion would be required to understand how R would fit 
within the policy and procedure constraints in place. It is clear that despite 
the subject heading for this thread, registry related issues are only a part of 
the underlying problem.

It would also be of value to know how other folks, operating in similar 
'restricted' environments, either inside or outside the U.S., have overcome 
these issues, so that Paul may learn from their experience. We do, for example, 
get posts here now and then from folks with U.S. .mil domain e-mail 
addresses. So there appear to be folks using R in such environments, unless 
they are using R, but not on DOD owned systems.

Regards,

Marc

__
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] What is the most cost effective hardware for R?

2012-05-09 Thread Michael Sumner
It's not water vapour: http://www.youtube.com/watch?v=rg12qNRgSag

On Thu, May 10, 2012 at 2:20 AM, peter dalgaard pda...@gmail.com wrote:

 On May 9, 2012, at 17:46 , Michael Sumner wrote:

 Barry, *fortunes* are very auspicious but you are already well represented.

 ..as nebulous as cloud computing.., indeed!

 Cheers, Mike.

 On Thu, May 10, 2012 at 1:38 AM, Whit Armstrong
 armstrong.w...@gmail.com wrote:
 I don't work for Amazon, but here is one of their promo pieces on
 using 'spot' instances:
 http://youtu.be/WD9N73F3Fao

 at about 2:15, they cite University of Melbourne and Universitat de
 Barcelona as customers...

 My interest in all this cloud talk is that I'll be presenting a
 tutorial on R in the cloud at R/Finance.
 http://www.rinfinance.com/agenda/

 It's really easy to use R in the cloud, even if you don't want to move
 your data into s3.

 -Whit



 On Wed, May 9, 2012 at 9:36 AM, Barry Rowlingson
 b.rowling...@lancaster.ac.uk wrote:
 On Wed, May 9, 2012 at 2:22 PM, John Laing john.la...@gmail.com wrote:
 For 200,000 analyses at 1.5 seconds each, you're looking at ~83 hours
 of computing time. You can buy time from Amazon at roughly $0.08 /
 core / hour, so it would cost about $7 to run your analyses in the
 cloud. Assuming complete parallelization you could fire up as many
 machines as you need to get the work done in as little time as you
 want, with the same fixed cost. I think that's a pretty compelling
 argument, compared to the hassles of buying and maintaining hardware,
 power supply, air conditioning, etc.

  Noticing Hugh's .ac.uk email address you do have to factor in the
 hassle of getting something as nebulous as cloud computing past the
 red tape. How much will it cost? says the bureaucrat. Depends how
 much CPU time I need, says the academic. So potentially, what's the
 most? says the bureaucrat. Millions,, says the academic, honestly,
 adding but that would only be if my job scheduling went a bit mad and
 grabbed a few thousand Amazon cores and thrashed them for weeks
 without me noticing. Okay, says the bureaucrat, now, can we send
 Amazon a purchase order so that Amazon send us an invoice for this
 unknown and potentially unpredictable cost first?. Oh no, says the
 academic, we need a credit card

 Maybe there are other ways of paying for Amazon cloud CPUs, I've not
 investigated. Anyone in academia happily crunching on EC2?

 Barry

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

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



 --
 Michael Sumner
 Institute for Marine and Antarctic Studies, University of Tasmania
 Hobart, Australia
 e-mail: mdsum...@gmail.com

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

 --
 Peter Dalgaard, Professor,
 Center for Statistics, Copenhagen Business School
 Solbjerg Plads 3, 2000 Frederiksberg, Denmark
 Phone: (+45)38153501
 Email: pd@cbs.dk  Priv: pda...@gmail.com











-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsum...@gmail.com

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


Re: [R] two Y Axes (in the same scale) in ggplot2

2012-05-09 Thread John Kane
I don't think it is doable in ggplot2.  Hadley dislikes dual scales on a single 
plot which is what most people would use such a thing for and so it is 
basically not on his to-do list.

It is relatively easy to do in base graphics. 
Here on example I put together a few years ago as an exercise -- it uses dual 
scales and I'm really with Hadley (plus Cleveland, Wainer, etc) on not using 
them.

I can see a use for different scales but only for data on the same scale.  If 
that does not make much sense, think of a raw scale and a log scale .

Good luck

==
# A simple plot with two y-axes but jazzed up.
# Note that this is poor graphing practice.

x - 1:10
y1 - x^2
y2 - 100-3*x+rnorm(10)

op  - par(mar=c(5.1,4.1,4.1,4.1))

plot(x,y1, col =red, ylab='')
text(7.5, 17, y1, col=red)
mtext('Red Plot',side=2,line=2.5, col=red)
par(new=TRUE)
plot(x,y2,xaxt='n',yaxt='n',xlab='',ylab='',pch=3, col=blue)
axis(4)
mtext('Blue Plot',side=4,line=2.5, col=blue)
text(2.2, 89, y2,col=blue)
par(op)



John Kane
Kingston ON Canada


 -Original Message-
 From: pdxgary...@gmail.com
 Sent: Tue, 8 May 2012 12:29:52 -0700 (PDT)
 To: r-help@r-project.org
 Subject: [R] two Y Axes (in the same scale) in ggplot2
 
 Dear R users,
 
 I'm plotting housing prices in City A over past 30 years in ggplot2. The
 Xs
 are years since 1980. I have two housing price variables: new home prices
 and old home prices, both of them measured by $/sqft. I have searched
 related threads on multiple Y axes in ggplot2 and I understand that
 multiple
 Y axes in different scales are not possible. I'm wondering if it is
 possible
 to have multiple Y axes with the same scale in ggplot2, like in my case.
 If
 still not possible, is there a easy way to do it in R's default plot
 function? Thanks.
 
 Gary
 
 --
 View this message in context:
 http://r.789695.n4.nabble.com/two-Y-Axes-in-the-same-scale-in-ggplot2-tp4618441.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks  orcas on your 
desktop!

__
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] Matrix heatmap

2012-05-09 Thread fjucks
I just do not understand what these parameters that must pass the heat map

--
View this message in context: 
http://r.789695.n4.nabble.com/Matrix-heatmap-tp4619084p4620958.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] registry vulnerabilities in R

2012-05-09 Thread Paul Martin

I don't have much new to add, but I want to make some clarifying comments:

First, there are clearly workarounds available. I am using one now. R is 
installed on a personal laptop which I bring to work every day. I take 
extreme care with the nature of the files I move back and forth, and 
none of this is classified. This is common practice here. Yes, it would 
be nice if I could get R onto my desktop machine at work. It would save 
me burning CDs to move plots back and forth. But it's not the end of the 
world. My ability to get work done is not the issue here.


The issue is the following: Is there anything her which is of concern to 
the R community? I suspect the answer is no, but cannot say anything for 
sure at this point.


The registry analysis tool looks like it is custom software developed by 
the Air Force. I can't get any specific information beyond that. That is 
unfortunate, since it would be nice if the tests could be duplicated and 
confirmed.


We will get separate tests on R without RStudio.

The registry analysis reports results in two sections: Registry entries 
added and registry entries modified. There were no vulnerabilities found 
in the entries modified section. All of the vulnerabilities are listed 
under entries added.


I will let you know if I find out anything else. Certainly the isolated 
test of the R software without RStudio will be of interest.


Thank you all or your comments,

Paul Martin

On 5/9/2012 10:00 AM, Barry Rowlingson wrote:

Someone said:
Once R is accepted, you could ask for an RStudio test if you want.

  I had another thought shortly after my initial email. Suppose yes, R
is accepted. Great. You run R.

  Then you think, Oh, I need ggplot2 (yes you do). Do you then have
to get security clearance for every package you want to download from
CRAN?

Barry



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


Re: [R] registry vulnerabilities in R

2012-05-09 Thread Gabor Grothendieck
On Wed, May 9, 2012 at 12:46 PM, Paul Martin pamar...@alum.mit.edu wrote:
 I don't have much new to add, but I want to make some clarifying comments:

 First, there are clearly workarounds available. I am using one now. R is
 installed on a personal laptop which I bring to work every day. I take
 extreme care with the nature of the files I move back and forth, and none of
 this is classified. This is common practice here. Yes, it would be nice if I
 could get R onto my desktop machine at work. It would save me burning CDs to
 move plots back and forth. But it's not the end of the world. My ability to
 get work done is not the issue here.

 The issue is the following: Is there anything her which is of concern to the
 R community? I suspect the answer is no, but cannot say anything for sure at
 this point.

 The registry analysis tool looks like it is custom software developed by the
 Air Force. I can't get any specific information beyond that. That is
 unfortunate, since it would be nice if the tests could be duplicated and
 confirmed.

 We will get separate tests on R without RStudio.

 The registry analysis reports results in two sections: Registry entries
 added and registry entries modified. There were no vulnerabilities found in
 the entries modified section. All of the vulnerabilities are listed under
 entries added.


During the installation process its only the installer that sets any
registry values, not R itself.

Using the standard installer that comes with R it asks you whether you
want to save version numbers in the registry and whether you want to
create an association for RData files.  If you uncheck those then the
installation does not set any registry values.

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

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


Re: [R] registry vulnerabilities in R

2012-05-09 Thread Richard M. Heiberger
I spoke to someone in the military who did some investigation.
This is his response

 1.  I'm sorry that I don't have anything good to report. The military is
 cautious with it's networks and I'm no longer able to use R at work.  I
 don't know anything about this registry issue but the show stopper for me
 even trying to get R on the military network is CRAN. All that r-project
 checks on contributed applications is if they load (or compile as
 necessary)
 cross-platform. I could make an argument for the security of the Core
 functionality of R but not for the contributed packages.


On 5/8/12, Paul Martin pamar...@alum.mit.edu wrote:

Kirtland Air Force Base has denied approval for the use of R on its
Windows network. Some of their objections seem a bit strange, but some
appear  to  be  legitimate. In particular, they have detected registry
vulnerabilities
which are detailed in the attachment.
I know nothing about Windows registry vulnerabilities. If any of these
issues are
legitimate concerns, I would like to see them fixed for everyone's
 benefit.
I would
appreciate a referral to the appropriate forum for this information. I
 am
willing
to  assist  in  getting  questions  answered  and gathering additional
information.
Thank you,
Paul Martin
Air Force Research Laboratory
Kirtland Air Force Base
Albuquerque, New Mexico


__
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] registry vulnerabilities in R

2012-05-09 Thread Duncan Murdoch

On 09/05/2012 2:04 PM, Gabor Grothendieck wrote:

On Wed, May 9, 2012 at 12:46 PM, Paul Martinpamar...@alum.mit.edu  wrote:
  I don't have much new to add, but I want to make some clarifying comments:

  First, there are clearly workarounds available. I am using one now. R is
  installed on a personal laptop which I bring to work every day. I take
  extreme care with the nature of the files I move back and forth, and none of
  this is classified. This is common practice here. Yes, it would be nice if I
  could get R onto my desktop machine at work. It would save me burning CDs to
  move plots back and forth. But it's not the end of the world. My ability to
  get work done is not the issue here.

  The issue is the following: Is there anything her which is of concern to the
  R community? I suspect the answer is no, but cannot say anything for sure at
  this point.

  The registry analysis tool looks like it is custom software developed by the
  Air Force. I can't get any specific information beyond that. That is
  unfortunate, since it would be nice if the tests could be duplicated and
  confirmed.

  We will get separate tests on R without RStudio.

  The registry analysis reports results in two sections: Registry entries
  added and registry entries modified. There were no vulnerabilities found in
  the entries modified section. All of the vulnerabilities are listed under
  entries added.


During the installation process its only the installer that sets any
registry values, not R itself.

Using the standard installer that comes with R it asks you whether you
want to save version numbers in the registry and whether you want to
create an association for RData files.  If you uncheck those then the
installation does not set any registry values.


That's correct.  And with a small change to the installer script, even 
that can be suppressed.  (For anyone interested:  you need 
Uninstallable=no near the top of the Inno Setup script; if using the 
regular build, that's in the file RHOME/src/gnuwin32/installer/header1.iss.)


Duncan Murdoch

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


Re: [R] registry vulnerabilities in R

2012-05-09 Thread Bert Gunter
Thanks Rich and Paul:

This gets back to my original comment in this thread. I believe that
CRAN repositories simply rely on whatever security software (malware
checking, etc.) that the hosts provide; R/CRAN do nothing, as you
said. This results in a whole new and almost certainly wholly
impracticable level of security protection to validate, so it is
doubtful that anything can be done to address the concerns. Again, as
you said.

As always, authoritative (dis?) confirmation by R Core experts
required to validate by statement.

-- Bert



On Wed, May 9, 2012 at 11:10 AM, Richard M. Heiberger r...@temple.edu wrote:
 I spoke to someone in the military who did some investigation.
 This is his response

 1.  I'm sorry that I don't have anything good to report. The military is
 cautious with it's networks and I'm no longer able to use R at work.  I
 don't know anything about this registry issue but the show stopper for me
 even trying to get R on the military network is CRAN. All that r-project
 checks on contributed applications is if they load (or compile as
 necessary)
 cross-platform. I could make an argument for the security of the Core
 functionality of R but not for the contributed packages.


 On 5/8/12, Paul Martin pamar...@alum.mit.edu wrote:

    Kirtland Air Force Base has denied approval for the use of R on its
    Windows network. Some of their objections seem a bit strange, but some
    appear  to  be  legitimate. In particular, they have detected registry
    vulnerabilities
    which are detailed in the attachment.
    I know nothing about Windows registry vulnerabilities. If any of these
    issues are
    legitimate concerns, I would like to see them fixed for everyone's
 benefit.
    I would
    appreciate a referral to the appropriate forum for this information. I
 am
    willing
    to  assist  in  getting  questions  answered  and gathering additional
    information.
    Thank you,
    Paul Martin
    Air Force Research Laboratory
    Kirtland Air Force Base
    Albuquerque, New Mexico


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



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
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] registry vulnerabilities in R

2012-05-09 Thread Richard M. Heiberger
One more item.  Have you given a copy of the document
   R: Regulatory Compliance and Validation Issues A Guidance Document
for the Use of R in Regulated Clinical Trial Environments
   http://www.r-project.org/doc/R-FDA.pdf
to your security office?

It addresses overlapping, not identical, security issues.

Rich

On 5/9/12, Paul Martin pamar...@alum.mit.edu wrote:
 I don't have much new to add, but I want to make some clarifying comments:

 First, there are clearly workarounds available. I am using one now. R is
 installed on a personal laptop which I bring to work every day. I take
 extreme care with the nature of the files I move back and forth, and
 none of this is classified. This is common practice here. Yes, it would
 be nice if I could get R onto my desktop machine at work. It would save
 me burning CDs to move plots back and forth. But it's not the end of the
 world. My ability to get work done is not the issue here.

 The issue is the following: Is there anything her which is of concern to
 the R community? I suspect the answer is no, but cannot say anything for
 sure at this point.

 The registry analysis tool looks like it is custom software developed by
 the Air Force. I can't get any specific information beyond that. That is
 unfortunate, since it would be nice if the tests could be duplicated and
 confirmed.

 We will get separate tests on R without RStudio.

 The registry analysis reports results in two sections: Registry entries
 added and registry entries modified. There were no vulnerabilities found
 in the entries modified section. All of the vulnerabilities are listed
 under entries added.

 I will let you know if I find out anything else. Certainly the isolated
 test of the R software without RStudio will be of interest.

 Thank you all or your comments,

 Paul Martin

 On 5/9/2012 10:00 AM, Barry Rowlingson wrote:
 Someone said:
 Once R is accepted, you could ask for an RStudio test if you want.
   I had another thought shortly after my initial email. Suppose yes, R
 is accepted. Great. You run R.

   Then you think, Oh, I need ggplot2 (yes you do). Do you then have
 to get security clearance for every package you want to download from
 CRAN?

 Barry


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


__
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] Matrix heatmap

2012-05-09 Thread fjucks
http://r.789695.n4.nabble.com/file/n4621356/Captura_de_tela-13.png 

The heat map generated the correct result:

library(gplots)
arq -read.table(l)
matrix_l -data.matrix(arq)
my.colors -
colorRampPalette(c(gray0,gray10,gray20,gray30,gray40,gray50,gray60,gray80,gray90,gray100))
heatmap.2(matrix_l,dendrogram=none, Rowv=NA, Colv=NA, col=my.colors(256)) 

--

Now I have the following file with 5 data, similar to the above:

RF2 RF00013 RF00100 RF00381 RF00434 RF00453 RF00165 RF00496 RF00497
RF00014 RF00048 RF00234 RF00163 RF8 RF00094 RF00032 RF00028 RF00216
RF00487 RF00209 RF00465 RF00485 RF00363 RF00366
RF2 63  7   5   7   17  12  14  5   23  
3   56  14  72  84  15  64  20  0   1   
8   6   65  3   4
RF00013 45  7   4   6   17  12  14  5   23  
3   56  12  60  84  15  64  20  0   0   
2   2   65  3   4
RF00100 22  1   5   3   2   9   0   0   0   
0   5   0   16  8   1   0   0   0   0   
0   0   26  2   3
RF00381 63  7   5   13  17  11  3   5   18  
3   56  14  33  12  2   15  4   18  12  
25  11  69  3   4
RF00434 2   0   0   3   17  11  14  5   23  
3   55  12  59  84  15  64  20  0   0   
0   0   40  1   3
RF00453 3   1   0   2   16  12  13  3   7   
0   45  12  42  78  15  53  20  0   0   
0   0   33  2   0
RF00165 0   0   0   2   10  1   14  1   7   
0   44  12  38  68  13  48  20  0   0   
0   0   18  0   0
RF00496 0   0   0   0   0   0   1   5   6   
0   0   0   4   2   0   0   0   0   0   
0   0   0   0   0
RF00497 0   0   0   3   10  0   12  5   23  
3   40  8   37  77  15  64  20  0   0   
0   0   20  0   0
RF00014 0   0   0   0   0   0   0   0   8   
3   6   0   0   0   0   0   0   0   0   
0   0   0   0   0
RF00048 3   1   0   3   17  10  14  5   23  
3   56  12  59  83  15  64  20  0   0   
0   0   52  3   3
RF00234 62  7   5   6   17  12  14  5   23  
3   56  14  70  84  15  64  20  0   0   
0   1   65  3   4
RF00163 63  7   5   7   17  12  14  5   23  
3   56  14  75  84  15  64  21  6   1   
10  9   65  3   4
RF8 3   1   0   3   17  12  14  5   23  
3   56  12  58  84  15  64  20  0   0   
0   0   52  3   2
RF00094 0   0   0   0   0   1   11  0   1   
0   0   0   34  73  15  49  20  0   0   
0   0   12  0   0
RF00032 0   0   0   3   10  1   14  5   23  
3   56  12  43  80  15  64  20  0   0   
0   0   21  0   0
RF00028 63  7   5   13  17  12  14  5   23  
3   56  14  75  84  15  64  30  23  14  
25  20  85  3   4
RF00216 63  7   5   13  17  12  14  5   23  
3   56  14  75  84  15  64  28  23  14  
25  20  85  3   4
RF00487 63  7   5   13  17  12  14  5   23  
3   56  14  75  84  15  64  28  20  14  
25  16  83  3   4
RF00209 50  7   5   3   2   2   0   0   0   
0   1   2   26  4   0   0   1   0   8   
25  5   28  3   3
RF00465 59  7   5   10  7   11  0   0   10  
3   11  2   32  9   1   3   6   15  5   
14  20  63  3   4
RF00485 63  7   5   13  17  12  14  5   23  
3   56  14  75  84  15  64  26  17  14  
25  19  85  3   4
RF00363 5   3   0   3  

Re: [R] Matrix heatmap

2012-05-09 Thread fjucks
I think it worked here, the data of 25 families are wrong, I'll pack up and
post already! earned

--
View this message in context: 
http://r.789695.n4.nabble.com/Matrix-heatmap-tp4619084p4621364.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to import .accda database into R

2012-05-09 Thread Greg Snow
The phrase doesn't work does not do much to help us help you, see:
https://stat.ethz.ch/pipermail/r-help/2012-April/311074.html

Also if you don't tell us what you have tried (and how the results
differed from what you want) then we have no way of knowing if you
have already tried our first suggestions or not.

My guess is that your file was created using MS Access, if that is the
case then I would use the RODBC package.

On Wed, May 9, 2012 at 1:38 AM, Tammy Ma metal_lical...@live.com wrote:

 Dear R user:

 How to import .accda database into R?

 I have tried many ways, still doesn't work. Thanks in advance.

 Kind regards,
 Tammy

        [[alternative HTML version deleted]]

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



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

__
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 apply functions across columns?

2012-05-09 Thread Robert Latest
On Wed, May 9, 2012 at 4:19 PM, R. Michael Weylandt
michael.weyla...@gmail.com wrote:
 Good reproducible example ;-)

 Easiest is probably just:

 cbind(tencor, ThisRowMean =  rowMeans(tencor[, 4:8]))

Actually, after frying my brain on tapply() and sapply() I found that
just plain apply() does what I need:

tencor$mean - apply(tencor[4:8], 1, FUN=mean)

This way I'm also not tied to just mean() as aggregator but can use
any homemade function (this would have been my followup question had I
followed your advice ;-)

Thanks!
robert

__
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 apply functions across columns?

2012-05-09 Thread R. Michael Weylandt
Indeed, apply is very flexible and idiomatically R (i.e., the right
way to do it) -- but, just a heads up, for datasets with many
rows/columns rowMeans and colMeans will be *much* faster (there's loop
overhead in the apply family)

Best,
Michael

On Wed, May 9, 2012 at 3:46 PM, Robert Latest boblat...@gmail.com wrote:
 On Wed, May 9, 2012 at 4:19 PM, R. Michael Weylandt
 michael.weyla...@gmail.com wrote:
 Good reproducible example ;-)

 Easiest is probably just:

 cbind(tencor, ThisRowMean =  rowMeans(tencor[, 4:8]))

 Actually, after frying my brain on tapply() and sapply() I found that
 just plain apply() does what I need:

 tencor$mean - apply(tencor[4:8], 1, FUN=mean)

 This way I'm also not tied to just mean() as aggregator but can use
 any homemade function (this would have been my followup question had I
 followed your advice ;-)

 Thanks!
 robert

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

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


Re: [R] Matrix heatmap

2012-05-09 Thread fjucks
last doubts, how do I remove these trace that sits on top of colors?

--
View this message in context: 
http://r.789695.n4.nabble.com/Matrix-heatmap-tp4619084p4621466.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Matrix heatmap

2012-05-09 Thread fjucks
as was follows:

library(gplots)
arq -read.table(r)
matrix_l -data.matrix(arq)
pdf(heatmap.pdf, height = 10 , width=10)

#paleta de 10 cores - sentido branco - preto
my.colors -
colorRampPalette(c(gray100,gray90,gray80,gray70,gray60,gray50,gray40,gray30,gray20,gray10))
heatmap.2(matrix_l,dendrogram=none,trace=none,Rowv=NA, Colv=NA,
col=my.colors(10),margins=c(5,10))

I would like to know how to create a graph that shows what appeared since
over the other, for example, that the matrix h:

   RF00013  RF00014  RF00465  RF00363  RF00366  RF00364  RF00035 
RF00492  RF00494  RF00502
RF00013100.00   100.00   100.00   100.00   100.00   100.00   33.33   
71.43100.00   100.00
RF00014100.00   100.00   100.00   100.00   100.00   100.00   100.00  
100.00   100.00   100.00
RF004650.00 66.67100.00   100.00   100.00   100.00   33.33   
0.00 50.00100.00
RF003630.00 0.00 95.00100.00   75.0075.0033.33   
0.00 0.00 50.00
RF003660.00 0.00 0.00 33.33100.00   100.00   16.67   
0.00 0.00 0.00
RF003640.00 0.00 35.000.00 75.00100.00   33.33   
0.00 0.00 0.00
RF000350.00 66.6735.000.00 0.00 37.50100.00  
28.5725.0050.00
RF0049271.4366.67100.00   100.00   100.00   100.00   100.00  
100.00   100.00   100.00
RF004940.00 66.67100.00   100.00   100.00   100.00   100.00  
71.43100.00   100.00
RF005020.00 0.00 90.0066.670.00 75.0033.33   
0.00 25.00100.00


I would like to know how to create a graph that shows what appeared since
over the other, for example, that the matrix h:

looking visually see that the family that came over the other was the
RF00366 as represent this using R?



, u

--
View this message in context: 
http://r.789695.n4.nabble.com/Matrix-heatmap-tp4619084p4621593.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Sweave, beamer and alert within code chunks

2012-05-09 Thread Giovanni Petris

Hi all,

Using Beamer, in order to highlight a piece of R code I do something
like this - note the \structure and \alert commands:

\begin{semiverbatim}
 mleOut - \structure{dlmMLE}(Nile,
+  parm = c(0.2, 120), # initial values for optimizer
+  lower = c(1e-7, 0)) \alert2{# V must be positive}
 mleOut$convergence  \alert3{# always check this!!!}
[1] 0
\end{semiverbatim}

How can I get a similar effect using Sweave?

Thank you in advance!

Best,
Giovanni Petris


-- 

Giovanni Petris  gpet...@uark.edu
Associate Professor
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
http://definetti.uark.edu/~gpetris/

__
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] the degrees of freedom in rtmvt {tmvtnorm}

2012-05-09 Thread Jun Shen
Dear list,

I would like to do some simulation with a truncated multivariate
t-distribution. I found rtmvt in package tmvtnorm.  I am not sure how to
specify the degrees of freedom parameter. I estimated the mean vector (with
6 elements) and covariance matrix (6 X 6) from a dataset with 46 subjects.
Now I want to simulate 100 subjects. So the degrees of freedom should be
46-6=40 or 100-6=94 or some other value? Thanks a lot.

Jun Shen
Seventh Wave Labs

[[alternative HTML version deleted]]

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


Re: [R] Dotchart showing mean and median by group

2012-05-09 Thread Tal Galili
Hello dear Gabor,

First - thank you for this solution!

Second - I see that the text that is added around the axes is a tiny bit
shifted - causing a slight blur of the text.  Does it happen only on
Windows?  Can it be fixed?



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 9, 2012 at 4:20 PM, Gabor Grothendieck
ggrothendi...@gmail.comwrote:

 On Wed, May 9, 2012 at 3:25 AM, maxbre mbres...@arpa.veneto.it wrote:
  Given this example
 
  mean.values-colMeans(VADeaths)
 
  mean.values-apply(VADeaths, 2, mean)
  median.values-apply(VADeaths, 2, median)
 
  dotchart(VADeaths, gdata=mean.values)
  dotchart(VADeaths, gdata=median.values)
 
  is it possible to “combine” a single dotchart showing both the mean and
 the
  median for each single group (with different plotting symbols)?
 

 Try this:

 dotchart(VADeaths, gdata=mean.values)
 par(new = TRUE)
 dotchart(VADeaths, gdata=median.values, gpch = 20)

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

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


[[alternative HTML version deleted]]

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


[R] Failed Convergence when using mi to generate synthetic data

2012-05-09 Thread Rob James
I was hoping to use mi to generate a synthetic version of a database.  The
strategy (see code below) was simple: use the diamonds dataset from
ggplot2,  subset it focus on  3K single-color, then create a blank record
for every real record, and throw the new dataset at mi to see if it would
populate the blank records.  I kept getting failed convergence.

I think I have simplified the dataset down to the point where either I am
doing it wrong or something is wrong (conceptually) with what I am doing. I
would welcome suggestions:

library(ggplot2)
library(mi)
data(diamonds)
#use only 2800 or so observations!
diamonds1 -subset(diamonds, color==J)
rm(diamonds)
#simplify the data structure
diamonds1 -subset(diamonds1, select=-c(x, z, y, cut, clarity, depth,
table))
str(diamonds1)

#generate a blank table

emptydiamonds1 -diamonds1
for(j in 1:dim(diamonds1)[2]) {
emptydiamonds1[,j] - NA
 }

#throw up a dummy variable for imputation
diamonds1$impute=0
emptydiamonds1$impute=1

#package the two into one dataset

d2 -rbind(diamonds1, emptydiamonds1)
str(d2)

#run in.info
miinfo -mi.info(d2)

#pre_process
mi_pre -mi.preprocess(d2)

#impute

Imp1 -mi(mi_pre, n.iter=49)

[[alternative HTML version deleted]]

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


[R] reception of (Vegan) envfit analysis by manuscript reviewers

2012-05-09 Thread Matt Bakker
I'm getting lots of grief from reviewers about figures generated with
the envfit function in the Vegan package. Has anyone else struggled to
effectively explain this analysis? If so, can you share any helpful
tips?

The most recent comment I've gotten back: What this shows is which
NMDS axis separates the communities, not the relationship between the
edaphic factor and the Bray-Curtis distance.

Thanks for any suggestions!


Matt

__
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] Problem with SQLDF - Error in sqliteExecStatement(con, statement, bind.data) : RS-DBI driver: (error in statement: no such table:

2012-05-09 Thread Shivam
Hi All,

I am having trouble executing SQL statements on a few dataframes, but the
funny thing is that I am able to execute the statement on some other
dataframes.

To test, I have 2 very small dataframes (6 rows and some columns). One is
'lessliq', the dput is given below.

 dput(head(lessliq))
structure(list(V1 = c(50464677L, 50464846L, 50432581L, 50426614L,
50504329L, 50504735L), V2 = c(TATASTEEL, TATASTEEL, TATASTEEL,
TATASTEEL, TATASTEEL, TATASTEEL), V3 = c(OPTSTK, OPTSTK,
OPTSTK, OPTSTK, OPTSTK, OPTSTK), V4 = structure(c(15029,
15029, 15029, 15029, 15029, 15029), class = Date), V5 = c(CE,
CE, CE, CE, CE, CE), V6 = c(0L, 0L, 0L, 0L, 0L, 0L),
V7 = c(700, 700, 700, 700, 700, 700), V8 = c(14:15:45,
14:15:51, 13:51:12, 13:45:13, 14:39:53, 14:40:08
), V9 = c(37, 37, 37.75, 37, 37.5, 37.5), V10 = c(500L, 500L,
500L, 500L, 2000L, 500L), V11 = structure(c(14977, 14977,
14977, 14977, 14977, 14977), class = Date), V12 = c(52,
52, 52, 52, 52, 52)), .Names = c(V1, V2, V3, V4,
V5, V6, V7, V8, V9, V10, V11, V12), row.names = c(NA,
6L), class = data.frame)

I run the below command:

 new2 = sqldf(select * from lessliq)
This works fine.

But on many other dataframes it is not working. I have a dataframe
'testeq'. dput given below:

 dput(head(testeq))
structure(list(NAME = c(DLF, DLF, DLF, DLF, DLF, DLF
), TMSTMP = c(09:07:07, 09:15:03, 09:15:03, 09:15:03,
09:15:03, 09:15:04), PRICE = c(295, 294.5, 293.9, 294.9,
295, 294.5), DATE = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label =
c(2011-01-03,
2011-01-04, 2011-01-05, 2011-01-06, 2011-01-07, 2011-01-10,
2011-01-11, 2011-01-12, 2011-01-13, 2011-01-14, 2011-01-17,
2011-01-18, 2011-01-19, 2011-01-20, 2011-01-21, 2011-01-24,
2011-01-25, 2011-01-27, 2011-01-28, 2011-01-31, 2011-02-01,
2011-02-02, 2011-02-03, 2011-02-04, 2011-02-07, 2011-02-08,
2011-02-09, 2011-02-10, 2011-02-11, 2011-02-14, 2011-02-15,
2011-02-16, 2011-02-17, 2011-02-18, 2011-02-21, 2011-02-22,
2011-02-23, 2011-02-24, 2011-02-25, 2011-02-28, 2011-03-01,
2011-03-03, 2011-03-04, 2011-03-07, 2011-03-08, 2011-03-09,
2011-03-10, 2011-03-11, 2011-03-14, 2011-03-15, 2011-03-16,
2011-03-17, 2011-03-18, 2011-03-21, 2011-03-22, 2011-03-23,
2011-03-24, 2011-03-25, 2011-03-28, 2011-03-29, 2011-03-30,
2011-03-31, 2011-04-01, 2011-04-04, 2011-04-05, 2011-04-06,
2011-04-07, 2011-04-08, 2011-04-11, 2011-04-13, 2011-04-15,
2011-04-18, 2011-04-19, 2011-04-20, 2011-04-21, 2011-04-25,
2011-04-26, 2011-04-27, 2011-04-28, 2011-04-29, 2011-05-02,
2011-05-03, 2011-05-04, 2011-05-05, 2011-05-06, 2011-05-09,
2011-05-10, 2011-05-11, 2011-05-12, 2011-05-13, 2011-05-16,
2011-05-17, 2011-05-18, 2011-05-19, 2011-05-20, 2011-05-23,
2011-05-24, 2011-05-25, 2011-05-26, 2011-05-27, 2011-05-30,
2011-05-31, 2011-06-01, 2011-06-02, 2011-06-03, 2011-06-06,
2011-06-07, 2011-06-08, 2011-06-09, 2011-06-10, 2011-06-13,
2011-06-14, 2011-06-15, 2011-06-16, 2011-06-17, 2011-06-20,
2011-06-21, 2011-06-22, 2011-06-23, 2011-06-24, 2011-06-27,
2011-06-28, 2011-06-29, 2011-06-30), class = factor),
DTTM = structure(list(sec = c(7, 3, 3, 3, 3, 4), min = c(7L,
15L, 15L, 15L, 15L, 15L), hour = c(9L, 9L, 9L, 9L, 9L, 9L
), mday = c(3L, 3L, 3L, 3L, 3L, 3L), mon = c(0L, 0L, 0L,
0L, 0L, 0L), year = c(111L, 111L, 111L, 111L, 111L, 111L),
wday = c(1L, 1L, 1L, 1L, 1L, 1L), yday = c(2L, 2L, 2L,
2L, 2L, 2L), isdst = c(0L, 0L, 0L, 0L, 0L, 0L)), .Names = c(sec,
min, hour, mday, mon, year, wday, yday, isdst
), class = c(POSIXlt, POSIXt))), .Names = c(NAME, TMSTMP,
PRICE, DATE, DTTM), row.names = c(NA, 6L), class = data.frame)

I run the above command again but this time I get an error:

 new3 = sqldf(select * from testeq)
Error in sqliteExecStatement(con, statement, bind.data) :
  RS-DBI driver: (error in statement: no such table: testeq)
In addition: Warning message:
In value[[3L]](cond) : RAW() can only be applied to a 'raw', not a 'double'

Can anyone guide me if there is any difference in the structure of the two
dataframes or what else can be the issue?

Thanks in advance,

Regards,
Shivam Singh

[[alternative HTML version deleted]]

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


Re: [R] Sweave, beamer and alert within code chunks

2012-05-09 Thread Yihui Xie
Syntax highlighting is easy with the highlight package, on which the
knitr package is based, e.g.

- sample source: https://gist.github.com/1803930
- sample pdf: https://github.com/downloads/yihui/knitr/knitr-beamer.pdf

It is possible to insert \alert{} with knitr, but you have to provide
the logic: where do you want to insert them? use \alert{} on all
comments?

Anyway, here is a demo:

- source: https://gist.github.com/2629886#file_knitr_alert.rnw
- output: https://github.com/downloads/yihui/knitr/knitr-alert.pdf

The knitr hooks allows you to wrestle with R code and output in any
way you want, and you may need one hour or two learning the design.

BTW, I'm not sure if it is my problem or yours -- your code does not
actually run under my R 2.15.0. Long live the reproducible research!

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Wed, May 9, 2012 at 4:13 PM, Giovanni Petris gpet...@uark.edu wrote:

 Hi all,

 Using Beamer, in order to highlight a piece of R code I do something
 like this - note the \structure and \alert commands:

 \begin{semiverbatim}
 mleOut - \structure{dlmMLE}(Nile,
 +                  parm = c(0.2, 120), # initial values for optimizer
 +                  lower = c(1e-7, 0)) \alert2{# V must be positive}
 mleOut$convergence  \alert3{# always check this!!!}
 [1] 0
 \end{semiverbatim}

 How can I get a similar effect using Sweave?

 Thank you in advance!

 Best,
 Giovanni Petris


 --

 Giovanni Petris  gpet...@uark.edu
 Associate Professor
 Department of Mathematical Sciences
 University of Arkansas - Fayetteville, AR 72701
 Ph: (479) 575-6324, 575-8630 (fax)
 http://definetti.uark.edu/~gpetris/


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


  1   2   >