Re: [R] Error with Source()

2011-11-13 Thread Mario Valle

Normally is a missing comma in a function command list.
Ciao!
mario

On 10-Nov-11 19:02, jim holtman wrote:

You have a syntax error in your script.  Take a look around line 884

On Thu, Nov 10, 2011 at 9:27 AM, ftoninif_ton...@hotmail.com  wrote:

Hi everybody,

I started to receive a weird message in R that I have never seen
before...also I haven't found anything on google or on this forum about it.
Whenever I use the command source(...) to point to one of my scripts, I get
the following message:

Error in source(myfunctions.R) : myfunctions.R:884:9: unexpected symbol
883:
884: cond
 ^

I am using the same commands as I did in the past and it was working...I
started to receive this error (not sure if it has to do with it or not)
after trying to create a batch file to run one of my .R scripts with
double-click. That batch file worked...but as soon as I use the source()
command it does not work any more.

Any help is appreciated!

Thanks
Francesco

--
View this message in context: 
http://r.789695.n4.nabble.com/Error-with-Source-tp4023794p4023794.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.






--
Ing. Mario Valle
Data Analysis and Visualization Group| http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)  | Tel:  +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82

__
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] proportional area venn diagrams?

2011-11-13 Thread Jim Lemon

On 11/12/2011 01:26 AM, Michael Friendly wrote:


In http://finzi.psych.upenn.edu/R/Rhelp02a/archive/14637.html

some rudimentary R functions were given for drawing
proportional area venn diagrams with area of each intersection ~ the
count in a 2 x 2 x 2 table.

I'm interested in this, for another application: showing the
correlations among Y, X1, X2 using
area ~ r^2 of each pair (sometimes called a Ballantine diagram).

Before I attempt to hack the code given in that post, are there any
packages/functions that do venn diagrams
with proportional areas? Rseek turned up quite a view venn-like
functions, but I couldn't find any
that drew them with proportional areas.


Hi Michael,
The intersectDiagram function (plotrix) does not draw a Venn diagram, 
but it does display areas proportional to the number of elements in each 
intersection. It can also do partial diagrams using the new include 
argument once the original diagram has been displayed, allowing the user 
to explore the effect of removing sets or attributes from the diagram.


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] Second-order effect in Parametric Survival Analysis

2011-11-13 Thread David Winsemius


On Nov 13, 2011, at 12:51 AM, ryusuke wrote:


Thank you Dr. David.

I try to summarize it.
Assumes x and z are two covariates:
x = dummy variable (1 or 0)
z = factors (people name)

x*z = x + z + x*z


Actually I said = x + z + x:z

And interaction formula of a two level dummy with a multi-level factor  
would produce and intercept (which would be for the first person's  
name), a coefficient for each of other names at level zero, a dummy  
coefficient (for the first person), and interaction coefficients of  
each person at the 1-level.



therefore this is not a 2nd-order interactions, it should be (for an
exponential survival regression):-
h(t|(X=x,Z=z)) = exp(Beta0 + XZBeta1)


If Beta1 is not a vector in this instance, with a distinct value for  
each(x,z) pairing, then I am unable to make sense out of that model.  
The questin remains however whether you are also expecting Beta0 to  
also be distinct for each specific combination of covariates.



#---

I believe there is no 2nd-order interactions survival regression as I
searched over www.rseek.org. While I tried to read through the codes  
of

survreg(), I stuck (cannot understand) at survreg6.c

survreg6.c apply C Language which involves Cholesky decomposition
multi-matrix (first-order interactions) calculation.
1) chinv2.c
2) cholesky3.c
3) chsolve2.c (only solve the equations of first-order interactions)


That level of implementation should be addressed to a person with  
higher levels of knowledge: Therneau or Lumley are the two names that  
immediately come to mind.




If someone gives some idea or suggestion on these?
Thank you.


Best,
Ryusuke


--
View this message in context: 
http://r.789695.n4.nabble.com/Second-order-effect-in-Parametric-Survival-Analysis-tp4034318p4036005.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.


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] identify duplicate from more than one column

2011-11-13 Thread David Winsemius


On Nov 13, 2011, at 1:19 AM, Joshua Wiley wrote:


Hi Carlos,

Here is one option:

## read in your data
dat - read.table(textConnection(
obs unithome   zsex age
1   015029  18 11   053
2   015029  18 12   049
3   015029  01 11   038
4   015029  01 12   033
5   015029  02 11   036
6   015029  02 12   033
7   015029  03 11   023
8   015029  03 12   019
9   015029  04 12   045
10  015029  05 12   047),
 header = TRUE, stringsAsFactors = FALSE)
closeAllConnections()

## create a unique ID for matching unit and home


I would have used the 'interaction' function. And I would have read  
the data in with colClasses to preserve the labeling of the household  
information:


 dat - read.table(textConnection(
+ obs unithome   zsex age
+ 1   015029  18 11   053
+ 2   015029  18 12   049
+ 3   015029  01 11   038
+ 4   015029  01 12   033
+ 5   015029  02 11   036
+ 6   015029  02 12   033
+ 7   015029  03 11   023
+ 8   015029  03 12   019
+ 9   015029  04 12   045
+ 10  015029  05 12   047),
+  header = TRUE, stringsAsFactors = FALSE, colClasses=c(rep(factor,  
4), numeric))

 closeAllConnections()

 ## create a unique ID for matching unit and home
 dat
   obs   unit home z sex age
11 015029   18 1   1 053
22 015029   18 1   2 049
33 015029   01 1   1 038
44 015029   01 1   2 033
55 015029   02 1   1 036
66 015029   02 1   2 033
77 015029   03 1   1 023
88 015029   03 1   2 019
99 015029   04 1   2 045
10  10 015029   05 1   2 047
 dat$together - with(dat, interaction(unit, home) )
 dat$togeth.n - as.numeric(dat$together)
 dat
   obs   unit home z sex age  together togeth.n
11 015029   18 1   1 053 015029.186
22 015029   18 1   2 049 015029.186
33 015029   01 1   1 038 015029.011
44 015029   01 1   2 033 015029.011
55 015029   02 1   1 036 015029.022
66 015029   02 1   2 033 015029.022
77 015029   03 1   1 023 015029.033
88 015029   03 1   2 019 015029.033
99 015029   04 1   2 045 015029.044
10  10 015029   05 1   2 047 015029.055

I'm assuming that the numbering of the unit/household pairings is  
somewhat arbitrary. The I would set to missing all of the non-couple  
households:


 is.na(dat$togett.n) - !as.logical( ave(dat$sex, dat$together,  
FUN=function(x) 1 %in% x  2 %in% x) )

 dat
   obs   unit home z sex age  together togett.n
11 015029   18 1   1 053 015029.186
22 015029   18 1   2 049 015029.186
33 015029   01 1   1 038 015029.011
44 015029   01 1   2 033 015029.011
55 015029   02 1   1 036 015029.022
66 015029   02 1   2 033 015029.022
77 015029   03 1   1 023 015029.033
88 015029   03 1   2 019 015029.033
99 015029   04 1   2 045 015029.04   NA
10  10 015029   05 1   2 047 015029.05   NA

I actually think it would be better to use the fully labeled  
together variable rather than the numeric version. It retains its  
data heritage better.


--
David.



dat$mID - with(dat, paste(unit, home, sep = ''))

## somewhat messy way of creating a couple number
## for each mID, if there is more than 1 row, and more than 1 sex
## it creates a couple id, otherwise 0
i - 0L
dat$couple - with(dat, unlist(lapply(split(sex, mID), function(x) {
 i - i + 1L
 if (length(x)  1  length(unique(x))  1) {
   rep(i, length(x))
 } else 0L
})))

## view results
dat
  obs  unit home z sex age mID couple
11 15029   18 1   1  53 1502918  1
22 15029   18 1   2  49 1502918  1
33 150291 1   1  38  150291  2
44 150291 1   2  33  150291  2
55 150292 1   1  36  150292  3
66 150292 1   2  33  150292  3
77 150293 1   1  23  150293  4
88 150293 1   2  19  150293  4
99 150294 1   2  45  150294  0
10  10 150295 1   2  47  150295  0

See these functions for more details:

?ave # where I got my idea
?split
?lapply
?`-`

Cheers,

Josh

On Sat, Nov 12, 2011 at 8:16 PM, jour4life jour4l...@gmail.com  
wrote:

Hi all,

I've searched everywhere to try to find out how to do this and have  
had no

luck. I am trying to construct identifiers for couples in a dataset.
Essentially, I want to identify couples using more than one column as
identifiers. Take for instance:

obs 

Re: [R] LOESS function Newton optimization

2011-11-13 Thread David Winsemius


On Jul 12, 2011, at 7:53 PM, KenjiPsyD wrote:

I have a question about running an optimization function on an  
existing LOESS
function defined in R. I have a very large dataset (1 million  
observations)

and have run a LOESS regression. Now, I want to run a Newton-Raphson
optimization to determine the point at which the slope change is the
greatest.

I am relatively new to R and have tried several permutations of the  
maxNR
and nlm functions with no success. For example, I used the nlm  
function as

follows:

LOESS - loess(Y ~ X)
optim - nlm(function(x) LOESS(x))...


I don't see how that would be examining slopes.



However, this doesn't seem to work. In the examples I see online, the
function in nlm and maxNR are user defined, instead of the output of  
another

function (i.e., my LOESS regression).

Is it possible to run this type of optimization function on my Loess
function?


 cars.lo - loess(dist ~ speed, cars)
 is.function( cars.lo)
[1] FALSE

If you want to make it a function, there is approxfun in the stats  
package.


car.fun - approxfun(x=cars.lo$x, cars.lo$fitted)
plot(dist~speed, data=cars)
curve(car.fun, add=TRUE)

Some functions require that a function be offered that takes x as its  
argument.


 car.fun(x=5)
Error in car.fun(x = 5) : unused argument(s) (x = 5)

If that is the case with your optimization routine then you can create  
one with:


 car.funx - function(x) car.fun(x)
 car.funx(x=5)
[1] 8.095681

--

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] dev.new() within a loop

2011-11-13 Thread Giovanni Azua
Hello David,

On Nov 13, 2011, at 5:20 AM, David Winsemius wrote:
 However, when executing plot_raw which invokes dev.new(..) all windows come 
 out blank whereas if I execute each file outside of a loop then I can see 
 the plots properly.
 
 Perhaps ...(you did not say what package this plot_raw function comes from) 
 ...  Read the FAQ about why lattice plot don't print. (It applies to all grid 
 based plotting functions.)
 
plot_raw is my own function which just calls ggplot2. So basically I am not 
using Lattice.

What can I do differently to avoid the new windows coming back empty?

Thanks in advance,
Best regards,
Giovanni

plot_raw - function(data,connect=TRUE,y_break=500,y_top=-1,label=) {
dev.new()
title - paste(label, sep=)
if (y_top == -1) {
y_top - max(data$Y)
}

if (!decouple) {
# add fake group
data$Workload - 'All'
}

p - 
ggplot(data,aes(x=Time,y=Y,group=Workload,shape=Workload,colour=Workload)) + 
geom_point(fill=white, size=3) + 
scale_y_continuous(breaks=seq(0,max(data$Y),y_break), limits=c(0, y_top)) +  
scale_y_continuous(breaks=seq(0,y_limit_top(data$Y,data$se), 
y_break_step(data$Y,data$se)), 
limits=c(0, y_limit_top(data$Y,data$se))) + 
opts(title=title) + theme_bw() +
scale_x_continuous(breaks=data$Time, labels=as.character(data$Time))
 

if (connect) {
p + geom_line()
} else {
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] Error in drawing

2011-11-13 Thread Guy Nason
Dear all,

Thanks. I will add it to my list. Sincerely, Guy Nason

On 10 Nov 2011, at 04:34, R. Michael Weylandt wrote:

 It's not a problem with your data or use of the functions -- rather I
 think there's just a little bug in the package (and I've cc'd the
 maintainer):
 
 draw.wd leads to a call of draw.default(type = l) which in turn
 leads to plot(type = l). However, since draw.default doesn't have a
 type argument, it gets taken as part of the special ... operator which
 leads to a conflict when it runs into the other type = l in
 plot.default that comes from plot(type = l) in draw.default (I hope
 that's clear -- the problem is that at the end of the stack,
 plot.default gets handed type = l twice).
 
 For now, you can add this code to your script before you use draw and
 it should be fine.
 
 draw.wd - function (wd, ...)
 {
if (IsEarly(wd)) {
ConvertMessage()
stop()
}
filter - wd$filter
draw.default(filter.number = filter$filter.number, family =
 filter$family,  ...)
 }
 
 Hopefully the maintainer can let us know if I've missed something or
 can make a change in the package (it shouldn't be too hard).
 
 Michael
 
 On Wed, Nov 9, 2011 at 9:53 PM, Gyanendra Pokharel
 gyanendra.pokha...@gmail.com wrote:
 I am sorry Michael, the data lidar is in the pacakge SemiPar.
 
 On Wed, Nov 9, 2011 at 9:46 PM, Gyanendra Pokharel
 gyanendra.pokha...@gmail.com wrote:
 
 lidar data is in the package faraway
 
 On Wed, Nov 9, 2011 at 8:50 PM, R. Michael Weylandt
 michael.weyla...@gmail.com wrote:
 
 Your code is not reproducible. Where is the lidar data coming from?
 
 Michael
 
 On Wed, Nov 9, 2011 at 2:29 PM, Gyanendra Pokharel
 gyanendra.pokha...@gmail.com wrote:
  I have got following error in drawing wavelet fitting. can some one
 help?
 
 library(faraway)
 data(lidar)
 newlidar-lidar[c(1:128),]
 library(wavethresh)
 wds - wd(newlidar$logratio)
 draw(wds)
 Error in plot.default(x = x, y = zwr, main = main, sub = sub, xlab =
 xlab,
 :
  formal argument type matched by multiple actual arguments
 
[[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.
 
 
 
 



--
Professor Guy Nason
Head of School
School of Mathematics  
University of Bristol
http://www.stats.bris.ac.uk/~magpn


PA: Helen Craven
helen.cra...@bristol.ac.uk, +44 (0) 117 928 7978







[[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] Indirect references

2011-11-13 Thread Back2Numbers

Hi All,

I would like to work with symbols referenced by strings: I would like to 
manipulate data/symbols referencing to them by the string name of the 
symbol.


An example will be clearer. Let's I get a time series through quantmod

 getSymbols(GLD)

This will create a new symbol GLD with the relevant data. I have tried 
to rename the column names as follows:


 colnames(get(GLD)) - c(open, close, low, high, volume, 
adjusted)


will give the following error:

Error in colnames(GLD)- c(open, close, low, high, volume,  :
  target of assignment expands to non-language object


I am confused as to how to do this.

(the intent of this is to maintain a list of tickers in string format 
and loop through them at ease to do whatever treatment)



Thanks for your help,

Emmanuel

__
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] dev.new() within a loop {SOLVED]

2011-11-13 Thread David Winsemius
In a private communication this poster has indicated that he  
eventually found the answer by Googling the question. (The solution  
was as described in the FAQ.)


--
David.


On Nov 13, 2011, at 5:21 AM, Giovanni Azua wrote:


Hello David,

On Nov 13, 2011, at 5:20 AM, David Winsemius wrote:
However, when executing plot_raw which invokes dev.new(..) all  
windows come out blank whereas if I execute each file outside of a  
loop then I can see the plots properly.


Perhaps ...(you did not say what package this plot_raw function  
comes from) ...  Read the FAQ about why lattice plot don't print.  
(It applies to all grid based plotting functions.)


plot_raw is my own function which just calls ggplot2. So basically I  
am not using Lattice.


What can I do differently to avoid the new windows coming back empty?

Thanks in advance,
Best regards,
Giovanni

plot_raw -  
function(data,connect=TRUE,y_break=500,y_top=-1,label=) {

dev.new()
title - paste(label, sep=)
if (y_top == -1) {
y_top - max(data$Y) 
}

if (!decouple) {
# add fake group
data$Workload - 'All'
}

	p -  
ggplot 
(data,aes(x=Time,y=Y,group=Workload,shape=Workload,colour=Workload)) +
		geom_point(fill=white, size=3) +  
scale_y_continuous(breaks=seq(0,max(data$Y),y_break), limits=c(0,  
y_top)) + 	
		scale_y_continuous(breaks=seq(0,y_limit_top(data$Y,data$se),  
y_break_step(data$Y,data$se)),

limits=c(0, y_limit_top(data$Y,data$se))) +
opts(title=title) + theme_bw() +
   	scale_x_continuous(breaks=data$Time, labels=as.character(data 
$Time))		


   if (connect) {
p + geom_line()
   } else {
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.


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] 2^k experiment generator

2011-11-13 Thread Giovanni Azua
Hello,

While looking for info on 2^k experimental design and anova I remember I saw 
somewhere there was a function to generate all the experiments.  I can't find 
the function anymore can anyone suggest?

The function takes as input the factors and levels and generates all the 
experiments. I know I can do it myself using recursion but I want to avoid 1) 
reinventing the wheel and 2) making mistakes while at it.

TIA,
Best regards,
Giovanni
__
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] dev.new() within a loop

2011-11-13 Thread Giovanni Azua

On Nov 13, 2011, at 3:23 PM, David Winsemius wrote:
 Please read both my comments and the FAQ more carefully . You are 
 inadequately considering the information that has been offered to you.
 
 Ok you wanted to make sure I have to read the FAQ well I didn't have to :) 
 Googling using your suggestion found relevant matches and now it works.
 
 Where does this resistance to reading the FAQ come from?

It is not resistance, the FAQ is very helpful for basic general questions but 
it can not cover all details. Sometimes it is very hard to find a specific 
detailed answer within a general FAQ. I have read the FAQ, what makes you think 
I didn't before? I just could not find the information I was looking for.


 I had to wrap the ggplot call within a print for my loop to work which is 
 IMHO one of the most obfuscated use-cases for using print I have bumped into.
 
 It is a case of isolating the functional aspects of the plot-construction 
 process from the side-effects of interacting with a graphics device.
 
 So every user-defined function that try to plot anything has to be wrapped 
 inside a print just in case it ever gets called from within a loop
 
 That is not how I understand it. One reason is so there is an object in the 
 workspace that can be later modified. And I suspect the authors (and I am not 
 one of them)  imagined that there may be multiple steps in creation of the  
 object, not all of which should result in a plot appearing if this is being 
 done programatically. This is especially appropriate (it would seem to me) 
 for the ggplot plotting model, which adds a variety of layers to a core 
 object. It is also imagined that you may be sending this object to one of a 
 variety of devices.
 
Ok bottom line is always wrap the plot call whatever it is within a print for 
the just in case.

Cheers,
Giovanni

__
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] 2^k experiment generator

2011-11-13 Thread Bryan Hanson
Check out the Task View on Experimental Design:

http://cran.at.r-project.org/web/views/ExperimentalDesign.html

but perhaps packages rsm or qualityTools have what you want.

Bryan
***
Bryan Hanson
Professor of Chemistry  Biochemistry
DePauw University

On Nov 13, 2011, at 9:25 AM, Giovanni Azua wrote:

 Hello,
 
 While looking for info on 2^k experimental design and anova I remember I saw 
 somewhere there was a function to generate all the experiments.  I can't find 
 the function anymore can anyone suggest?
 
 The function takes as input the factors and levels and generates all the 
 experiments. I know I can do it myself using recursion but I want to avoid 1) 
 reinventing the wheel and 2) making mistakes while at it.
 
 TIA,
 Best regards,
 Giovanni
 __
 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] 2^k experiment generator

2011-11-13 Thread Giovanni Azua

Never mind, found it, it is the expand.grid function.

On Nov 13, 2011, at 3:25 PM, Giovanni Azua wrote:
 Hello,
 
 While looking for info on 2^k experimental design and anova I remember I saw 
 somewhere there was a function to generate all the experiments.  I can't find 
 the function anymore can anyone suggest?
 
 The function takes as input the factors and levels and generates all the 
 experiments. I know I can do it myself using recursion but I want to avoid 1) 
 reinventing the wheel and 2) making mistakes while at it.
 
 TIA,
 Best regards,
 Giovanni

__
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] Indirect references

2011-11-13 Thread Duncan Murdoch

On 11-11-13 8:10 AM, Back2Numbers wrote:

Hi All,

I would like to work with symbols referenced by strings: I would like to
manipulate data/symbols referencing to them by the string name of the
symbol.

An example will be clearer. Let's I get a time series through quantmod

getSymbols(GLD)

This will create a new symbol GLD with the relevant data. I have tried
to rename the column names as follows:

colnames(get(GLD))- c(open, close, low, high, volume,
adjusted)

will give the following error:

Error in colnames(GLD)- c(open, close, low, high, volume,  :
target of assignment expands to non-language object


I am confused as to how to do this.


The syntax

colnames(x) - y

is a little misleading.  It doesn't really modify the object x, it 
creates a new object then assigns it to x.  You can't assign something 
to get(GLD), so you get the error.


The easiest way to do this is not to try to do what quantmod does.  Just 
create new objects and return them from your function.  E.g.


obj - GLD
x - get(obj)
colnames(x) - c(open, close, low, high, volume, adjusted)

and now x has the names you want.

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] New PLYR issue

2011-11-13 Thread Neotropical bat risk assessments
Issue with PLYR.
Now using R 2.14 and this data and plyr command line worked with 2.13
I am also loading the same saved data that worked previously, but now 
some issue.

  library(plyr)
  UNESCO - dget('C:/Carbon-GJ/BZE_ecosys.robj')
  df2 - ddply(df, UNESCO, summarise, total_ha = sum(Ha))
*Error in if (empty(.data)) return(.data) :
   missing value where TRUE/FALSE needed*

Clueless

Ideas suggestions?
Some change in PLYR?

Bruce


[[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] issue using package sos

2011-11-13 Thread Neotropical bat risk assessments

Issue with sos package

I am now using R 2.14 and the sos package did work  with 2.13

 library(sos)
Loading required package: brew
Attaching package: 'sos'
The following object(s) are masked from 'package:JGR':
installPackages
The following object(s) are masked from 'package:utils':
 library(sos); findFn(random forest)
found 253 matches;  retrieving 13 pages
2 3 4 5 6 7 8 9 10 11 12 13
++
the first part looks as it used to int he past...but now I have the 
follow errors?


URL Error  no protocol: null/doc/html/packages.html
Click OK then another box pops up URL Error
unkonwn protocl: c
Clicked OK
Then the help window opens
Top line isted is C:\Documents~\temp\RtmpE3Letk\fileaa2
When I select the other tab packages .. it is blank.

As always clueless in Belize,


Bruce

__
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] dev.new() within a loop

2011-11-13 Thread David Winsemius


On Nov 13, 2011, at 9:35 AM, Giovanni Azua wrote:



On Nov 13, 2011, at 3:23 PM, David Winsemius wrote:
Please read both my comments and the FAQ more carefully . You are  
inadequately considering the information that has been offered to  
you.


Ok you wanted to make sure I have to read the FAQ well I didn't  
have to :) Googling using your suggestion found relevant matches  
and now it works.


Where does this resistance to reading the FAQ come from?


It is not resistance, the FAQ is very helpful for basic general  
questions but it can not cover all details. Sometimes it is very  
hard to find a specific detailed answer within a general FAQ. I have  
read the FAQ, what makes you think I didn't before? I just could not  
find the information I was looking for.


I told you which FAQ to read. It's only a few sentences. And it very  
specifically and I think clearly covers the problem you asked about. I  
do not know why you had to google it if you really did read that  
particular FAQ.




I had to wrap the ggplot call within a print for my loop to work  
which is IMHO one of the most obfuscated use-cases for using print  
I have bumped into.


It is a case of isolating the functional aspects of the plot- 
construction process from the side-effects of interacting with a  
graphics device.


So every user-defined function that try to plot anything has to be  
wrapped inside a print just in case it ever gets called from  
within a loop


That is not how I understand it. One reason is so there is an  
object in the workspace that can be later modified. And I suspect  
the authors (and I am not one of them)  imagined that there may be  
multiple steps in creation of the  object, not all of which should  
result in a plot appearing if this is being done programatically.  
This is especially appropriate (it would seem to me) for the ggplot  
plotting model, which adds a variety of layers to a core object. It  
is also imagined that you may be sending this object to one of a  
variety of devices.


Ok bottom line is always wrap the plot call whatever it is within a  
print for the just in case.


That is true when you are using grid-based graphic. It is going to  
return a NULL in the case of base graphics calls.


This is the function:

 print.ggplot
function (x, newpage = is.null(vp), vp = NULL, ...)
{
set_last_plot(x)
if (newpage)
grid.newpage()
if (is.null(vp)) {
grid.draw(ggplotGrob(x, ...))
}
else {
if (is.character(vp))
seekViewport(vp)
else pushViewport(vp)
grid.draw(ggplotGrob(x, ...))
upViewport()
}
}
environment: namespace:ggplot2


--

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] [R-pkgs] Roxygen2: version 2.2

2011-11-13 Thread Hadley Wickham
# Roxygen2

The premise of `roxygen2` is simple: describe your functions in
comments next to where their definitions and `roxygen2` will process
your source code and comments to produce R compatible Rd files.
Here's a simple example from the `stringr` package:
    #' The length of a string (in characters).    #'    #' @param
string input character vector    #' @return numeric vector giving
number of characters in each element of the     #'   character vector.
 Missing string have missing length.    #' @keywords character    #'
@seealso \code{\link{nchar}} which this function wraps    #' @export
 #' @examples    #' str_length(letters)    #' str_length(c(i,
like, programming, NA))    str_length - function(string) {
string - check_string(string)
      nc - nchar(string, allowNA = TRUE)      is.na(nc) -
is.na(string)      nc    }
When you `roxygenise` your package these comments will be
automatically transformed to the Rd file you need to pass `R CMD
check`:
    \name{str_length}    \alias{str_length}    \title{The length of a
string (in characters).}    \usage{str_length(string)}    \arguments{
    \item{string}{input character vector}    }    \description{
The length of a string (in characters).    }
\seealso{\code{\link{nchar}} which this function wraps}
\value{numeric vector giving number of characters in each element of
the    character vector.  Missing string have missing length.}
\keyword{character}    \examples{      str_length(letters)
str_length(c(i, like, programming, NA))    }
roxygen2 2.2


NEW FEATURES

* Package docType will automatically add package alias, if needed. (Fixes #4)

* Data docType will automatically add `datasets` keyword, default usage, and
  default format. (Fixes #5). Data docType automatically added to data
  objects.

* New `@encoding` tag for manually setting non-ASCII encodings when needed.
  (Fixes #7)


BUG FIXES

* `write.description()` now tries much harder to respect
  users' original DESCRIPTION field formatting instead of forcibly
  re-wrapping certain fields at 60 characters.

* `@details` and `@description` now work correctly

* `@useDynLib` now works correctly:

   @useDynLib packageName routine1 routine2

   produces

   useDynLib(packageName, routine1)
   useDynLib(packageName, routine2)

   in the NAMESPACE file, instead of separate (wrong) useDynLib statements as
   before.

* All namespace import directives now behave in the same way as the export
  directives, producing multiple single directives instead one multiple
  directive: `@importClassesFrom pkg a b` now produces
  `importClassesFrom(pkg, a)` and `importClassesFrom(pkg, b)`

* In example files included with `@example` you can now use infix operators
  (e.g. %*%) or other things with %, because they will be preceded by a
  backslash in the Rd file. This behaviour was already in place for examples
  directly included with `@examples`.

* Aliases are no longer quoted, and % is escaped with a backslash (Fixes #24).
  Names also have % escaped (Fixes #50)

* Replacement functions (e.g. `foo-`) now get correct usage statements:
  `foo() - value` instead of `foo()-value`. (Fixes #38)

* Functions with no arguments now correctly get usage statements (Fixes #35)

* Indentation in examples now preserved (Fixes #27)

* roxygen2 will replace characters that are not valid in filenames with a
  character substitute, e.g. `[]` becomes `sub`, `-` becomes `set` (Fixes #6)

* Usage strings use non-breaking spaces to prevent string default values
  containing whitespace to be split across multiple lines. This may cause
  problems in the unlikely event that you have default value containing a
  non-breaking space (`\uA0')  (Fixes #21)

* Functions with quoted names now get correct usage statements (Fixes #41)

* Objects that no longer exist are not documented (Fixes #42)

* Errors now display file name and line number of roxygen block to help you
  find the problem. Thanks to code contributions from Renaud Gaujoux. (Fixes
  #13)

* Documentation with no untagged text but with `@title`, `@description` and
  `@details` tags now produces correct output.


-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

___
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] issue using package sos

2011-11-13 Thread Ben Bolker
Neotropical bat risk assessments neotropical.bats at gmail.com writes:

 Issue with sos package
 
 I am now using R 2.14 and the sos package did work  with 2.13
 
   library(sos)
 Loading required package: brew
 Attaching package: 'sos'
 The following object(s) are masked from 'package:JGR':
  installPackages
 The following object(s) are masked from 'package:utils':
   library(sos); findFn(random forest)
 found 253 matches;  retrieving 13 pages
 2 3 4 5 6 7 8 9 10 11 12 13
 ++

   Have you tried it from within base R/R-Gui (it looks like you're
using JGR)?  findFn() doesn't work from within RStudio, and I can
imagine there's a similar situation with JGR.  At least trying it
would eliminate one possibility.

  Results of sessionInfo() would be helpful ...

__
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] New PLYR issue

2011-11-13 Thread Jeff Newmiller
Not reproducible. Read the posting guide. Provide enough data to reproduce the 
problem.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  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.

Neotropical bat risk assessments neotropical.b...@gmail.com wrote:

Issue with PLYR.
Now using R 2.14 and this data and plyr command line worked with 2.13
I am also loading the same saved data that worked previously, but now 
some issue.

  library(plyr)
  UNESCO - dget('C:/Carbon-GJ/BZE_ecosys.robj')
  df2 - ddply(df, UNESCO, summarise, total_ha = sum(Ha))
*Error in if (empty(.data)) return(.data) :
   missing value where TRUE/FALSE needed*

Clueless

Ideas suggestions?
Some change in PLYR?

Bruce


   [[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] Myriam Saavedra M. Sc. Questions about maximun radius distance

2011-11-13 Thread Ben Bolker
Myriam fantasmita1948 at yahoo.fr writes:

  Dear Mr. Baddeley   I just graduated from a Masters in
 Applied Mathematics on Jun19th. My thesis was about spatial
 distribution /a nalysis of some trees in a part of  the Congo Basic
 Forest.  In my thesis I used your spatial package in R, and today
 I'm doing a more deeper study about how we choise the r distance in
 Function F(). I would like to be able to understand about value of
 rmaxdefault as:

  Mr Baddeley isn't here (probably) -- this is a generic
help list for questions on R. 

 ripley - min(diff(W$xrange), diff(W$yrange))/4
 rlarge - if (!missing(lambda)) sqrt(1000/(pi * lambda)) else Inf
 rmax - min(rlarge, ripley)
 
  For the ripley's calculation, I found your explanation in
 the internet but for the rlarge I couldn't find it. Could
 you explain why it is using the value inside of the sqrt (1000/(pi *
 lambda)).

  You've given us just a fragment of a question here -- there's
not enough context to work with. We don't know where the
variable 'W' came from, although presumably from a Ripley's
K calculation ... ? 

 Please read http://tinyurl.com/reproducible-000 , and give us more
information (e.g. the link (URL) to the explanation you say you found
on the internet).

   I would also suggest that this question might be better suited
for the r-sig-ecol...@r-project.org mailing list ...

__
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] locator not-interactive

2011-11-13 Thread Heverkuhn Heverkuhn
Hello everyone,

I have these 2 vectors in a type=s plot  ( reported below)
I would like to check the value of y at  z=seq(0,1440, by=60)

I think that I can do it  calculating a vector that report the position of
the value  of y  = z for which the difference to z is minimal.


But I also guess that there should be a built-in function like locator,
that provides, given same x  points, the y coordinates.

Does it  actually exist?

Thank you for your help

H.





x-1:679
and y:


[1]2222222222222
 233
 [17]3333333333333
   333
 [33]3333334444444
   444
 [49]4444444444444
   444
 [65]4444444555556
   666
 [81]6666666666667
   777
 [97]7777777777777
   778
[113]8888888889999
   999
[129]9999999999999
   999
[145]999999   10   10   10   10   10   10   12
  12   12   12
[161]   12   12   12   12   12   12   12   12   12   12   12   12   12
  12   12   12
[177]   12   12   12   12   12   12   12   12   12   12   12   13   13
  13   13   13
[193]   13   13   13   13   13   13   13   13   13   18   18   18   18
  18   18   18
[209]   18   18   18   18   18   18   18   18   18   18   18   18   18
  18   19   19
[225]   19   19   19   19   19   19   19   19   24   24   24   24   24
  24   24   25
[241]   25   25   25   25   25   25   25   25   25   25   25   25   25
  28   28   28
[257]   28   28   28   28   28   28   28   28   28   28   28   28   28
  28   28   28
[273]   28   28   28   28   28   28   29   29   29   29   29   29   29
  29   29   29
[289]   29   29   29   29   29   29   29   29   29   29   29   29   30
  30   30   30
[305]   30   30   30   30   30   30   30   30   30   30   30   32   32
  32   32   32
[321]   32   32   32   32   32   32   32   32   33   33   33   33   33
  33   33   33
[337]   33   33   33   33   33   33   33   33   33   33   33   33   33
  33   33   33
[353]   33   33   33   33   33   33   33   33   34   34   34   34   34
  34   34   37
[369]   37   37   37   37   37   37   37   37   37   37   37   37   37
  37   37   37
[385]   37   37   37   44   44   44   44   44   44   44   44   44   44
  44   44   44
[401]   44   44   44   44   44   44   44   44   44   44   44   44   44
  44   44   44
[417]   44   44   44   44   44   44   45   45   60   60   61   61   61
 162  162  162
[433]  162  162  162  162  162  162  162  162  162  162  162  162  162
 162  162  162
[449]  162  162  162  162  162  162  162  162  162  162  162  163  163
 163  163  163
[465]  163  163  163  163  163  163  163  163  163  163  163  163  163
 163  163  163
[481]  163  163  163  163  239  239  239  239  239  239  239  239  239
 239  239  239
[497]  239  239  239  239  239  239  239  239  239  239  239  239  239
 239  239  239
[513]  239  239  604  604  604  604  604  604  604  604  604  604  604
 604  605  605
[529]  605  605  605  605  605  605  605  605  605  605  605  605  605
 605  605  605
[545]  605  605  605  605  605  605  605  605  605  605  605  605  605
 605  605  605
[561]  606  606  606  606  845  845  845  845  845  845  845  845  845
 845  845  845
[577]  845  845  845  845  845  845  845  845  845  845  845  845  845
 846  846  846
[593]  846  846  846  846  846  846  846  846  846  846  846  846  846
 846  846  846
[609]  846  846  846  846  846  846  846  846  846  846  846  846  846
 846  847  847
[625]  847  847  847  847  847  847  847  847  847  847  847  847  847
 847  847  847
[641]  929  929  929  929  929  929  929  929  929  929  929  929  929
 929  930  930
[657]  930  930  930  930  930  930  930  930  930  930  930  930  930
 930  930  930
[673]  933  933  933  933  933  933 1015

[[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] R v2.13.2 - Cannot find Rcmd on path?

2011-11-13 Thread Uwe Ligges



On 12.11.2011 15:56, jack306 wrote:

Dear all:


I could not able to find rcmd using the following path: either R version
(2.13.2 or 2.14.0); either rtools version (2.13 or 2.14). My os is winxp.
The variables set in path are as follows.

c:\Rtools\bin;c:\Rtools\MinGW\bin;C:\Perl\bin; C:\Perl\site\bin;
c:\Rtools\bin; C:\Program Files\R\R-2.13.2\bin\i386; C:\Program Files\MiKTeX
2.9\miktex\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program
Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common
Files\Roxio Shared\10.0\DLLShared\;c:\Program Files\Microsoft SQL
Server\90\Tools\binn\


Start to clean that up!

- remove all blanks not part of paths (i.e. all those between the ; 
and c:

- I am not sure what happens for trailing backslashes.
- you won't need c:\Rtools\bin twice
- MAke sure there is really a Rcmd.exe (if you reallny need that) in 
C:\Program Files\R\R-2.13.2\bin\i386


Best,
Uwe Ligges






After I tried setpath.bat file, it doesn't work either.

Thank you,

Jixiang Wu



--
View this message in context: 
http://r.789695.n4.nabble.com/R-v2-13-2-Cannot-find-Rcmd-on-path-tp3927126p4034596.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] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-13 Thread Sammy Zee
dataset[ nrow(dataset), ] - c (Male, 5, bad)

The above seems to have worked to append a row in place of a rbind(). This
method does not drop the custom attributes from the column. Do yo see any
issue with this method.

Thanks,
Sammy

On Sat, Nov 12, 2011 at 10:16 PM, David Winsemius dwinsem...@comcast.netwrote:


 On Nov 12, 2011, at 6:40 PM, Sammy Zee wrote:

  Thanks David. Besides rbind(), is there any other way to add a row to a
 data frame so that I do not lose the custom attributes.


 I have already told you the method that I know of. You don't seem to have
 taken my poin that it is not a data.frame specific problem but rahter a
 facor problem. You are welcome to redefine `rbind.data.frame`. The R
 language is rather flexible in that manner.

 --
 David.


 Thanks,
 Sammy

 On Sat, Nov 12, 2011 at 5:17 PM, David Winsemius dwinsem...@comcast.net
 wrote:

 On Nov 12, 2011, at 2:47 PM, Sammy Zee wrote:

 When I use rbind() or rbind.data.frame() to add a row to an existing
 dataframe, it appears that attributes for the column of type factor are
 dropped. See the sample example below to reproduce the problem. Please
 suggest How I can fix this.


 Thanks,
 Sammy

 a=c(Male, Male, Female, Male)
 b=c(1,2,3,4)
 c=c(great, bad, good, bad)
 dataset- data.frame (gender = a, count = b, answer = c)

 dataset

 gender count answer
 1   Male 1  great
 2   Male 2bad
 3 Female 3   good
 4   Male 4bad


 attributes(dataset$answer)
 $levels
 [1] bad   good  great

 $class
 [1] factor

 Now adding some custom attributes to column dataset$answer

 attributes(dataset$answer)-c(**attributes(dataset$answer),**
 list(newattr1=custom-attr1))
 attributes(dataset$answer)-c(**attributes(dataset$answer),**
 list(newattr2=custom-attr2))

 If you look through the code of rbind.data.frame you see that column
 values are processed with the 'factor' function.


  attributes(dataset$answer)
 $levels
 [1] bad   good  great

 $class
 [1] factor

 $newattr1
 [1] custom-attr1

 $newattr2
 [1] custom-attr2

  attributes(factor(dataset$**answer))

 $levels
 [1] bad   good  great

 $class
 [1] factor


 So I think you are out of luck. You will need to restore the special
 attributes yourself.

 --
 David.


 attributes(dataset$answer)
 $levels
 [1] bad   good  great

 $class
 [1] factor

 $newattr1
 [1] custom-attr1

 $newattr2
 [1] custom-attr2

 However as soon as I add a row to this data frame (dataset) by rbind(),
 it loses the custom
 attributes (newattr1 and newattr2) I have just added

 newrow = c(gender=Female, count = 5, answer = great)

 dataset - rbind(dataset, newrow)

 attributes(dataset$answer)
 $levels
 [1] bad   good  great

 $class
 [1] factor

 the two custom attributes are dropped!! Any suggestion why this is
 happening.

 On Fri, Nov 11, 2011 at 11:44 AM, Jeff Newmiller
 jdnew...@dcn.davis.ca.us**wrote:

 As the doctor says, if it hurts don't do that.

 A factor is a sequence of integers with a corresponding list of character
 strings. Factors in two separate vectors can and usually do map the same
 integer to different strings, and R cannot tell how you want that
 resolved.

 Convert these columns to character before combining them, and only convert
 to factor when you have all of your possibilities present (or you specify
 them in the creation of the factor vector).
 --**--**
 ---
 Jeff NewmillerThe .   .  Go
 Live...

 Sammy Zee szee2...@gmail.com wrote:

 Hi all,

 When I use rbind() or rbind.data.frame() to add a row to an existing
 dataframe, it appears that attributes for the column of type factor
 are
 dropped. I see the following post with same problem. However i did not
 see
 any reply to the following posting offering a solution. Could someone
 please help.


 http://r.789695.n4.nabble.com/**rbind-data-frame-drops-**
 attributes-for-factor-**variables-td919575.htmlhttp://r.789695.n4.nabble.com/rbind-data-frame-drops-attributes-for-factor-variables-td919575.html

 Thanks,
 Sammy

[[alternative HTML version deleted]]

 ___


 David Winsemius, MD
 West Hartford, CT



[[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] R v2.13.2 - Cannot find Rcmd on path?

2011-11-13 Thread Gabor Grothendieck
On Fri, Oct 21, 2011 at 5:07 PM, Hardy Griesbauer
hgriesba...@hotmail.com wrote:
 Hello,



 I recently updated to R version 2.13.2.  With R version 2.10.0, I often
 created and installed R packages, however, I cannot do this since updating.
 In other words, when I type in Rcmd build -binary PACKAGENAME I receive an
 error message: Rcmd is not recognized as an internal  I suspect that
 this is because Rcmd.exe is no longer installed in the bin folder, but
 rather, in the x64 folder within bin.  Please help!



 What I've done so far:

 1)      Downloaded and installed the latest version of Rtools (as of October
 21, 2011).

 2)      During installation of Rtools, I included the following in the path:
 C:\Progra~1\R\R-2.13.2\bin\x64 and confirmed that this is on the path.

 3)      Read every help manual I can find, but I can't seem to locate the
 answer to this problem.



 Other information:

 R version 2.13.2 (2011-09-30)

 Platform: x86_64-pc-mingw32/x64 (64-bit)



 My windows version: Windows 7 Home Premium Service Pack 1 64-bit OS.


There is a batch command Rcmd.bat at http://batchfiles.googlecode.com
that when run will find R using the registry and then run the
appropriate Rcmd.exe so that you don't need to change your path or any
other environment variable.

Its a self contained .bat file so just place it anywhere on your
existing path.  At the Windows console this command will show you your
path:  path

Now try

Rcmd.bat build ...whatever...

If your path is not already set to find Rcmd.exe then Rcmd.bat can be
abbreviated to just Rcmd in the above line.

-- 
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] Has anyone used SIAR package add on?

2011-11-13 Thread Mark Difford
On Nov 12, 2011 at 8:29pm Alex wrote:

 Has anyone used SIAR package add on?

I posted a reply to an earlier question from you on this subject. See
http://r.789695.n4.nabble.com/Errors-in-SIAR-td4029804.html. In it I note
that there are problems with the function from siar (not SIAR) you are
using, but that this may not be your problem, that the function calls for
matrices (you were using data frames), and that you are unlikely to get
further help on this until you post your data (or data that resemble yours).

It's not that people don't want to help you, but you have to give them
something to work with (see the famous footer of this message). One of the
demos in the siar package mostly works, the other one does not. It's
possible that there is a minor glitch somewhere, which could easily be
fixed, so that given data in the correct format you get a result.

Why don't you dput() a subset of your data, so that anyone who is interested
in helping you can have a go? If your data set is called myData, and is
stored as a data frame, then do something like the following and copy the
result of dput() into your next email. Of course, if your data set has many
rows then you want to adjust the by argument (increase it). Twenty to
thirty rows should be sufficient.

myPartData - myData[seq(1, nrow(myDat), by=3), ]
dput(myPartData)

Regards, Mark.

-
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
--
View this message in context: 
http://r.789695.n4.nabble.com/Has-anyone-used-SIAR-package-add-on-tp4035014p4036852.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] cannot load zoo package

2011-11-13 Thread hawkhandler
Using:
Mac OS 10.7.2
R version 2.13.2

I cannot load the zoo package.  The install runs fine but when trying to
load it i get the following error:

/Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object
'/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so':
  dlopen(/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so, 6):
Library not loaded:
@rpath/R.framework/Versions/2.13/Resources/lib/libR.dylib
  Referenced from:
/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so
  Reason: image not found
Error: package/namespace load failed for 'zoo'/

I appreciate any and all help.  thank you.




--
View this message in context: 
http://r.789695.n4.nabble.com/cannot-load-zoo-package-tp4036835p4036835.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] Generate the distribution

2011-11-13 Thread Anban
Hi everyone,

i really need some help with one task. I simply cant understand what i
really have to do. 

The task is:

Generate the distribution of maximum on samples of size 200 from beta with
shape parameters 5 and 5 distribution. Plot a histogram of simulated values
and overlay at least one distribution curve that you think might be
suitable.

Im rookie with simulations, so i need yours help.

Tnx

--
View this message in context: 
http://r.789695.n4.nabble.com/Generate-the-distribution-tp4036755p4036755.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] cannot load zoo package

2011-11-13 Thread Gabor Grothendieck
On Sun, Nov 13, 2011 at 11:23 AM, hawkhandler ntyhu...@gmail.com wrote:
 Using:
 Mac OS 10.7.2
 R version 2.13.2

 I cannot load the zoo package.  The install runs fine but when trying to
 load it i get the following error:

 /Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object
 '/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so':
  dlopen(/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so, 6):
 Library not loaded:
 @rpath/R.framework/Versions/2.13/Resources/lib/libR.dylib
  Referenced from:
 /Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so
  Reason: image not found
 Error: package/namespace load failed for 'zoo'/

 I appreciate any and all help.  thank you.


Upgrade R to R 2.14.0 or get an older version of zoo.


-- 
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 v2.13.2 - Cannot find Rcmd on path?

2011-11-13 Thread Uwe Ligges



On 13.11.2011 17:29, Gabor Grothendieck wrote:

On Fri, Oct 21, 2011 at 5:07 PM, Hardy Griesbauer
hgriesba...@hotmail.com  wrote:

Hello,



I recently updated to R version 2.13.2.  With R version 2.10.0, I often
created and installed R packages, however, I cannot do this since updating.
In other words, when I type in Rcmd build -binary PACKAGENAME I receive an
error message: Rcmd is not recognized as an internal  I suspect that
this is because Rcmd.exe is no longer installed in the bin folder, but
rather, in the x64 folder within bin.  Please help!



What I've done so far:

1)  Downloaded and installed the latest version of Rtools (as of October
21, 2011).

2)  During installation of Rtools, I included the following in the path:
C:\Progra~1\R\R-2.13.2\bin\x64 and confirmed that this is on the path.

3)  Read every help manual I can find, but I can't seem to locate the
answer to this problem.



Other information:

R version 2.13.2 (2011-09-30)

Platform: x86_64-pc-mingw32/x64 (64-bit)



My windows version: Windows 7 Home Premium Service Pack 1 64-bit OS.



There is a batch command Rcmd.bat at http://batchfiles.googlecode.com
that when run will find R using the registry and then run the
appropriate Rcmd.exe so that you don't need to change your path or any
other environment variable.

Its a self contained .bat file so just place it anywhere on your
existing path.  At the Windows console this command will show you your
path:  path

Now try

Rcmd.bat build ...whatever...

If your path is not already set to find Rcmd.exe then Rcmd.bat can be
abbreviated to just Rcmd in the above line.



I wonder again and again why you try to obfuscate things by your layer 
of non portable batchfiles. Typing the path correctly and according to 
the syntax is required in both cases anyway.


Best,
Uwe

__
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] cannot load zoo package

2011-11-13 Thread Achim Zeileis
There was a problem with @rpath within R.app on the Mac. Either starting R 
within a shell (instead of R.app) or updating R.app should both resolve 
the problem. See


  https://stat.ethz.ch/pipermail/r-sig-mac/2011-November/008757.html

for details.
Z

On Sun, 13 Nov 2011, hawkhandler wrote:


Using:
Mac OS 10.7.2
R version 2.13.2

I cannot load the zoo package.  The install runs fine but when trying to
load it i get the following error:

/Error in dyn.load(file, DLLpath = DLLpath, ...) :
 unable to load shared object
'/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so':
 dlopen(/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so, 6):
Library not loaded:
@rpath/R.framework/Versions/2.13/Resources/lib/libR.dylib
 Referenced from:
/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so
 Reason: image not found
Error: package/namespace load failed for 'zoo'/

I appreciate any and all help.  thank you.




--
View this message in context: 
http://r.789695.n4.nabble.com/cannot-load-zoo-package-tp4036835p4036835.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] To moderator

2011-11-13 Thread Ted Harding
No. But it has not been posted either.
You got that message because you sent your message to
the wrong address. You should have sent it to

  r-help@r-project.org

You had probably sent it to

  r-help-requ...@r-project.org

which would have had the effect that the server would have
tried to interpret the contents of you message as commands
(e.g. to unsubscribe, change your subscription options, etc.),
except that the contents of your message are not meaningful
as commands to r-help-request.

So you should send your message again, and this time to the
correct address!

However, since it seems that your email address

  laf...@dms.umontreal.ca

is not subscribed to the list, when you do send it you will
receive a notification that it has been held for moderation
because it has been posted by a non-member to a members-only
list. After a while (depending on when a moderator next looks
at the heldmessages) it will be approved and will go out to
the list. You can save yourself this trouble by subscribing
your email address to the r-help list. Visit:

  https://stat.ethz.ch/mailman/listinfo/r-help

and following the instructions in the section Subscribing
to R-help.

Hoping this helps,
Ted.

On 13-Nov-11 17:05:46, Lafaye de Micheaux wrote:
 Dear moderator,
 
 Can you tell me if this means that my email has been rejected?
 
 Best
 
 Pierre
 
 Le 13/11/2011 11:54, r-help-ow...@r-project.org a écrit :
 The results of your email command are provided below. Attached is your
 original message.


 - Unprocessed:
  I am working on a 64 bits Linux system.
  I issue the following R commands:
 rm(list=ls()) # To remove all objects in the workspace.
 gc() # To free memory.
  used (Mb) gc trigger (Mb) max used (Mb)
  Ncells 124250 6.7 35 18.7 35 18.7
  Vcells 124547 1.0 786432 6.0 476934 3.7
 gc() # I had to do it again, don't know why!
  used (Mb) gc trigger (Mb) max used (Mb)
  Ncells 124257 6.7 35 18.7 35 18.7
  Vcells 124574 1.0 786432 6.0 476934 3.7
 gc() # Just to be sure things have stabilized.
  used (Mb) gc trigger (Mb) max used (Mb)
  Ncells 124257 6.7 35 18.7 35 18.7
  Vcells 124574 1.0 786432 6.0 476934 3.7
 x- as.integer(3)
 object.size(x)
  48 bytes
 gc() # To free memory.
  used (Mb) gc trigger (Mb) max used (Mb)
  Ncells 124255 6.7 35 18.7 35 18.7
  Vcells 124550 1.0 786432 6.0 476934 3.7

 - Ignored:
 gc() # I had to do it again, don't know why!
  used (Mb) gc trigger (Mb) max used (Mb)
  Ncells 124259 6.7 35 18.7 35 18.7
  Vcells 124575 1.0 786432 6.0 476934 3.7
 gc() # Just to be sure things have stabilized.
  used (Mb) gc trigger (Mb) max used (Mb)
  Ncells 124259 6.7 35 18.7 35 18.7
  Vcells 124575 1.0 786432 6.0 476934 3.7


  My questions are:

  1) Why should I use the command gc() two times before the values
  displayed do not change anymore?

  2) object.size(x) is 48 bytes on my system. As I understand it,
  this is
  8 bytes for storing the value 3L and 40 bytes (on my 64 bits OS)
  to
  store the header of x. Am-I right? (Note that I understand it
  would be
  the same for x- c(3L,4L))

  3) If 2) is OK, then you can see that Ncells increased by 2 units
  and
  Vcells by 1 unit.
  I think that 1 unit of Vcells = 8 bytes. Is it TRUE? (This is
  written in
  help(gc))
  And in my mind, 1 unit of Ncells should be 20 bytes, so that:
  1 unit of Vcells + 2 units of Ncells = 8 + 2*20 = 48, the size of
  x as
  returned by the command object.size(x).

  BUT, when you look at help(gc), one can read:
  ‘gc’ returns a matrix with rows ‘Ncells’ (_cons cells_),
  usually
  28 bytes each on 32-bit systems and 56 bytes on 64-bit systems,

  So, can you please help me to undertsand all of this?

  Thanks in advance.

  Best regards,

  Pierre


  --
  Pierre Lafaye de Micheaux

  Adresse courrier:
  Département de Mathématiques et Statistique
  Université de Montréal
  CP 6128, succ. Centre-ville
  Montréal, Québec H3C 3J7
  CANADA

  Adresse physique:
  Département de Mathématiques et Statistique
  Bureau 4249, Pavillon André-Aisenstadt
  2920, chemin de la Tour
  Montréal, Québec H3T 1J4
  CANADA

  Tél.: (00-1) 514-343-6607 / Fax: (00-1) 514-343-5700
  laf...@dms.umontreal.ca
  http://www.biostatisticien.eu


 - Done.


 
 
 -- 
 Pierre Lafaye de Micheaux
 
 Adresse courrier:
 Département de Mathématiques et Statistique
 Université de Montréal
 CP 6128, succ. Centre-ville
 Montréal, Québec H3C 3J7
 CANADA
 
 Adresse physique:
 Département de Mathématiques et Statistique
 Bureau 4249, Pavillon André-Aisenstadt
 2920, chemin de la Tour
 Montréal, Québec H3T 1J4
 CANADA
 
 Tél.: (00-1) 514-343-6607 / Fax: (00-1) 514-343-5700
 

[R] R development master class: NYC, Dec 12-13

2011-11-13 Thread Hadley Wickham
Hi all,

I hope you don't mind the slightly off topic email, but I'm going to
be teaching an R development master class in New York City on Dec
12-13. The basic idea of the class is to help you write better code,
focused on the mantra of do not repeat yourself. In day one you will
learn powerful new tools of abstraction, allowing you to solve a wider
range of problems with fewer lines of code. Day two will teach you how
to make packages, the fundamental unit of code distribution in R,
allowing others to save time by allowing them to use your code.

To get the most out of this course, you should have some experience
programming in R already: you should be familiar with writing
functions, and the basic data structures of R: vectors, matrices,
arrays, lists and data frames. You will find the course particularly
useful if you're an experienced R user looking to take the next step,
or if you're moving to R from other programming languages and you want
to quickly get up to speed with R's unique features. A couple session
outline is available at http://www.eventbrite.com/event/2492641558

Both days will incorporate a mix of lectures and hands-on learning.
Expect to learn about a topic and then immediately put it into
practice with a small example. Plenty of help will be available if you
get stuck. You'll receive a printed copy of all slides, as well as
electronic access to the slides, code and data. The material covered
in the course is currently being turned into a book. You can access
the current draft at https://github.com/hadley/devtools/wiki/.

Limited discounts for students (66% off) and academics (33% off) are
available - please contact me for details.

Find out more and sign up at http://www.eventbrite.com/event/2492641558

Regards,

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

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


Re: [R] To moderator

2011-11-13 Thread Ted Harding
My apologies for sending the message with the above subject
to R-help. I can only assume that it was the result of
mis-mousing! (It should only have gone to the original
sendar, and to r-help-owner).

Best wishes to all,
Ted.



E-Mail: (Ted Harding) ted.hard...@wlandres.net
Fax-to-email: +44 (0)870 094 0861
Date: 13-Nov-11   Time: 17:38:12
-- XFMail --

__
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 development master class: NYC, Dec 12-13

2011-11-13 Thread Alex Ruiz Euler

What, no discount codes for us?!

No seriously, as much as I'm for free enterprise, it feels awkward to
see you promote an (expensive!) course in a list where people offer not
only their knowledge, but also the tools you use, for free.

I ignore whether this goes against posting rules, but even if it doesn't
I wouldn't want this awesome resource to become a marketing platform.


On Sun, 13 Nov 2011 11:34:35 -0600
Hadley Wickham had...@rice.edu wrote:

 Hi all,
 
 I hope you don't mind the slightly off topic email, but I'm going to
 be teaching an R development master class in New York City on Dec
 12-13. The basic idea of the class is to help you write better code,
 focused on the mantra of do not repeat yourself. In day one you will
 learn powerful new tools of abstraction, allowing you to solve a wider
 range of problems with fewer lines of code. Day two will teach you how
 to make packages, the fundamental unit of code distribution in R,
 allowing others to save time by allowing them to use your code.
 
 To get the most out of this course, you should have some experience
 programming in R already: you should be familiar with writing
 functions, and the basic data structures of R: vectors, matrices,
 arrays, lists and data frames. You will find the course particularly
 useful if you're an experienced R user looking to take the next step,
 or if you're moving to R from other programming languages and you want
 to quickly get up to speed with R's unique features. A couple session
 outline is available at http://www.eventbrite.com/event/2492641558
 
 Both days will incorporate a mix of lectures and hands-on learning.
 Expect to learn about a topic and then immediately put it into
 practice with a small example. Plenty of help will be available if you
 get stuck. You'll receive a printed copy of all slides, as well as
 electronic access to the slides, code and data. The material covered
 in the course is currently being turned into a book. You can access
 the current draft at https://github.com/hadley/devtools/wiki/.
 
 Limited discounts for students (66% off) and academics (33% off) are
 available - please contact me for details.
 
 Find out more and sign up at http://www.eventbrite.com/event/2492641558
 
 Regards,
 
 Hadley
 
 -- 
 Assistant Professor / Dobelman Family Junior Chair
 Department of Statistics / Rice University
 http://had.co.nz/
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
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] Generate the distribution

2011-11-13 Thread Ben Bolker
Anban nino.zajc at gmail.com writes:


 [snip]
 i really need some help with one task. I simply cant understand what i
 really have to do. 

  [snip]
 
 Generate the distribution of maximum on samples of size 200 from beta with
 shape parameters 5 and 5 distribution. Plot a histogram of simulated values
 and overlay at least one distribution curve that you think might be
 suitable.

  This list is explicitly not intended for homework and this looks
a whole like homework.
  If you can convince us that this is *not* homework, or that your
instructor is happy to let you ask questions on the web, I'm sure lots
of people here will be happy to help.
  
  sincerely
Ben Bolker

__
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 v2.13.2 - Cannot find Rcmd on path?

2011-11-13 Thread Yihui Xie
I remember I was torn into pieces a few months back when I made a
wishlist here that R adds its bin path to PATH on Windows during
installation. People had tons of reasons of objection. Although I do
not use these batchfiles (usually I do not actually use Windows), I
see there is a motivation behind them: there needs to be an easy way
for Windows users to use R in command line (e.g. R CMD build...). You
may argue that it is easy to understand PATH and modify it manually,
and I will say nothing but thank Windows again. Sorry this seems to
be off-topic.

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



2011/11/13 Uwe Ligges lig...@statistik.tu-dortmund.de:


 On 13.11.2011 17:29, Gabor Grothendieck wrote:

 On Fri, Oct 21, 2011 at 5:07 PM, Hardy Griesbauer
 hgriesba...@hotmail.com  wrote:

 Hello,



 I recently updated to R version 2.13.2.  With R version 2.10.0, I often
 created and installed R packages, however, I cannot do this since
 updating.
 In other words, when I type in Rcmd build -binary PACKAGENAME I receive
 an
 error message: Rcmd is not recognized as an internal  I suspect
 that
 this is because Rcmd.exe is no longer installed in the bin folder, but
 rather, in the x64 folder within bin.  Please help!



 What I've done so far:

 1)      Downloaded and installed the latest version of Rtools (as of
 October
 21, 2011).

 2)      During installation of Rtools, I included the following in the
 path:
 C:\Progra~1\R\R-2.13.2\bin\x64 and confirmed that this is on the path.

 3)      Read every help manual I can find, but I can't seem to locate the
 answer to this problem.



 Other information:

 R version 2.13.2 (2011-09-30)

 Platform: x86_64-pc-mingw32/x64 (64-bit)



 My windows version: Windows 7 Home Premium Service Pack 1 64-bit OS.


 There is a batch command Rcmd.bat at http://batchfiles.googlecode.com
 that when run will find R using the registry and then run the
 appropriate Rcmd.exe so that you don't need to change your path or any
 other environment variable.

 Its a self contained .bat file so just place it anywhere on your
 existing path.  At the Windows console this command will show you your
 path:  path

 Now try

 Rcmd.bat build ...whatever...

 If your path is not already set to find Rcmd.exe then Rcmd.bat can be
 abbreviated to just Rcmd in the above line.


 I wonder again and again why you try to obfuscate things by your layer of
 non portable batchfiles. Typing the path correctly and according to the
 syntax is required in both cases anyway.

 Best,
 Uwe

 __
 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 change the font of any help page

2011-11-13 Thread Christofer Bogaso
Dear all, when I open the help page of any R function, the help page opens
with my default browser. However I am not happy with Font of the help page,
which probably set as 'Times new roman'. How can I change this Font style? I
want to see any help content with the 'Calibri' font.

Is it possible?

Thanks and regards,

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


Re: [R] identify duplicate from more than one column

2011-11-13 Thread jour4life
Thanks Jim and David!

It seems like both were great options. Both of your suggestions of pasting
both IDs together worked well, keeping the pasting as a character is better.
Though, Jim's example was interesting, it gave me the following error:

Error in `$-.data.frame`(`*tmp*`, coupleid, value = c(1L, 1L, 2L, 2L,  : 
  replacement has 123586 rows, data has 123631

Since this was a large dataframe, I don't know exactly where the error
occurred. But, it seems like it was detecting missing values in some of the
rows and after checking using the is.na() function, it didn't say that there
were any missing values used (i.e. the new mID or sex). 

What do you guys think may be happening?

Thanks,

Carlos

--
View this message in context: 
http://r.789695.n4.nabble.com/identify-duplicate-from-more-than-one-column-tp4035888p4037177.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] R v2.13.2 - Cannot find Rcmd on path?

2011-11-13 Thread Hardy Griesbauer
For what it's worth: the fix was to put the x64 folder FIRST in the path. 

-Original Message-
From: xieyi...@gmail.com [mailto:xieyi...@gmail.com] On Behalf Of Yihui Xie
Sent: November-13-11 10:16 AM
To: Uwe Ligges
Cc: Gabor Grothendieck; r-help@r-project.org; Hardy Griesbauer
Subject: Re: [R] R v2.13.2 - Cannot find Rcmd on path?

I remember I was torn into pieces a few months back when I made a
wishlist here that R adds its bin path to PATH on Windows during
installation. People had tons of reasons of objection. Although I do
not use these batchfiles (usually I do not actually use Windows), I
see there is a motivation behind them: there needs to be an easy way
for Windows users to use R in command line (e.g. R CMD build...). You
may argue that it is easy to understand PATH and modify it manually,
and I will say nothing but thank Windows again. Sorry this seems to
be off-topic.

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



2011/11/13 Uwe Ligges lig...@statistik.tu-dortmund.de:


 On 13.11.2011 17:29, Gabor Grothendieck wrote:

 On Fri, Oct 21, 2011 at 5:07 PM, Hardy Griesbauer
 hgriesba...@hotmail.com  wrote:

 Hello,



 I recently updated to R version 2.13.2.  With R version 2.10.0, I often
 created and installed R packages, however, I cannot do this since
 updating.
 In other words, when I type in Rcmd build -binary PACKAGENAME I receive
 an
 error message: Rcmd is not recognized as an internal  I suspect
 that
 this is because Rcmd.exe is no longer installed in the bin folder, but
 rather, in the x64 folder within bin.  Please help!



 What I've done so far:

 1)      Downloaded and installed the latest version of Rtools (as of
 October
 21, 2011).

 2)      During installation of Rtools, I included the following in the
 path:
 C:\Progra~1\R\R-2.13.2\bin\x64 and confirmed that this is on the path.

 3)      Read every help manual I can find, but I can't seem to locate
the
 answer to this problem.



 Other information:

 R version 2.13.2 (2011-09-30)

 Platform: x86_64-pc-mingw32/x64 (64-bit)



 My windows version: Windows 7 Home Premium Service Pack 1 64-bit OS.


 There is a batch command Rcmd.bat at http://batchfiles.googlecode.com
 that when run will find R using the registry and then run the
 appropriate Rcmd.exe so that you don't need to change your path or any
 other environment variable.

 Its a self contained .bat file so just place it anywhere on your
 existing path.  At the Windows console this command will show you your
 path:  path

 Now try

 Rcmd.bat build ...whatever...

 If your path is not already set to find Rcmd.exe then Rcmd.bat can be
 abbreviated to just Rcmd in the above line.


 I wonder again and again why you try to obfuscate things by your layer of
 non portable batchfiles. Typing the path correctly and according to the
 syntax is required in both cases anyway.

 Best,
 Uwe

 __
 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] Understand Ncells and Vcells, from gc()

2011-11-13 Thread Lafaye de Micheaux

Dear all,

I am working on a 64 bits Linux system.
I issue the following R commands:

 rm(list=ls()) # To remove all objects in the workspace.
 gc() # To free memory.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124250 6.7 35 18.7 35 18.7
Vcells 124547 1.0 786432 6.0 476934 3.7
 gc() # I had to do it again, don't know why!
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124257 6.7 35 18.7 35 18.7
Vcells 124574 1.0 786432 6.0 476934 3.7
 gc() # Just to be sure things have stabilized.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124257 6.7 35 18.7 35 18.7
Vcells 124574 1.0 786432 6.0 476934 3.7
 x - as.integer(3)
 object.size(x)
48 bytes
 gc() # To free memory.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124255 6.7 35 18.7 35 18.7
Vcells 124550 1.0 786432 6.0 476934 3.7
 gc() # I had to do it again, don't know why!
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124259 6.7 35 18.7 35 18.7
Vcells 124575 1.0 786432 6.0 476934 3.7
 gc() # Just to be sure things have stabilized.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124259 6.7 35 18.7 35 18.7
Vcells 124575 1.0 786432 6.0 476934 3.7


My questions are:

1) Why should I use the command gc() two times before the values 
displayed do not change anymore?


2) object.size(x) is 48 bytes on my system. As I understand it, this is 
8 bytes for storing the value 3L and 40 bytes (on my 64 bits OS) to 
store the header of x. Am-I right? (Note that I understand it would be 
the same for x - c(3L,4L))


3) If 2) is OK, then you can see that Ncells increased by 2 units and 
Vcells by 1 unit.
I think that 1 unit of Vcells = 8 bytes. Is it TRUE? (This is written in 
help(gc))

And in my mind, 1 unit of Ncells should be 20 bytes, so that:
1 unit of Vcells + 2 units of Ncells = 8 + 2*20 = 48, the size of x as 
returned by the command object.size(x).


BUT, when you look at help(gc), one can read:
‘gc’ returns a matrix with rows ‘Ncells’ (_cons cells_), usually
28 bytes each on 32-bit systems and 56 bytes on 64-bit systems,

So, can you please help me to undertsand all of this?

Thanks in advance.

Best regards,

Pierre

--
Pierre Lafaye de Micheaux

Adresse courrier:
Département de Mathématiques et Statistique
Université de Montréal
CP 6128, succ. Centre-ville
Montréal, Québec H3C 3J7
CANADA

Adresse physique:
Département de Mathématiques et Statistique
Bureau 4249, Pavillon André-Aisenstadt
2920, chemin de la Tour
Montréal, Québec H3T 1J4
CANADA

Tél.: (00-1) 514-343-6607 / Fax: (00-1) 514-343-5700
laf...@dms.umontreal.ca
http://www.biostatisticien.eu

__
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] Function not found, maybe respective package has to be put in environment?

2011-11-13 Thread Andreas Klein
Hello everybody,

I have a problem and would like to start with an example:

library(snow)
library(tseries)
fn - function(x) adf.test(x)

clusterApply(cl=cl, x=x , fun=fn)


R cannot find the function adf.test() because it is inside the function fn(). 
This problem does not occur when, for example, fn - function(x) mean(x) holds. 
Therefore, I think the package tseries has to be put somehow in the environment 
where also the package stats is because the function mean() works but the 
function adf.test() not.

But how to solve the problem?

Remark:
The above code is an example to illustrate my problem. My original function is 
more complex and somewhere inside my function I refer to some other function 
from the package tsDyn.


I hope you can help me.

Kind regards,
Andy.


__
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] Function not found, maybe respective package has to be put in environment?

2011-11-13 Thread Uwe Ligges

You have to load tseries on the nodes, not only on the master, i.e.:

clusterEvalQ(cl, library(tseries))

Best,
Uwe Ligges



On 13.11.2011 19:34, Andreas Klein wrote:

Hello everybody,

I have a problem and would like to start with an example:

library(snow)
library(tseries)
fn- function(x) adf.test(x)

clusterApply(cl=cl, x=x , fun=fn)


R cannot find the function adf.test() because it is inside the function fn(). This 
problem does not occur when, for example, fn- function(x) mean(x) holds. 
Therefore, I think the package tseries has to be put somehow in the environment 
where also the package stats is because the function mean() works but the function 
adf.test() not.

But how to solve the problem?

Remark:
The above code is an example to illustrate my problem. My original function is 
more complex and somewhere inside my function I refer to some other function 
from the package tsDyn.


I hope you can help me.

Kind regards,
Andy.


__
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] How to change the font of any help page

2011-11-13 Thread Uwe Ligges
Each package comes with its own R.css these days and it can be tweaked 
by the package. If it is the standard on, it uses your browser's default 
font for displaying the plain text in the body of a help page.


Best,
Uwe Ligges



On 13.11.2011 19:46, Christofer Bogaso wrote:

Dear all, when I open the help page of any R function, the help page opens
with my default browser. However I am not happy with Font of the help page,
which probably set as 'Times new roman'. How can I change this Font style? I
want to see any help content with the 'Calibri' font.

Is it possible?

Thanks and regards,

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


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


Re: [R] Kolmogorov-smirnov test

2011-11-13 Thread karlheinz037
I recently gave a presentation at the 50th Army Operational Research
Symposium at Ft Lee describing an implementation of Conover's exact
calculation method for the KS test applied to discrete distributions. My
implementation was done in Matlab script as opposed to R. Multiple
Monte-Carlo trials were most encouraging.  Seeing a comparison of the
methods of implementation would be interesting.  

--
View this message in context: 
http://r.789695.n4.nabble.com/Kolmogorov-smirnov-test-tp3313842p4037287.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] R development master class: NYC, Dec 12-13

2011-11-13 Thread Hadley Wickham
 No seriously, as much as I'm for free enterprise, it feels awkward to
 see you promote an (expensive!) course in a list where people offer not
 only their knowledge, but also the tools you use, for free.

You might have a point if I taught this course instead of offering
knowledge and code for free, but I do it as well.  Over the years I
have contributed thousands of answers on R-help and hundreds on
stackoverflow. I've written dozens of open-source packages and look
after several R related mailing lists. I make pre-prints of all my
papers available for free, I release all my lecture notes under
creative commons licenses and I'm a supporting benefactor of the R
foundation (or at least I've submitted the paperwork, I'm not yet
listed on the site). What more do you want?!

Some of the money I earn from these courses goes to pay for my summer
salary and supports student research. It also gives me confidence that
if I don't get tenure because I've been writing R packages instead of
papers, I can keep doing the work I love.

Hadley


-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

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


Re: [R] R development master class: NYC, Dec 12-13

2011-11-13 Thread Alex Ruiz Euler

Ha! Point publicly acknowledged.

Best,
A.


On Sun, 13 Nov 2011 13:41:36 -0600
Hadley Wickham had...@rice.edu wrote:

  No seriously, as much as I'm for free enterprise, it feels awkward to
  see you promote an (expensive!) course in a list where people offer not
  only their knowledge, but also the tools you use, for free.
 
 You might have a point if I taught this course instead of offering
 knowledge and code for free, but I do it as well.  Over the years I
 have contributed thousands of answers on R-help and hundreds on
 stackoverflow. I've written dozens of open-source packages and look
 after several R related mailing lists. I make pre-prints of all my
 papers available for free, I release all my lecture notes under
 creative commons licenses and I'm a supporting benefactor of the R
 foundation (or at least I've submitted the paperwork, I'm not yet
 listed on the site). What more do you want?!
 
 Some of the money I earn from these courses goes to pay for my summer
 salary and supports student research. It also gives me confidence that
 if I don't get tenure because I've been writing R packages instead of
 papers, I can keep doing the work I love.
 
 Hadley
 
 
 -- 
 Assistant Professor / Dobelman Family Junior Chair
 Department of Statistics / Rice University
 http://had.co.nz/

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


Re: [R] R development master class: NYC, Dec 12-13

2011-11-13 Thread Steve Lianoglou
Though I can't speak for Alex, I suspect this was a case of him either
(1) not realizing you were actually the poster of the original email,
or (2) he is relatively new to the woRld and hasn't yet connecting
your name to your (enumerable) contributions.

Also:

 Some of the money I earn from these courses goes to pay for my summer
 salary and supports student research. It also gives me confidence that
 if I don't get tenure because I've been writing R packages instead of
 papers, I can keep doing the work I love.

If that actually happens, that would be an amazing/colossal (not in a
good way) testament to how well the rating system works in academia.

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

__
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] identify duplicate from more than one column

2011-11-13 Thread Joshua Wiley
Hi Carlos,

Am I Jim? (I ask because there are at least two quite active Jim's on
this list and one could have conceivably replied to you offlist).

Regarding your error, it is rather difficult to tell without knowing
exactly what your data is like and what you did.  For _just_ the unit,
home, and sex variables that we are working with, could you post the
output of str() and summary() ?  Something like:

str(dat[c(unit, home, sex)])
summary(dat[c(unit, home, sex)])

where you replace 'dat' with your data frame name and the variable
with the variable names.  Also, please post the exact code you used
leading up to the error.  I am not certain whether you used mine,
David's, or some mix...as near as I can tell, neither David or I used
the 'coupleid' variable name, so you at least changed names.

Best Regards,

Josh

On Sun, Nov 13, 2011 at 10:37 AM, jour4life jour4l...@gmail.com wrote:
 Thanks Jim and David!

 It seems like both were great options. Both of your suggestions of pasting
 both IDs together worked well, keeping the pasting as a character is better.
 Though, Jim's example was interesting, it gave me the following error:

 Error in `$-.data.frame`(`*tmp*`, coupleid, value = c(1L, 1L, 2L, 2L,  :
  replacement has 123586 rows, data has 123631

 Since this was a large dataframe, I don't know exactly where the error
 occurred. But, it seems like it was detecting missing values in some of the
 rows and after checking using the is.na() function, it didn't say that there
 were any missing values used (i.e. the new mID or sex).

 What do you guys think may be happening?

 Thanks,

 Carlos

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/identify-duplicate-from-more-than-one-column-tp4035888p4037177.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.




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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] Generate the distribution

2011-11-13 Thread Dennis Murphy
Google is an amazing resource for getting information. Try Googling
'simulation in R' - I got several useful hits on the first page.

HTH,
Dennis

On Sun, Nov 13, 2011 at 7:41 AM, Anban nino.z...@gmail.com wrote:
 Hi everyone,

 i really need some help with one task. I simply cant understand what i
 really have to do.

 The task is:

 Generate the distribution of maximum on samples of size 200 from beta with
 shape parameters 5 and 5 distribution. Plot a histogram of simulated values
 and overlay at least one distribution curve that you think might be
 suitable.

 Im rookie with simulations, so i need yours help.

 Tnx

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Generate-the-distribution-tp4036755p4036755.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] R development master class: NYC, Dec 12-13

2011-11-13 Thread Sarah Goslee
On Sun, Nov 13, 2011 at 2:55 PM, Steve Lianoglou
mailinglist.honey...@gmail.com wrote:

 Some of the money I earn from these courses goes to pay for my summer
 salary and supports student research. It also gives me confidence that
 if I don't get tenure because I've been writing R packages instead of
 papers, I can keep doing the work I love.

 If that actually happens, that would be an amazing/colossal (not in a
 good way) testament to how well the rating system works in academia.

I'm not in academia, but government research. I do go through a review
very similar to the tenure process. Last time, I was told that I couldn't list
my R package and associated papers as a research activity with substantial
impact because it was outside my official scope of work. (Even though I
wrote it so I could *do* my work.) I have no trouble seeing academic
administrators do the same thing.

Sarah

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


Re: [R] R v2.13.2 - Cannot find Rcmd on path?

2011-11-13 Thread Gabor Grothendieck
On Sun, Nov 13, 2011 at 1:38 PM, Hardy Griesbauer
hgriesba...@hotmail.com wrote:
 For what it's worth: the fix was to put the x64 folder FIRST in the path.


Of course that only fixes it for now.   Every time you upgrade R you
have to change it all over again.  With the batch files there is
nothing to set and therefore nothing to change each time.

-- 
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 development master class: NYC, Dec 12-13

2011-11-13 Thread Joshua Wiley
On Sun, Nov 13, 2011 at 11:55 AM, Steve Lianoglou
mailinglist.honey...@gmail.com wrote:
 Some of the money I earn from these courses goes to pay for my summer
 salary and supports student research. It also gives me confidence that
 if I don't get tenure because I've been writing R packages instead of
 papers, I can keep doing the work I love.

 If that actually happens, that would be an amazing/colossal (not in a
 good way) testament to how well the rating system works in academia.

I think there's a broader issue here, that many people (Hadley
included, but many many others) who do open source work go seriously
underappreciated and underrespected.  This is not just in academia.
You do not have to read too many emails on R-help or R-devel to see
someone complaining about something that is not working or is not
working the way it should.  Suggestions for improvement are always
great, but it seems to me the tone is often very negative considering
the amount of time and effort very gifted people put into it and have
gotten A) little or no payment B) little recognition from their
respective institutions.  Makes me wish I was more than a graduate
student and had more to give.

Josh


-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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] Simulation over data repeatedly for four loops

2011-11-13 Thread R. Michael Weylandt
Perhaps you might want to abstract your code a bit and try something like:

X = rnorm(500) # Some Data
replicate(1e4, mean(sample(X, 500, replace = T)))

Obviously you can set up a loop over your data sets as needed.

Michael

On Sat, Nov 12, 2011 at 6:46 PM, Francesca francesca.panco...@gmail.com wrote:
 Dear Contributors,

 I am trying to perform a simulation over sample data,

 but I need to reproduce the same simulation over 4 groups of data. My
 ability with for loop is null, in particular related

 to dimensions as I always get, no matter what I try,

 number of items to replace is not a multiple of replacement length


 This is what I intend to do: replicate this operation for

 four times, where the index for the four groups is in the

 part of the code: datiPc[[1]][,2].

 I have to replicate the following code 4 times, where the

 changing part is in the data from which I pick the sample,

 the data that are stored in datiPc[[1]][,2].

 If I had to use data for the four samples, I would substitute the 1 with a
 j and replicate a loop four times, but it never worked.


 My desired final outcome is a matrix with 1 observations for each
 couple of extracted samples, i.e. 8 columns of 1 observations of means.



 db-c()

 # Estrazione dei campioni dai dati di PGG e TRUST

 estr1 - c();

    estr2 - c();

    m1-c()

    m2-c()

       tmp1- data1[[1]][,2];

      tmp2- data2[[2]][,2];

        for(i in 1:100){

 estr1-sample(tmp1, 1000, replace = TRUE)

        estr2-sample(tmp2, 1000, replace = TRUE)


        m1[i]-mean(estr1,na.rm=TRUE)

        m2[i]-mean(estr2,na.rm=TRUE)

 }

 db-data.frame(cbind(m1,m2))
 Thanks for any help you can provide.
 Best Regards

 --

 Francesca
 --

        [[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] R development master class: NYC, Dec 12-13

2011-11-13 Thread Spencer Graves

On 11/13/2011 12:58 PM, Sarah Goslee wrote:

On Sun, Nov 13, 2011 at 2:55 PM, Steve Lianoglou
mailinglist.honey...@gmail.com  wrote:


Some of the money I earn from these courses goes to pay for my summer
salary and supports student research. It also gives me confidence that
if I don't get tenure because I've been writing R packages instead of
papers, I can keep doing the work I love.

If that actually happens, that would be an amazing/colossal (not in a
good way) testament to how well the rating system works in academia.

I'm not in academia, but government research. I do go through a review
very similar to the tenure process. Last time, I was told that I couldn't list
my R package and associated papers as a research activity with substantial
impact because it was outside my official scope of work. (Even though I
wrote it so I could *do* my work.) I have no trouble seeing academic
administrators do the same thing.



  What can be done to fight that?


  Do you publish papers in refereed academic journals, like in 
academia?



  The ultimate evaluation of the value of publications is the 
number of citations to the work.  You should be able to go to Science 
Citation Index and get reports of the citations to papers you and your 
peers have written.  With R, I know of two ways to access references. 
The simplest is to use the sos package, and then findFn for your name.



  Example:



hw. - findFn('{hadley wickham}', 999)

found 517 matches;  retrieving 26 pages
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

summary(hw.)


Call:
findFn(string = {hadley wickham}, maxPages = 999)

Total number of matches: 517
Downloaded 506 links in 24 packages.

Packages with at least 3 matches using pattern
  '{hadley%20wickham}'
   Package Count MaxScore TotalScore   Date
1  ggplot2   2551255 2011-11-04
2   rggobi881 88 2011-04-20
3  reshape541 54 2011-10-07
4  DescribeDisplay233 25 2010-03-24
5helpr201 20 2010-11-05
6 plyr201 20 2011-11-04
7 tourrGui101 10 2011-02-05
8   lvplot 61  6 2010-03-24
9   GGally 42  5 2011-11-04
10  Rd2roxygen 41  4 2011-09-15
11latticeExtra 32  4 2011-11-04
12   hints 31  3 2010-03-24
13   tourr 31  3 2011-09-15


  The first few rows are Hadley's packages.  The later ones are 
other packages that cite him.



  Secondly, the information on CRAN for each of Hadley's packages 
lists reverse dependencies.



  When I look at Science Citation Index for all the papers I've 
published, I've been disappointed.  When I look at what I've done with 
R, it seems that more people have gotten more value from that work than 
from the papers I've written.  One of the reasons is that papers and 
books with companion software is much easier to read and understand, 
because walking through R code line by line with examples can answer 
many questions that are not easily answered from the printed page alone.



  hope this helps.
  spencer
p.s.  It will be a sad commentary on Rice and the academic tenure system 
in the US if Hadley is denied tenure.  He has made a major contribution 
to the R community and through that to all of humanity through all the 
people around the world who use R to help them better understand and 
manage their own social, political, and physical environments.



Sarah



--
Spencer Graves, PE, PhD
President and Chief Technology Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567
web:  www.structuremonitoring.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 v2.13.2 - Cannot find Rcmd on path?

2011-11-13 Thread Duncan Murdoch

On 11-11-13 1:15 PM, Yihui Xie wrote:

I remember I was torn into pieces a few months back when I made a
wishlist here that R adds its bin path to PATH on Windows during
installation. People had tons of reasons of objection. Although I do
not use these batchfiles (usually I do not actually use Windows), I
see there is a motivation behind them: there needs to be an easy way
for Windows users to use R in command line (e.g. R CMD build...). You
may argue that it is easy to understand PATH and modify it manually,
and I will say nothing but thank Windows again. Sorry this seems to
be off-topic.


I don't remember any rending and tearing, but I do remember objections 
to modifying the path during installation.  I wouldn't want to write 
code to do that, because it's hard:


- Most people don't want to put R first, because it may hide something 
important.


- Putting it last won't work if an earlier version is already there.

So you need to examine the path and correct it, an automatic change is 
unlikely to be successful.


But if you want to write code to do that, just go ahead and do it.  Put 
it in a package, even.


Duncan Murdoch



Regards,
Yihui
--
Yihui Xiexieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



2011/11/13 Uwe Liggeslig...@statistik.tu-dortmund.de:



On 13.11.2011 17:29, Gabor Grothendieck wrote:


On Fri, Oct 21, 2011 at 5:07 PM, Hardy Griesbauer
hgriesba...@hotmail.comwrote:


Hello,



I recently updated to R version 2.13.2.  With R version 2.10.0, I often
created and installed R packages, however, I cannot do this since
updating.
In other words, when I type in Rcmd build -binary PACKAGENAME I receive
an
error message: Rcmd is not recognized as an internal  I suspect
that
this is because Rcmd.exe is no longer installed in the bin folder, but
rather, in the x64 folder within bin.  Please help!



What I've done so far:

1)  Downloaded and installed the latest version of Rtools (as of
October
21, 2011).

2)  During installation of Rtools, I included the following in the
path:
C:\Progra~1\R\R-2.13.2\bin\x64 and confirmed that this is on the path.

3)  Read every help manual I can find, but I can't seem to locate the
answer to this problem.



Other information:

R version 2.13.2 (2011-09-30)

Platform: x86_64-pc-mingw32/x64 (64-bit)



My windows version: Windows 7 Home Premium Service Pack 1 64-bit OS.



There is a batch command Rcmd.bat at http://batchfiles.googlecode.com
that when run will find R using the registry and then run the
appropriate Rcmd.exe so that you don't need to change your path or any
other environment variable.

Its a self contained .bat file so just place it anywhere on your
existing path.  At the Windows console this command will show you your
path:  path

Now try

Rcmd.bat build ...whatever...

If your path is not already set to find Rcmd.exe then Rcmd.bat can be
abbreviated to just Rcmd in the above line.



I wonder again and again why you try to obfuscate things by your layer of
non portable batchfiles. Typing the path correctly and according to the
syntax is required in both cases anyway.

Best,
Uwe

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



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


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


[R] sum of squares function

2011-11-13 Thread covfish87
hi, basic question

how do i write a function that sums the squares of elements in a vector of
any length?

thanks
Adam

--
View this message in context: 
http://r.789695.n4.nabble.com/sum-of-squares-function-tp4037402p4037402.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] identify duplicate from more than one column

2011-11-13 Thread jour4life
Hi Josh,

I'm sorry, it was meant for you. I guess for now that error doesn't
matter...for now. Essentially, I want to repeat the conditions that state
the following, and continue doing so for several variables.

At the end of the day, I'm only going to keep the couple ID and remove the
duplicates. But, before I do that, I want to see how I can write a line/s
that will let me observe both sexes (in the couple) and identify which one
has a certain characteristic and apply that to a new variable. For instance, 

if a male moved residence, but the woman did not, migration = 1, 
else if a woman moved residence, but not the man, migration = 2, 
else if both man and woman migrated, then migration = 3, etc...
else if both man nor woman did not migrate, then migration = 0

However, in order for me to program this and identify them to construct the
variables, I have to ensure that both are in the same couple id, and observe
both sexes in the couple before I remove the duplicates. I thought the
previous example would help me get at this problem, but it still does not
make sense to me.

Using the newly created coupleid (Thanks to you guys!) this is what I want
to see, where mig = migration: 1 = moved and 0 = did not move:

   coupleid home z sex agemigmig.new
1   01502918   11 053  13
2   01502918   12 049  13
3   01502901   11 038  02
4   01502901   12 033  12
5   01502902   11 036  13
6   01502902   12 033  13
7   01502903   11 023  00
8   01502903   12 019  00
9   01502904   11 045  02
10 01502905   12 047  12


I hope this makes sense, and thanks again, Josh!

Carlos

--
View this message in context: 
http://r.789695.n4.nabble.com/identify-duplicate-from-more-than-one-column-tp4035888p4037652.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] libary(Rweka) J48 design tree

2011-11-13 Thread RMSOPS
Hello everybody

I'm having some difficulties to design the decision tree algorithm J48.
I am using the following code and when I run it gives me the following
message
plot(m1)
Error in plot.Weka_tree(m1) : 
  Plotting of trees with multi-way splits is currently not implemented.


#The code
library(RWeka)
library(randomForest)
library(party)
if(require(mlbench, quietly = TRUE)  require(party, quietly = TRUE)) 
m1 - J48(income2 ~ age+workclass+native.country, data = dataset)
m1
plot(m1)
and results
#M1 Results
workclass = ?: =50K (1433.0/120.0)
workclass = Federal-gov: =50K (696.0/281.0)
workclass = Local-gov: =50K (1542.0/469.0)
workclass = Never-worked: =50K (5.0)
workclass = Private: =50K (16939.0/3705.0)
workclass = Self-emp-inc
|   age = 36: =50K (205.0/65.0)
|   age  36: 50K (652.0/247.0)
workclass = Self-emp-not-inc: =50K (1926.0/525.0)
workclass = State-gov: =50K (1010.0/262.0)
workclass = Without-pay: =50K (13.0/2.0)

Number of Leaves  : 10

Size of the tree :  12

I tried installing the package RGraphviz, but is not available in CRAN
repository.
I wonder if there is a package that lets you draw decision trees in a way
more effective than the library(party)

which the classification algorithms more efficient in R

Thanks

--
View this message in context: 
http://r.789695.n4.nabble.com/libary-Rweka-J48-design-tree-tp4037704p4037704.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] Running totals

2011-11-13 Thread Mark Carter
I have a table which looks like this:

  ACC    BAL
1 hal -171245.33
2 opn  -50487.63
3 pga  213440.38
4 prt   0.18
5 rbs    8292.54

How do I create a column which shows the running totals of the BAL columns?

[[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] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-13 Thread David Winsemius


On Nov 13, 2011, at 11:28 AM, Sammy Zee wrote:


dataset[ nrow(dataset), ] - c (Male, 5, bad)

The above seems to have worked to append a row in place of a  
rbind(). This method does not drop the custom attributes from the  
column. Do yo see any issue with this method.


Only that it wipes out whatever was in the last row, I suppose you  
could get around that issue by making a duplicate row:


dataset - dataset[ c(1:dataset, nrow(dataset)), ]
dataset[ nrow(dataset), ] - c (Male, 5, bad)

I generally use NROW rather than nrow but I cannot remember why.

--
David.



Thanks,
Sammy

On Sat, Nov 12, 2011 at 10:16 PM, David Winsemius dwinsem...@comcast.net 
 wrote:


On Nov 12, 2011, at 6:40 PM, Sammy Zee wrote:

Thanks David. Besides rbind(), is there any other way to add a row  
to a data frame so that I do not lose the custom attributes.


I have already told you the method that I know of. You don't seem to  
have taken my poin that it is not a data.frame specific problem but  
rahter a facor problem. You are welcome to redefine  
`rbind.data.frame`. The R language is rather flexible in that manner.


--
David.


Thanks,
Sammy

On Sat, Nov 12, 2011 at 5:17 PM, David Winsemius dwinsem...@comcast.net 
 wrote:


On Nov 12, 2011, at 2:47 PM, Sammy Zee wrote:

When I use rbind() or rbind.data.frame() to add a row to an existing
dataframe, it appears that attributes for the column of type  
factor are

dropped. See the sample example below to reproduce the problem. Please
suggest How I can fix this.


Thanks,
Sammy

a=c(Male, Male, Female, Male)
b=c(1,2,3,4)
c=c(great, bad, good, bad)
dataset- data.frame (gender = a, count = b, answer = c)

dataset

gender count answer
1   Male 1  great
2   Male 2bad
3 Female 3   good
4   Male 4bad


attributes(dataset$answer)
$levels
[1] bad   good  great

$class
[1] factor

Now adding some custom attributes to column dataset$answer

attributes(dataset$answer)-c(attributes(dataset 
$answer),list(newattr1=custom-attr1))
attributes(dataset$answer)-c(attributes(dataset 
$answer),list(newattr2=custom-attr2))


If you look through the code of rbind.data.frame you see that column  
values are processed with the 'factor' function.



 attributes(dataset$answer)
$levels
[1] bad   good  great

$class
[1] factor

$newattr1
[1] custom-attr1

$newattr2
[1] custom-attr2

 attributes(factor(dataset$answer))

$levels
[1] bad   good  great

$class
[1] factor


So I think you are out of luck. You will need to restore the  
special attributes yourself.


--
David.


attributes(dataset$answer)
$levels
[1] bad   good  great

$class
[1] factor

$newattr1
[1] custom-attr1

$newattr2
[1] custom-attr2

However as soon as I add a row to this data frame (dataset) by  
rbind(),

it loses the custom
attributes (newattr1 and newattr2) I have just added

newrow = c(gender=Female, count = 5, answer = great)

dataset - rbind(dataset, newrow)

attributes(dataset$answer)
$levels
[1] bad   good  great

$class
[1] factor

the two custom attributes are dropped!! Any suggestion why this is
happening.

On Fri, Nov 11, 2011 at 11:44 AM, Jeff Newmiller
jdnew...@dcn.davis.ca.uswrote:

As the doctor says, if it hurts don't do that.

A factor is a sequence of integers with a corresponding list of  
character
strings. Factors in two separate vectors can and usually do map the  
same
integer to different strings, and R cannot tell how you want that  
resolved.


Convert these columns to character before combining them, and only  
convert
to factor when you have all of your possibilities present (or you  
specify

them in the creation of the factor vector).
---
Jeff NewmillerThe .   .  Go  
Live...


Sammy Zee szee2...@gmail.com wrote:

Hi all,

When I use rbind() or rbind.data.frame() to add a row to an existing
dataframe, it appears that attributes for the column of type factor
are
dropped. I see the following post with same problem. However i did not
see
any reply to the following posting offering a solution. Could someone
please help.


http://r.789695.n4.nabble.com/rbind-data-frame-drops-attributes-for-factor-variables-td919575.html

Thanks,
Sammy

   [[alternative HTML version deleted]]

___


David Winsemius, MD
West Hartford, CT




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] sum of squares function

2011-11-13 Thread Joshua Wiley
Hi Adam,

You're in luck, arithmetic operations in R are vectorized so it does
not take any extra effort.

x - 1:10

sum(x^2)

cheers,

Josh

On Sun, Nov 13, 2011 at 12:20 PM, covfish87 covfis...@hotmail.co.uk wrote:
 hi, basic question

 how do i write a function that sums the squares of elements in a vector of
 any length?

 thanks
 Adam

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/sum-of-squares-function-tp4037402p4037402.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.




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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] Running totals

2011-11-13 Thread R. Michael Weylandt michael.weyla...@gmail.com
Table is not a regular data structure in R so I can't help further without a 
bit of clarification, but try ?cumsum and ?cbind. 

Michael 

On Nov 13, 2011, at 4:18 PM, Mark Carter mcturra2...@yahoo.co.uk wrote:

 I have a table which looks like this:
 
 � ACC��� BAL
 1 hal -171245.33
 2 opn� -50487.63
 3 pga� 213440.38
 4 prt�� 0.18
 5 rbs��� 8292.54
 
 How do I create a column which shows the running totals of the BAL columns?
 
[[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] Running totals

2011-11-13 Thread Joshua Wiley
Hi Mark,

Take a look at ?cumsum and see if this is what you want:

## your data output via dput() (easy to copy and paste from email to R)
dat - structure(list(ACC = c(hal, opn, pga, prt, rbs),
BAL = c(-171245.33,
-50487.63, 213440.38, 0.18, 8292.54)), .Names = c(ACC, BAL
), class = data.frame, row.names = c(1, 2, 3, 4, 5
))

dat$RTotal - cumsum(dat$BAL)

dat

 dat
  ACCBAL RTotal
1 hal -171245.33 -171245.33
2 opn  -50487.63 -221732.96
3 pga  213440.38   -8292.58
4 prt   0.18   -8292.40
5 rbs8292.54   0.14


Hope this helps,

Josh

On Sun, Nov 13, 2011 at 1:18 PM, Mark Carter mcturra2...@yahoo.co.uk wrote:
 I have a table which looks like this:

   ACC    BAL
 1 hal -171245.33
 2 opn  -50487.63
 3 pga  213440.38
 4 prt   0.18
 5 rbs    8292.54

 How do I create a column which shows the running totals of the BAL columns?

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





-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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] issue plotting TukeyHSD

2011-11-13 Thread Giovanni Azua
Hello,

When I try to use TukeyHSD in the following way it shows the confidence 
interval corresponding to the last factor only.

 throughput.aov - 
 aov(Throughput~No_databases+Partitioning+No_middlewares+Queue_size,data=throughput)

plot(TukeyHSD(throughput.aov)) # I expected here to see the confidence 
intervals for all factors but see only the last.

OTOH this one works but then it is unreadable due to the long labels of 
combined effects in the Y-axis ticks.

 throughput.aov - 
 aov(Throughput~No_databases*Partitioning*No_middlewares*Queue_size,data=throughput)

TIA,
Best regards,
Giovanni
__
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] 2^k*r (with replications) experimental design question

2011-11-13 Thread Giovanni Azua
Hello,

I have one replication (r=1 of the 2^k*r) of a 2^k experimental design in the 
context of performance analysis i.e. my response variables are Throughput and 
Response Time. I use the aov function and the results look ok:

 str(throughput)
'data.frame':   286 obs. of  7 variables:
 $ Time  : int  6 7 8 9 10 11 12 13 14 15 ...
 $ Throughput: int  42 44 33 41 43 40 37 40 42 37 ...
 $ No_databases  : Factor w/ 2 levels 1,4: 1 1 1 1 1 1 1 1 1 1 ...
 $ Partitioning  : Factor w/ 2 levels sharding,replication: 1 1 1 1 1 1 1 1 
1 1 ...
 $ No_middlewares: Factor w/ 2 levels 2,4: 1 1 1 1 1 1 1 1 1 1 ...
 $ Queue_size: Factor w/ 2 levels 40,100: 1 1 1 1 1 1 1 1 1 1 ...
 $ No_clients: Factor w/ 1 level 128: 1 1 1 1 1 1 1 1 1 1 ...
 head(throughput)
  Time Throughput No_databases Partitioning No_middlewares Queue_size 
16 421 sharding  2 40 
27 441 sharding  2 40
38 331 sharding  2 40
49 411 sharding  2 40
5   10 431 sharding  2 40
6   11 401 sharding  2 40
 
 throughput.aov - 
 aov(Throughput~No_databases+Partitioning+No_middlewares+Queue_size,data=throughput)
 summary(throughput.aov)
  DfSum Sq  Mean Sq F valuePr(F)
No_databases   128488651 28488651 53.4981 2.713e-12 ***
Partitioning17168771687  0.1346  0.713966
No_middlewares   1 5624454  5624454 10.5620  0.001295 ** 
Queue_size  1 5089250892  0.0956  0.757443
Residuals 281 149637226   532517  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
 

This is somehow what I expected and I am happy, it is saying that the 
Throughput is significatively affected firstly by the number of database 
instances and secondly by the number of middleware instances.

The problem is that I need to integrate multiple replications of this same 2^k 
so I can also account for experimental error i.e. the _r_ of 2^k*r but I can't 
see how to integrate the _r_ term into the data and into the aov function 
parameters. Can anyone advice?  

TIA,
Best regards,
Giovanni
__
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] 2^k*r (with replications) experimental design question

2011-11-13 Thread Dennis Murphy
I'm guessing you have nine replicates of a 2^5 factorial design with a
couple of missing values. If so, define a variable to designate the
replicates and use it as a blocking factor in the ANOVA. If you want
to treat the replicates as a random rather than a fixed factor, then
look into the nlme or lme4 packages.

HTH,
Dennis

On Sun, Nov 13, 2011 at 4:33 PM, Giovanni Azua brave...@gmail.com wrote:
 Hello,

 I have one replication (r=1 of the 2^k*r) of a 2^k experimental design in the 
 context of performance analysis i.e. my response variables are Throughput and 
 Response Time. I use the aov function and the results look ok:

 str(throughput)
 'data.frame':   286 obs. of  7 variables:
  $ Time          : int  6 7 8 9 10 11 12 13 14 15 ...
  $ Throughput    : int  42 44 33 41 43 40 37 40 42 37 ...
  $ No_databases  : Factor w/ 2 levels 1,4: 1 1 1 1 1 1 1 1 1 1 ...
  $ Partitioning  : Factor w/ 2 levels sharding,replication: 1 1 1 1 1 1 1 
 1 1 1 ...
  $ No_middlewares: Factor w/ 2 levels 2,4: 1 1 1 1 1 1 1 1 1 1 ...
  $ Queue_size    : Factor w/ 2 levels 40,100: 1 1 1 1 1 1 1 1 1 1 ...
  $ No_clients    : Factor w/ 1 level 128: 1 1 1 1 1 1 1 1 1 1 ...
 head(throughput)
  Time Throughput No_databases Partitioning No_middlewares Queue_size
 1    6         42            1     sharding              2         40
 2    7         44            1     sharding              2         40
 3    8         33            1     sharding              2         40
 4    9         41            1     sharding              2         40
 5   10         43            1     sharding              2         40
 6   11         40            1     sharding              2         40

 throughput.aov - 
 aov(Throughput~No_databases+Partitioning+No_middlewares+Queue_size,data=throughput)
 summary(throughput.aov)
                              Df    Sum Sq  Mean Sq F value    Pr(F)
 No_databases       1    28488651 28488651 53.4981 2.713e-12 ***
 Partitioning            1    71687    71687  0.1346  0.713966
 No_middlewares   1     5624454  5624454 10.5620  0.001295 **
 Queue_size          1     50892    50892  0.0956  0.757443
 Residuals             281 149637226   532517
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


 This is somehow what I expected and I am happy, it is saying that the 
 Throughput is significatively affected firstly by the number of database 
 instances and secondly by the number of middleware instances.

 The problem is that I need to integrate multiple replications of this same 
 2^k so I can also account for experimental error i.e. the _r_ of 2^k*r but I 
 can't see how to integrate the _r_ term into the data and into the aov 
 function parameters. Can anyone advice?

 TIA,
 Best regards,
 Giovanni
 __
 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] 2^k*r (with replications) experimental design question

2011-11-13 Thread Giovanni Azua
Hi Denis,

Thank you again :) what do you exactly mean with blocking factor, that it 
will be like the others? I'd prefer not to treat the replicates as random but 
rather account for the experimental error using the replicates. 

Ahhh I see what you mean, so the experimental error will show up as the SS of 
my new variable Replicate ... great!

Thank you!
Best regards,
Giovanni

On Nov 14, 2011, at 2:38 AM, Dennis Murphy wrote:

 I'm guessing you have nine replicates of a 2^5 factorial design with a
 couple of missing values. If so, define a variable to designate the
 replicates and use it as a blocking factor in the ANOVA. If you want
 to treat the replicates as a random rather than a fixed factor, then
 look into the nlme or lme4 packages.
 
 HTH,
 Dennis
 
 On Sun, Nov 13, 2011 at 4:33 PM, Giovanni Azua brave...@gmail.com wrote:
 Hello,
 
 I have one replication (r=1 of the 2^k*r) of a 2^k experimental design in 
 the context of performance analysis i.e. my response variables are 
 Throughput and Response Time. I use the aov function and the results look 
 ok:
 
 str(throughput)
 'data.frame':   286 obs. of  7 variables:
  $ Time  : int  6 7 8 9 10 11 12 13 14 15 ...
  $ Throughput: int  42 44 33 41 43 40 37 40 42 37 ...
  $ No_databases  : Factor w/ 2 levels 1,4: 1 1 1 1 1 1 1 1 1 1 ...
  $ Partitioning  : Factor w/ 2 levels sharding,replication: 1 1 1 1 1 1 
 1 1 1 1 ...
  $ No_middlewares: Factor w/ 2 levels 2,4: 1 1 1 1 1 1 1 1 1 1 ...
  $ Queue_size: Factor w/ 2 levels 40,100: 1 1 1 1 1 1 1 1 1 1 ...
  $ No_clients: Factor w/ 1 level 128: 1 1 1 1 1 1 1 1 1 1 ...
 head(throughput)
  Time Throughput No_databases Partitioning No_middlewares Queue_size
 16 421 sharding  2 40
 27 441 sharding  2 40
 38 331 sharding  2 40
 49 411 sharding  2 40
 5   10 431 sharding  2 40
 6   11 401 sharding  2 40
 
 throughput.aov - 
 aov(Throughput~No_databases+Partitioning+No_middlewares+Queue_size,data=throughput)
 summary(throughput.aov)
  DfSum Sq  Mean Sq F valuePr(F)
 No_databases   128488651 28488651 53.4981 2.713e-12 ***
 Partitioning17168771687  0.1346  0.713966
 No_middlewares   1 5624454  5624454 10.5620  0.001295 **
 Queue_size  1 5089250892  0.0956  0.757443
 Residuals 281 149637226   532517
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 
 
 This is somehow what I expected and I am happy, it is saying that the 
 Throughput is significatively affected firstly by the number of database 
 instances and secondly by the number of middleware instances.
 
 The problem is that I need to integrate multiple replications of this same 
 2^k so I can also account for experimental error i.e. the _r_ of 2^k*r but I 
 can't see how to integrate the _r_ term into the data and into the aov 
 function parameters. Can anyone advice?
 
 TIA,
 Best regards,
 Giovanni
 __
 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] identify duplicate from more than one column

2011-11-13 Thread William Dunlap
You might find reshape() useful here.  Use sex as the 'time'
variable so you get a row for each couple containing the age and
other data for each member of the couple.  That format makes
it easy to compare the ages (or migration status, etc.) of members
of one couple.

You need to define an idvar here, basically a couple identifier
and I made it by pasting together the unit and home numbers:

 dat$unit_home - paste(dat$unit, dat$home, sep=_)
 reshape(dat, timevar=sex, times=c(1,2), idvar=unit_home, direction=wide)
   unit_home obs.1 unit.1 home.1 z.1 age.1 obs.2 unit.2 home.2 z.2 age.2
1   15029_18 1  15029 18   153 2  15029 18   149
315029_1 3  15029  1   138 4  15029  1   133
515029_2 5  15029  2   136 6  15029  2   133
715029_3 7  15029  3   123 8  15029  3   119
915029_4NA NA NA  NANA 9  15029  4   145
10   15029_5NA NA NA  NANA10  15029  5   147

or, to make things clearer, make sex into a factor:

 dat$sex - factor(dat$sex, levels=1:2, labels=c(M,F))
 reshape(dat, timevar=sex, times=c(M,F), idvar=unit_home, 
 direction=wide)
   unit_home obs.M unit.M home.M z.M age.M obs.F unit.F home.F z.F age.F
1   15029_18 1  15029 18   153 2  15029 18   149
315029_1 3  15029  1   138 4  15029  1   133
515029_2 5  15029  2   136 6  15029  2   133
715029_3 7  15029  3   123 8  15029  3   119
915029_4NA NA NA  NANA 9  15029  4   145
10   15029_5NA NA NA  NANA10  15029  5   147

reshape() doesn't do a lot of error checking.  If you have trios or same-sex
couples it will just take the first (I think) of each sex and ignore the rest.
If you want to ignore the non-couples, remove rows with any NA's in them.

This example is from stats::reshape().  Many people prefer to use the
reshape2 or reshape (or reshape3) packages.



Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 
 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf Of jour4life
 Sent: Sunday, November 13, 2011 1:47 PM
 To: r-help@r-project.org
 Subject: Re: [R] identify duplicate from more than one column
 
 Hi Josh,
 
 I'm sorry, it was meant for you. I guess for now that error doesn't
 matter...for now. Essentially, I want to repeat the conditions that state
 the following, and continue doing so for several variables.
 
 At the end of the day, I'm only going to keep the couple ID and remove the
 duplicates. But, before I do that, I want to see how I can write a line/s
 that will let me observe both sexes (in the couple) and identify which one
 has a certain characteristic and apply that to a new variable. For instance,
 
 if a male moved residence, but the woman did not, migration = 1,
 else if a woman moved residence, but not the man, migration = 2,
 else if both man and woman migrated, then migration = 3, etc...
 else if both man nor woman did not migrate, then migration = 0
 
 However, in order for me to program this and identify them to construct the
 variables, I have to ensure that both are in the same couple id, and observe
 both sexes in the couple before I remove the duplicates. I thought the
 previous example would help me get at this problem, but it still does not
 make sense to me.
 
 Using the newly created coupleid (Thanks to you guys!) this is what I want
 to see, where mig = migration: 1 = moved and 0 = did not move:
 
coupleid home z sex agemigmig.new
 1   01502918   11 053  13
 2   01502918   12 049  13
 3   01502901   11 038  02
 4   01502901   12 033  12
 5   01502902   11 036  13
 6   01502902   12 033  13
 7   01502903   11 023  00
 8   01502903   12 019  00
 9   01502904   11 045  02
 10 01502905   12 047  12
 
 
 I hope this makes sense, and thanks again, Josh!
 
 Carlos
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/identify-duplicate-from-more-than-one-
 column-tp4035888p4037652.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, 

Re: [R] issue plotting TukeyHSD

2011-11-13 Thread David Winsemius


On Nov 13, 2011, at 7:22 PM, Giovanni Azua wrote:


Hello,

When I try to use TukeyHSD in the following way it shows the  
confidence interval corresponding to the last factor only.


throughput.aov - aov(Throughput~No_databases+Partitioning 
+No_middlewares+Queue_size,data=throughput)


plot(TukeyHSD(throughput.aov)) # I expected here to see the  
confidence intervals for all factors but see only the last.


OTOH this one works but then it is unreadable due to the long labels  
of combined effects in the Y-axis ticks.



throughput.aov - aov(Throughput~,data=throughput)


If thine name offend thee, pluck it out.

names(throughput) 
[c(No_databases,Partitioning,No_middlewares,Queue_size)] -

  c(N_db,part,N_midw,Qu_sz)

--

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] help with ggplot backgrounds

2011-11-13 Thread Hadley Wickham
You are more likely to receive helpful responses if you:

a) Provide a reproducible example (e.g.
https://github.com/hadley/devtools/wiki/Reproducibility)

b) Post to the ggplot2 mailing list.

Hadley

On Fri, Oct 28, 2011 at 5:03 PM, RanRL rnr...@gmail.com wrote:
 Hi, I have two questions regarding plotting of this dataset:

 Product Color    StoreA StoreB StoreC   Price

 A          Red      4          2        3        78
            Blue      5          2        2       78
           Greem    4         3         2       80

 B          Red       3     

 And so on (Not all products have same colors).

 I made 2 plots: one is a scatter where x=Price and y=Values (of different
 stores). The different stores are facet_wrapped, and Color is indicated by
 point color while Product by point_shape.
 Second plot is a polar plot of geom_bars with position=dodge for all
 Products to differentiate the colors. The y value is the value for each
 store (Price is not represented).

 My questions:
 1. for the first plot, I want to make a background area split into 3, top
 right is red (indicating high-price/high-values), middle is yellow, the rest
 is green (these are kind of reverse-log areas, like in heat maps).

 2. for the second plot, the red-yellow green are just background geom_rects
 filled in, but I cant figure out how to specify the xmin and xmax for this
 (since they are discrete variables).

 Any help will be appreciated, thanks.


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/help-with-ggplot-backgrounds-tp3949320p3949320.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.




-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

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


Re: [R] R v2.13.2 - Cannot find Rcmd on path?

2011-11-13 Thread Yihui Xie
Well, I just mean to give the user an option during installation --
like you did in Rtools. I have decided not to argue on this issue any
more. Thanks a lot anyway!

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 Sun, Nov 13, 2011 at 4:20 PM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
 On 11-11-13 1:15 PM, Yihui Xie wrote:

 I remember I was torn into pieces a few months back when I made a
 wishlist here that R adds its bin path to PATH on Windows during
 installation. People had tons of reasons of objection. Although I do
 not use these batchfiles (usually I do not actually use Windows), I
 see there is a motivation behind them: there needs to be an easy way
 for Windows users to use R in command line (e.g. R CMD build...). You
 may argue that it is easy to understand PATH and modify it manually,
 and I will say nothing but thank Windows again. Sorry this seems to
 be off-topic.

 I don't remember any rending and tearing, but I do remember objections to
 modifying the path during installation.  I wouldn't want to write code to do
 that, because it's hard:

 - Most people don't want to put R first, because it may hide something
 important.

 - Putting it last won't work if an earlier version is already there.

 So you need to examine the path and correct it, an automatic change is
 unlikely to be successful.

 But if you want to write code to do that, just go ahead and do it.  Put it
 in a package, even.

 Duncan Murdoch


 Regards,
 Yihui
 --
 Yihui Xiexieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA


__
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] libary(Rweka) J48 design tree

2011-11-13 Thread Achim Zeileis

On Sun, 13 Nov 2011, RMSOPS wrote:


Hello everybody

I'm having some difficulties to design the decision tree algorithm J48.
I am using the following code and when I run it gives me the following
message
plot(m1)
Error in plot.Weka_tree(m1) :
 Plotting of trees with multi-way splits is currently not implemented.


The package partykit which recently was released to CRAN should be able 
to help here:


library(partykit)
plot(as.party(m1))

Furthermore, write_to_dot(m1, m1.dot) can always be used as described in

  Kurt Hornik, Christian Buchta, Achim Zeileis (2009) Open-Source
  Machine Learning: R Meets Weka. Computational Statistics, 24(2),
  225-232. doi:10.1007/s00180-008-0119-7

Either use Graphviz directoy on the .dot file or employ Rgraphviz which is 
hosted at Bioconductor:


  http://www.Bioconductor.org/packages/release/bioc/html/Rgraphviz.html



#The code
library(RWeka)
library(randomForest)
library(party)
if(require(mlbench, quietly = TRUE)  require(party, quietly = TRUE))
m1 - J48(income2 ~ age+workclass+native.country, data = dataset)
m1
plot(m1)
and results
#M1 Results
workclass = ?: =50K (1433.0/120.0)
workclass = Federal-gov: =50K (696.0/281.0)
workclass = Local-gov: =50K (1542.0/469.0)
workclass = Never-worked: =50K (5.0)
workclass = Private: =50K (16939.0/3705.0)
workclass = Self-emp-inc
|   age = 36: =50K (205.0/65.0)
|   age  36: 50K (652.0/247.0)
workclass = Self-emp-not-inc: =50K (1926.0/525.0)
workclass = State-gov: =50K (1010.0/262.0)
workclass = Without-pay: =50K (13.0/2.0)

Number of Leaves  : 10

Size of the tree :  12

I tried installing the package RGraphviz, but is not available in CRAN
repository.
I wonder if there is a package that lets you draw decision trees in a way
more effective than the library(party)

which the classification algorithms more efficient in R

Thanks

--
View this message in context: 
http://r.789695.n4.nabble.com/libary-Rweka-J48-design-tree-tp4037704p4037704.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] Odp: Error in matrix, not ordered vectors or numerical value, and SIAR.

2011-11-13 Thread Petr PIKAL
Hi

 
 Hello Petr, 
 
 The demo's don't run either, with the same errors. 

In that case you shall contact the package maintainer and in a meantime 
you could try to debug the function yourself if you are in desperate need 
for the result.

Petr

 
 Thanks for your help. 
 
 Best wishes. 
 
 --
 View this message in context: http://r.789695.n4.nabble.com/Error-in-
 
matrix-not-ordered-vectors-or-numerical-value-and-SIAR-tp4024578p4033682.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] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-13 Thread Petr PIKAL
 
 dataset[ nrow(dataset), ] - c (Male, 5, bad)
 
 The above seems to have worked to append a row in place of a rbind(). 
This

No. It overwrites your last row. You maybe meant

dataset[ nrow(dataset)+1, ] - c (Male, 5, bad)

Regards
Petr


 method does not drop the custom attributes from the column. Do yo see 
any
 issue with this method.
 
 Thanks,
 Sammy
 
 On Sat, Nov 12, 2011 at 10:16 PM, David Winsemius 
dwinsem...@comcast.netwrote:
 
 
  On Nov 12, 2011, at 6:40 PM, Sammy Zee wrote:
 
   Thanks David. Besides rbind(), is there any other way to add a row to 
a
  data frame so that I do not lose the custom attributes.
 
 
  I have already told you the method that I know of. You don't seem to 
have
  taken my poin that it is not a data.frame specific problem but rahter 
a
  facor problem. You are welcome to redefine `rbind.data.frame`. The R
  language is rather flexible in that manner.
 
  --
  David.
 
 
  Thanks,
  Sammy
 
  On Sat, Nov 12, 2011 at 5:17 PM, David Winsemius 
dwinsem...@comcast.net
  wrote:
 
  On Nov 12, 2011, at 2:47 PM, Sammy Zee wrote:
 
  When I use rbind() or rbind.data.frame() to add a row to an existing
  dataframe, it appears that attributes for the column of type factor 
are
  dropped. See the sample example below to reproduce the problem. 
Please
  suggest How I can fix this.
 
 
  Thanks,
  Sammy
 
  a=c(Male, Male, Female, Male)
  b=c(1,2,3,4)
  c=c(great, bad, good, bad)
  dataset- data.frame (gender = a, count = b, answer = c)
 
  dataset
 
  gender count answer
  1   Male 1  great
  2   Male 2bad
  3 Female 3   good
  4   Male 4bad
 
 
  attributes(dataset$answer)
  $levels
  [1] bad   good  great
 
  $class
  [1] factor
 
  Now adding some custom attributes to column dataset$answer
 
  attributes(dataset$answer)-c(**attributes(dataset$answer),**
  list(newattr1=custom-attr1))
  attributes(dataset$answer)-c(**attributes(dataset$answer),**
  list(newattr2=custom-attr2))
 
  If you look through the code of rbind.data.frame you see that column
  values are processed with the 'factor' function.
 
 
   attributes(dataset$answer)
  $levels
  [1] bad   good  great
 
  $class
  [1] factor
 
  $newattr1
  [1] custom-attr1
 
  $newattr2
  [1] custom-attr2
 
   attributes(factor(dataset$**answer))
 
  $levels
  [1] bad   good  great
 
  $class
  [1] factor
 
 
  So I think you are out of luck. You will need to restore the special
  attributes yourself.
 
  --
  David.
 
 
  attributes(dataset$answer)
  $levels
  [1] bad   good  great
 
  $class
  [1] factor
 
  $newattr1
  [1] custom-attr1
 
  $newattr2
  [1] custom-attr2
 
  However as soon as I add a row to this data frame (dataset) by 
rbind(),
  it loses the custom
  attributes (newattr1 and newattr2) I have just added
 
  newrow = c(gender=Female, count = 5, answer = great)
 
  dataset - rbind(dataset, newrow)
 
  attributes(dataset$answer)
  $levels
  [1] bad   good  great
 
  $class
  [1] factor
 
  the two custom attributes are dropped!! Any suggestion why this is
  happening.
 
  On Fri, Nov 11, 2011 at 11:44 AM, Jeff Newmiller
  jdnew...@dcn.davis.ca.us**wrote:
 
  As the doctor says, if it hurts don't do that.
 
  A factor is a sequence of integers with a corresponding list of 
character
  strings. Factors in two separate vectors can and usually do map the 
same
  integer to different strings, and R cannot tell how you want that
  resolved.
 
  Convert these columns to character before combining them, and only 
convert
  to factor when you have all of your possibilities present (or you 
specify
  them in the creation of the factor vector).
  --**--**
  ---
  Jeff NewmillerThe .   .  Go
  Live...
 
  Sammy Zee szee2...@gmail.com wrote:
 
  Hi all,
 
  When I use rbind() or rbind.data.frame() to add a row to an existing
  dataframe, it appears that attributes for the column of type factor
  are
  dropped. I see the following post with same problem. However i did 
not
  see
  any reply to the following posting offering a solution. Could someone
  please help.
 
 
  http://r.789695.n4.nabble.com/**rbind-data-frame-drops-**
  attributes-for-factor-**variables-td919575.htmlhttp://r.
 789695.n4.nabble.com/rbind-data-frame-drops-attributes-for-factor-
 variables-td919575.html
 
  Thanks,
  Sammy
 
 [[alternative HTML version deleted]]
 
  ___
 
 
  David Winsemius, MD
  West Hartford, CT
 
 
 
[[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 

Re: [R] Problem with simple random slope in gam and bam (mgcv package)

2011-11-13 Thread Simon Wood

Martijn,

This was a problem in summary.gam handling re terms with largish 
datasets: I've uploaded a fix for this in mgcv_1.7-11. Hopefully on cran 
in the next few days.


best,
Simon

On 09/11/11 12:41, Martijn Wieling wrote:

Dear useRs,

This is the first time I post to this list and I would appreciate any
help available. I've used the excellent mgcv package for a while now
to investigate geographical patterns of language variation, and it has
has always worked without any problems for me. The problem below
occurs using R 2.14.0 (both 32 and 64 bit versions in Windows and the
64 bit version in Unix) and mgcv (both version 1.7-10 and 1.7-6).

In my (simplified) model predicting pronunciation distance I'd like to
include a random slope per Participant for a binary value (IsDem)
which stores a word-specific characteristic. I load the data
(available at http://www.martijnwieling.nl/dat.csv) and run the model
as follows:


library(mgcv) # version 1.7-10, but problem also occurs with earlier versions 
(e.g., 1.7-6)
dat = read.csv('dat.csv',header=T) # data available at: 
http://www.martijnwieling.nl/dat.csv
dim(dat) # the original dataset is larger, but the problem also occurs in this 
subset

[1] 2 4

model = bam(PronDist ~ s(Participant,IsDem,bs=re), data=dat)
print(model) # works fine
summary(model, freq=T) # works fine
summary(model) # the Bayesian p-value estimation does not work:

Error in eigen(B, symmetric = TRUE) : infinite or missing values in 'x'

I obviously am interested in more complex models, but whenever I
include any binary value as a by-word or by-participant random slope I
get the same error. I've tried to locate the error and it appears to
occur in the function pinvXVX in the block which 'deals with the
fractional part of the pinv'.

Any help would be appreciated!

With kind regards,

Martijn Wieling
University of Groningen
http://www.martijnwieling.nl

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




--
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603   http://people.bath.ac.uk/sw283

__
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 development master class: NYC, Dec 12-13

2011-11-13 Thread peter dalgaard

On Nov 13, 2011, at 20:53 , Alex Ruiz Euler wrote:

 
 Ha! Point publicly acknowledged.
 
 Best,
 A.
 

At any rate, R-help has always allowed R-related course announcements, 
commercial or not. The position has been that as long as it is of interest for 
R users and not overly intrusive, it is accepted. (Posters need to beware the 
potential negative publicity from perceived spamming, though.) 

R developers have been enrolled as teachers for commercial courses (as well as 
non-commercial or semi-commercial ones) and of course been paid for their work. 
I don't see a particular problem with someone cutting out the middle man.

Peter D.

 
 On Sun, 13 Nov 2011 13:41:36 -0600
 Hadley Wickham had...@rice.edu wrote:
 
 No seriously, as much as I'm for free enterprise, it feels awkward to
 see you promote an (expensive!) course in a list where people offer not
 only their knowledge, but also the tools you use, for free.
 
 You might have a point if I taught this course instead of offering
 knowledge and code for free, but I do it as well.  

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


[R] What is the CADF test criterion=BIC report?

2011-11-13 Thread p99323005

Hello:
  I am a rookie in using R. When I used the unit root test in  
CADFtest, I got the different t-test statistics between using  
criterion=BIC and no using criterion. But when I checked the result  
with eviews, I find out that no using criterion is correct. Why after  
using criterion=BIC, I got the different result?



Paul



data(Canada)



ADFt - CADFtest(Canada[,1], max.lag.y = 14, criterion=BIC)



summary(ADFt)

Augmented DF test
ADF test
t-test statistic:  -1.389086
p-value:0.855681
Max lag of the diff. dependent variable:1.00

Call:
dynlm(formula = formula(model), start = obs.1, end = obs.T)

Residuals:
 Min   1Q   Median   3Q  Max
-0.79726 -0.20587 -0.03332  0.23840  0.70460

Coefficients:
 Estimate Std. Error t value Pr(|t|)
(Intercept) 24.342321  17.435476   1.3960.167
trnd 0.009959   0.006941   1.4350.156
L(y, 1) -0.026068   0.018767  -1.3890.856
L(d(y), 1)   0.615983   0.092632   6.650 7.18e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.3533 on 65 degrees of freedom
Multiple R-squared: 0.413,  Adjusted R-squared: 0.3859
F-statistic:NA on NA and NA DF,  p-value: NA


ADFt1 - CADFtest(Canada[,1], max.lag.y =1)



summary(ADFt1)

Augmented DF test
 ADF test
t-test statistic:  -2.7285715
p-value:0.2282588
Max lag of the diff. dependent variable:1.000

Call:
dynlm(formula = formula(model), start = obs.1, end = obs.T)

Residuals:
 Min   1Q   Median   3Q  Max
-0.84769 -0.24745 -0.02081  0.24187  0.82344

Coefficients:
 Estimate Std. Error t value Pr(|t|)
(Intercept) 47.661910  17.439021   2.733  0.00776 **
trnd 0.019217   0.007005   2.743  0.00754 **
L(y, 1) -0.051256   0.018785  -2.729  0.22826
L(d(y), 1)   0.753011   0.075724   9.944 1.61e-15 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.3937 on 78 degrees of freedom
Multiple R-squared: 0.5674, Adjusted R-squared: 0.5508
F-statistic:NA on NA and NA DF,  p-value: NA

__
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] identify duplicate from more than one column

2011-11-13 Thread jour4life
Hi William,

This worked like a charm! I was thinking about using reshape(), but was
unsure on how to approach it. Though I have a whole lot of variables, I
decided to keep only those variables that contained both sexes'
characteristics, reshape it into wide format, and merge with the rest of the
data later and it worked perfectly. 

Thanks you guys so much. All ideas were great and I greatly appreciate your
help!!

Best,

Carlos

--
View this message in context: 
http://r.789695.n4.nabble.com/identify-duplicate-from-more-than-one-column-tp4035888p4038380.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] rJava .jinit() : Cannot create Java virtual machine (-1)

2011-11-13 Thread ahwangyuwei
Hi,

I have the same problem in R, and I want to ask you that how to solve the 
problem.
Thank you very much.
Wang
2011-11-14 



ahwangyuwei 

[[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] Confused with an error message related to plotrix library in the newer versions of R.

2011-11-13 Thread Prasanth V P
Dear R Users,



Greetings!



I am confused with an error message related to plotrix library in the
newer versions of R.

I used to run an R script without fail in the earlier versions (R 2.8.1) of
R; but the same script is now throwing up an error message in the newer
versions (Now I have R 2.13.0  R 2.14.0).



Herewith I am furnishing the same code for your perusal. It would have been
better if somebody could look into this matter and explain in detail.



require(plotrix)



xy.pop - c(17,15,13,11,9,8,6,5,4,3,2,2,1,3)

xx.pop - c(17,14,12,11,11,8,6,5,4,3,2,2,2,3)

agelabels - c(0-4,5-9,10-14,15-19,20-24,25-29,30-34,


35-39,40-44,45-49,50-54,55-59,60-64,65+)



xycol-color.gradient(c(0,0,0.5,0.15),c(0.25,0.5,0.5,1.75),c(0.5,1.5,1,0),18)

xxcol-color.gradient(c(0,1,0.5,1),c(0.25,0.5,0.5,1.25),c(0.5,0.25,0.5,1.5),18)

par(mar=pyramid.plot(xy.pop,xx.pop,labels=agelabels, labelcex=1.125,

main=Population Pyramid -- Malawi, xycol=xycol,
xxcol=xxcol))



Much Appreciated,

*Prasanth, V.P.*
Global Manager – Biometrics


Delta Technology  Management Services Pvt Ltd,
Plot No: 13/2, Sector - I,
Third Floor, HUDA Techno Enclave,
Madhapur, Hyderabad - 500 081.
(  : +91-40-3028 2113
È: +91-9848 290025

*  : vprasa...@deltaintech.com



**

‘The information contained in this email is confidential and may contain
proprietary information. It is meant solely for the intended recipient.
Access to this email by anyone else is unauthorized. If you are not the
intended recipient, any disclosure, copying, distribution or any action
taken or omitted in reliance on this, is prohibited and may be unlawful. No
liability or responsibility is accepted if information or data is, for
whatever reason corrupted or does not reach its intended recipient. No
warranty is given that this email is free of viruses. The views expressed
in this email are, unless otherwise stated, those of the author and not
those of DELTA Technology and Management Services pvt ltd or its
management. DELTA Technology and Management Services pvt ltd reserves the
right to monitor intercept and block emails addressed to its users or take
any other action in accordance with its email use policy’

Thank you in advance for your cooperation.

**

P Please don't print this e-mail unless you really need to.

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