Re: [R] Linear models interaction

2010-02-25 Thread Dieter Menne


gauravbhatti wrote:
> 
> My data looks like following:
> cera3[i, ] batch lcl29 pdt
> Untreated 3.185867 1 0   0
> Untreated.4   3.185867 0 0   0
> LCL29  4.357552 1 1   0
> LCL29.6   3.446256 0 1   0
> PDT   2.765535 1 0   1
> PDT.5 3.584963 0 0   1
> PDT+LCL29.1   2.867896 1 1   1
> PDT+LCL29.3   2.827819 0 1   1
> 
> As you can see there are three factorls batch , lcl29 and pdt. I am trying
> to fit the model: 
> Y = batch +pdt*lcl29. I get the following coefficients:
> Estimate Std. Errort value Pr(>|t|)
> (Intercept)  3.1524122  0.2487796 12.6715049 1.242191e-12
> batch1  -0.2267947  0.2291590 -0.9896827 3.314508e-01
> lcl291   0.6350186  0.3122910  2.0334194 5.233525e-02
> pdt1 0.1046388  0.3122910  0.3350684 7.402619e-01
> lcl291:pdt1 -0.6633316  0.4521381 -1.4670995 1.543419e-01
> 
> I know that the coef. of lcl291 i.e 0.635 is difference in means between
> rows with lcl29 present alone and untreated ones. 
> 
> Same is true for the coef of PDT1. However I am not sure about the
> coefficient of  lcl291:pdt1. 
> where does this value come from? How is it calculated?
> ...
> 

Your interpretation is risky, because it strictly is not the difference
between groups, but the slope of a linear regression when batch is numeric.
For a two-level factor, the result is the same, but I strongly recommend
that you use something like

mydata$batch = as.factor(mydata$batch)

and similar for the other factors and redo the fit. Or, better, even give
the factor levels names ("Placebo", "Test") instead of 0,1, that makes for
much nicer plots and tables.

The interaction can be understood as the correction to the simple additive
hypothesis (with a + instead of *) for the second levels of the factors. If
it is very small, the effect of the combination of the levels is
approximately the sum of the individual effects.

Dieter







-- 
View this message in context: 
http://n4.nabble.com/Linear-models-interaction-tp1569497p1570269.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] two questions for R beginners

2010-02-25 Thread Dieter Menne


Patrick Burns wrote:
> 
> * What were your biggest misconceptions or
> stumbling blocks to getting up and running
> with R?
> 
> 
(This derives partly from teaching)

The fact that this xapply-stuff was not idempotent (worse: not always) and
that you need a monster like do.call() to straighten this out. Nowadays,
plyr comes close.

The concept of environment. With S it was worse, though.

That you cannot change values "passed by reference". I noted that the latter
is no problem for students who have not worked with c(++/#) before. That
there is only one return-result in functions.

"[" and the likes as an operator.

10 years ago, when I started, the message was: S4 is the future, S3 is
legacy. So I learned S4. Only to never use is in self-written code later.
Might be different for BioConductor people.

That sometimes you can use vectors not in data= (lattice), and sometimes not
(ggplot2). Still a VERY confusing inconsistency.

The "why-does-this-not-print" FAQ.

Why does par(oma..) not work with lattice?

Dieter


-- 
View this message in context: 
http://n4.nabble.com/two-questions-for-R-beginners-tp1569384p1570249.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] RODBC looping sql script

2010-02-25 Thread Bart Joosen

Hi,

You should use the paste command:

for (i in 1:length(vessel[,1])) {
query<-paste("Select * From vessel Where common.utility(", vessel[i,1],", ",
,vesselyear[i,2], ")", sep="")
final<-sqlQuery(channel,paste(query))
}

Bart


Jason Gasper wrote:
> 
> Dear R users,
> 
> I am querying an Oracle database using sqlQuery()  from the RODBC 
> package. What I would like to do is embed my R Sql query in a for loop.  
> For example
> suppose the data.frame "vessel" contains two columns: vessel[,1]= vessel 
> id and vessel[,2]=permit year
> 
> I am using  "vessel" as an input in a SQL based function that require 
> inputs of permit year and vessel id as described below:
> 
> query<-"Select * From vessel Where common.utility(vessel ID,vessel year)"
> 
> final<-sqlQuery(channel,paste(query))
> 
> Now suppose I want to loop through my vessel table such that the vessel 
> ID and vessel year  corresponds with  i:
> 
> for (i in 1:length(vessel[,1])) {
> query<-"Select * From vessel Where common.utility(vessel[i,1],vessel 
> year[i,2])"
> "
> final<-sqlQuery(channel,paste(query))
> 
> }
> Ignoring the fact I didn't include code to create and ever expanding 
> final table for loop,  does anyone know how to index inside the Where 
> clause of a sql statement (i.e., common.utility(vessel[i,1],vessel 
> year[i,2])? 
> 
>  
> 
> 
> 
> -- 
> Jason Gasper
> National Marine Fisheries Service
> Alaska Region, Sustainable Fisheries Division
> 709 W. 9th St. Juneau, Alaska 99801 
> Juneau, Alaska 99801
> 
> Phone  907-586-7237
> Fax 907-586-7249
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://n4.nabble.com/RODBC-looping-sql-script-tp1570038p1570237.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] TukeyHSD troubles

2010-02-25 Thread Bart Joosen

treat_code isn't a factor, but a numeric variable.

You should use:
summary(aov(EtoH~as.factor(treat_code), mydata))
TukeyHSD(aov(EtoH~as.factor(treat_code), mydata))


Bart
-- 
View this message in context: 
http://n4.nabble.com/TukeyHSD-troubles-tp1570205p1570228.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] TukeyHSD troubles

2010-02-25 Thread RICHARD M. HEIBERGER
> treat_code is a dummy
> variable, but that shouldn't matter.  Any suggestions?

It does matter to TukeyHSD.  If treat_code is a numeric variable with discrete
values 0 and 1, then it does not have class "factor".  It is true that
aov will give the same
ANOVA table for a two-level factor as for a two-value numeric.  It will give
different ANOVA tables if there are more than two values.  TukeyHSD will refuse
to do anything for a numeric variable.  It insists on factors.

You must use the statement
  mydata$treat_code <- factor(mydata$treat_code)
before creating the aov object that you give to TukeyHSD.

Rich

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


[R] TukeyHSD troubles

2010-02-25 Thread Amy Freitag
I've tried to run a Tukey post-hoc but keep getting this weird error,
whether the aov was significant or not. treat_code is a dummy
variable, but that shouldn't matter.  Any suggestions?
Thanks
Amy

> summary(aov(EtoH~treat_code, mydata))
 Df Sum Sq Mean Sq F value   Pr(>F)
treat_code1  16.44   16.44  11.027 0.001014 **
Residuals   287 427.911.49
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> TukeyHSD(aov(EtoH~treat_code, mydata))
Error in TukeyHSD.aov(aov(EtoH ~ treat_code, mydata)) :
  no factors in the fitted model
In addition: Warning message:
In replications(paste("~", xx), data = mf) :
  non-factors ignored: treat_code


-- 
Amy Freitag
Ph.D. student, Marine Science and Conservation
Nicholas School for the Environment
Duke University
ae...@duke.edu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Updating a hexbinplot

2010-02-25 Thread Deepayan Sarkar
On Thu, Feb 25, 2010 at 1:24 AM, Marcin Kozak  wrote:
> Dear all,
>
> Considering this simple example of hexbinplot:
> mixdata <-
>     data.frame(x = c(rnorm(5000), rnorm(5000,4,1.5)),
>                y = c(rnorm(5000), rnorm(5000,2,3)),
>                a = gl(2, 5000))
> fig <- hexbinplot(y ~ x | a, mixdata)
> print(fig)
> update(fig, colramp = BTC)
>
> produces a bad (non-updated) legend. Compare it with:
>
> hexbinplot(y ~ x | a, mixdata, colramp = BTC)
>
> What should I do to update the plot with the correct legend?

Why not just use

hexbinplot(y ~ x | a, mixdata, colramp = BTC)

? In this (relatively simple) case, you could do

fig2 <- update(fig, colramp = BTC)
fig2$legend$right$args$colramp <- BTC
fig2

It should be possible to write an update method for hexbinplots to do
that automatically, but that doesn't happen currently (and I'm not
sure if it's worth the effort).

In general, an implicit assumption of the Trellis design is that the
panel display is independent of the legend. A much simpler example:

p <- xyplot(1:10 ~ 1:10, groups = gl(2, 5), auto.key = TRUE)
p
update(p, col = c("red", "blue"))

The simplest working solution in this case would be

update(p, par.settings = simpleTheme(col = c("red", "blue")))

but that actually involves several layers of patches on the original
design in S-PLUS (in particular, it actually changes the default
colors used by both panel and legend).

-Deepayan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Legend's attribute

2010-02-25 Thread Yi Du
Hi there,


I use plot(type="o") to draw the line. And I need put some legend to this
line. But how can I let the legend to display the line type in the graph
generated from type="o"? I can only find the lty in the legend. But I tried
several times and still failed.

Also, if I use abline(h=0.08) to draw a horizontal line and I also want to
show 0.08 in the y-axis, how can I do it?

Many thanks,


Yi

-- 
Yi Du
Ph. D student in Economics
University of Missouri
Department of Economics
118 Professional Building
Columbia MO  65211
1-573-239-6467

[[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] cloud() / wireframe()

2010-02-25 Thread Kim Jung Hwa
Hi All,

I need some help with how to define:

1. colors in levelplot()

2. fixing labels in auto.key() using wireframe(). Sometimes I get "points"
in legend and sometimes I'm getting different signs for each line like "plus
sign", "star", "circle", etc... how can I be consistent with these. I'm
aware of rectangles=TRUE, line=TRUE... but not sure how am I getting it
different every other time I run same script.

Thanks in advance...
Kim

[[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] Ordering categories on a boxplot - a serious trap??

2010-02-25 Thread Ista Zahn
Hi Wilhelm,
I agree it's confusing to have a levels() function that does something
so different from the levels argument of the factor function.
Personally I use levels() only as an extractor, never to change
levels. For that I use factor(), with the levels and labels arguments
as needed.

Best,
Ista

On Thu, Feb 25, 2010 at 8:40 PM, Schwab,Wilhelm K  wrote:
> Phil,
>
> That works[*], but I still think there is a big problem given how easy it is 
> to do the wrong thing, and that searches lead to dangerous instructions.  
> Hopefully this will serve to keep others out of trouble, but so might an 
> immutable return value from levels().
>
> [*] I have not yet done anything with selecting parts of the data frame.  
> Using a separate factor, I quickly hit trouble with size mismatches, though I 
> could probably work around them by recreating the factor after any such 
> change.  Proceeding with caution...
>
> Bill
>
> ---
> Wilhelm K. Schwab, Ph.D.
>
>
>
> -Original Message-
> From: Phil Spector [mailto:spec...@stat.berkeley.edu]
> Sent: Thursday, February 25, 2010 7:06 PM
> To: Schwab,Wilhelm K
> Subject: Re: [R] Ordering categories on a boxplot - a serious trap??
>
> Wilhelm -
>    I don't know if this is correct for your problem because you didn't 
> provide a reproducible example, but perhaps you could try
>
> v$doseGroup = factor(v$doseGroup,levels=c("L", "M", "H"))
>
> instead of setting the levels directly.
>
>                                        - Phil Spector
>                                         Statistical Computing Facility
>                                         Department of Statistics
>                                         UC Berkeley
>                                         spec...@stat.berkeley.edu
>
> On Thu, 25 Feb 2010, Schwab,Wilhelm K wrote:
>
>> Hello all,
>>
>> I think I probably did something stupid, and R's part was to allow me to do 
>> it.  My goal was to control the order of factor levels appearing 
>> horizontally on a boxplot.  Enter search engines and perhaps some creative 
>> stupidity on my part, and I came up with the following:
>>
>>       v=read.table("factor-order.txt",header=TRUE);
>>       levels(v$doseGroup) = c("L", "M", "H");
>>       boxplot(v$dose~v$doseGroup);
>>
>>
>> A good way to see the trap is to evaluate:
>>
>>       v=read.table("factor-order.txt",header=TRUE);
>>       par(mfrow=c(2,1));
>>       boxplot(v$dose~v$doseGroup);
>>       levels(v$doseGroup) = c("L", "M", "H");
>>       boxplot(v$dose~v$doseGroup);
>>       par(mfrow=c(1,1));
>>
>> The above creates two plots, one correct with the factors in an inconvient 
>> order, and one that is WRONG.  In the latter, the labels appear in the 
>> desired order, but the data does not "move with them."  I did not discover 
>> the problem until I repeated the same type of plot with something that had a 
>> known relationship with the levels, and the result was clearly not correct.
>>
>> I *think* the problem is to assign to the return value of levels().
>> How did I think to do that?  I'm not really sure, but please look at
>>
>>  https://stat.ethz.ch/pipermail/r-help/2008-August/171884.html
>>
>>
>> Perhaps it does not say to do exactly what I did, but it sure was easy to 
>> follow to the mistake, it appeared to do what I wanted, and the consequences 
>> of the mistake are ugly.  Perhaps levels() should return something that is 
>> immutable??  If I am looking at this correctly, levels() is an accident 
>> waiting to happen.
>>
>> What should I have done?  It seems:
>>
>>       read data and order factor levels
>>       v=read.table("factor-order.txt",header=TRUE);
>>       group = factor(v$doseGroup,levels = c("L", "M", "H") );
>>       boxplot(v$dose~group);
>>
>>
>> One disappointment is that the above factor() call apparently needs to be 
>> repeated for any subset of v - I'm still trying to get my mind around that 
>> one.
>>
>> Can anyone confirm this?  It strikes me as a trap that should be addressed 
>> so that an error results rather than a garbage graph.
>>
>> Bill
>>
>>
>> ---
>> Wilhelm K. Schwab, Ph.D.
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/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.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.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/p

[R] bwplot() {lattice}

2010-02-25 Thread Peng Cai
Hi All,

I'm trying to plot boxplot graph. I tried barchart with "groups=" option and
it worked fine. But when I try to generate same kind of graph using
bwplot(), "groups=" option doesn't seem to work. Though this works,

yield ~ variety | site * year

I'm thinking why "groups=" doesn't work in this case, can anyone help
please...

#Code:
library(lattice)
barchart(yield ~ variety | site, data = barley,
 groups = year, layout = c(1,6),
 auto.key = list(points = FALSE, rectangles = TRUE, space = "right"))

bwplot(yield ~ variety | site, data = barley,
 groups = year, layout = c(6,1), scales=(x=list(rot=45)),
 auto.key = list(points = FALSE, rectangles = TRUE, space = "right"))

Thanks,

[[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] Plotting 15 million points

2010-02-25 Thread Abhishek Pratap
Hi All

I should have included this first up and I think I understand the
problem. The load on the server I was running R was  heavy which was
causing everything to slow up.

>summary(s)
   Min. 1st Qu.  MedianMean 3rd Qu.Max.
  2 182 2636086 343 463
> length(s)
[1] 16750589

hist(log(s,10),breaks=100)

Thanks!
-Abhi


On Thu, Feb 25, 2010 at 7:38 PM, Nordlund, Dan (DSHS/RDA)
 wrote:
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
>> Behalf Of Abhishek Pratap
>> Sent: Thursday, February 25, 2010 3:12 PM
>> To: r-help@r-project.org
>> Subject: [R] Plotting 15 million points
>>
>> Hi All
>>
>> I have a vector of about 15 million numbers which I would like to
>> plot. The goal is the see the distribution.  I tired the usual steps.
>>
>> 1. Histogram : never gets complete my window freezes w/out log base 10
>> 2. Density  : I first calculated the kernel density and then plotted
>> it which worked.
>>
>> It would be nice to superimpose histogram with density but as of now I
>> am not able to get this data as a histogram. I tried ggplot2 which
>> also hangs.
>>
>> Any efficient methods to play with > 10 million numbers in a vector.
>>
>> Thanks,
>> -Abhi
>>
>
> You need to show us what you did.  Generating 15 million random normals and 
> plotting a histogram worked just fine on my desktop in a matter of ~6 seconds.
>
>> x <- rnorm(15e6)
>> hist(x)
>
> Dan
>
> Daniel J. Nordlund
> Washington State Department of Social and Health Services
> Planning, Performance, and Accountability
> Research and Data Analysis Division
> Olympia, WA  98504-5204
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] S4 programming

2010-02-25 Thread Henrique Dallazuanna
Try this:

x...@y


On Thu, Feb 25, 2010 at 11:12 PM, Zhang,Yanwei  wrote:
>
> Dear all,
>
> I'm new to S4 classes and have a question on this. I want to use S4 because I 
> want to define explicitly the slots that the new class can have. But other 
> than that, the new class behaves exactly like a list. But this will not allow 
> me to use the generic functions that are already defined for class "list", 
> such as "$", "c", "[[",  "names" or "length".
>
> For example, I defined a new class "abc", and tried to use "$", "length", and 
> "[[", but they do not work (which is shown below). I know I could define 
> these methods for the new class, but is there an easy way to allow this new 
> class to inherit  all the functions that work for class "list"? I tried to 
> use contains="list", but this does not work either. Thanks for any help.
>
>> setClass("abc", representation(x="numeric",y="character",z="numeric"))
> [1] "abc"
>> xxx=new("abc",x=1,y="a",z=2)
>> xxx$a
> Error in xxx$a : $ operator not defined for this S4 class
>> length(xxx)
> [1] 1
>> xxx[[1]]
> Error in xxx[[1]] : this S4 class is not subsettable
>
>
>
> Wayne (Yanwei) Zhang
> Statistical Research
> CNA
>
>
>
>
>
> NOTICE:  This e-mail message, including any attachments and appended 
> messages, is for the sole use of the intended recipients and may contain 
> confidential and legally privileged information.
> If you are not the intended recipient, any review, dissemination, 
> distribution, copying, storage or other use of all or any portion of this 
> message is strictly prohibited.
> If you received this message in error, please immediately notify the sender 
> by reply e-mail and delete this message in its entirety.
>
>        [[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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] S4 programming

2010-02-25 Thread Zhang,Yanwei

Dear all,

I'm new to S4 classes and have a question on this. I want to use S4 because I 
want to define explicitly the slots that the new class can have. But other than 
that, the new class behaves exactly like a list. But this will not allow me to 
use the generic functions that are already defined for class "list", such as 
"$", "c", "[[",  "names" or "length".

For example, I defined a new class "abc", and tried to use "$", "length", and 
"[[", but they do not work (which is shown below). I know I could define these 
methods for the new class, but is there an easy way to allow this new class to 
inherit  all the functions that work for class "list"? I tried to use 
contains="list", but this does not work either. Thanks for any help.

> setClass("abc", representation(x="numeric",y="character",z="numeric"))
[1] "abc"
> xxx=new("abc",x=1,y="a",z=2)
> xxx$a
Error in xxx$a : $ operator not defined for this S4 class
> length(xxx)
[1] 1
> xxx[[1]]
Error in xxx[[1]] : this S4 class is not subsettable



Wayne (Yanwei) Zhang
Statistical Research
CNA





NOTICE:  This e-mail message, including any attachments and appended messages, 
is for the sole use of the intended recipients and may contain confidential and 
legally privileged information.
If you are not the intended recipient, any review, dissemination, distribution, 
copying, storage or other use of all or any portion of this message is strictly 
prohibited.
If you received this message in error, please immediately notify the sender by 
reply e-mail and delete this message in its entirety.

[[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] Including Rcpp in Eclipse C++ project

2010-02-25 Thread Dirk Eddelbuettel

Sam,

On 25 February 2010 at 11:01, Sam Garrett wrote:
| Hello. I am trying to include R in an eclipse C++ project so that I can use
| Rcpp and Rinside. Right now I have R installed on my Ubuntu machine and both
| plugins are installed too. I have the directories of the corresponding .so
| files set in the Project > Properties > Settings Gcc c++ linker under
| Library Search Path. Here is the error that I'm getting when I try to build
| my code:
| 
| >/home/sam/workspace/StockWatcher/Debug/StockWatcher: error while
| 
| >loading shared libraries: libR.so: cannot open shared object file:
| 
| >No such file or directory
| 
| >
| 
| Which doesn't make sense because I'm including the file under the settings
| and I've looked at the folder and the file is there. Any help would be
| greatly appreciated. Thank you!

That is between you and Eclipse. If you, say, cd into the examples/ directory
of RInside and say 'make', the example programs will build. Look at what
arguments are computed to g++ and copy those into your Eclipse settings.  Or
else -- use a Makefile which works for several other projects using Rcpp.  As
I do not use Eclipse myself, I cannot help you with its particularities.

Rcpp and RInside have their own 'rcpp-devel' list off the Rcpp R-Forge project.

Cheers, Dirk

-- 
  Registration is open for the 2nd International conference R / Finance 2010
  See http://www.RinFinance.com for details, and see you in Chicago in April!

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


Re: [R] two questions for R beginners

2010-02-25 Thread Saeed Abu Nimeh
On Thu, Feb 25, 2010 at 9:31 AM, Patrick Burns  wrote:
> * What were your biggest misconceptions or
> stumbling blocks to getting up and running
> with R?

1- Compared to other programming languages it is hard to learn R by
example, because it is hard to find code on the web that will do the
exact thing you are looking for, sometimes you might get lucky though.
By contrast, take Perl for example, it is an easy language to learn by
example.

2- The R mailing list. Beginners get frustrated after they struggle
for a long time to solve a problem and the easiest thing then is to
send an email to the R mailing list. I did this in the past. The best
thing that happened was that my request was neglected and I had to
spend more time on the problem and find a solution by myself
eventually. Do not get me wrong, I am not saying that the mailing list
is bad, but it should be more organized. Maybe broken down into couple
of other mailing lists. This might bring up a good discussion thread.

>
> * What documents helped you the most in this
> initial phase?

An Introduction to R by Venables
simpleR – Using R for Introductory Statistics by Verzani

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Heterogeneous Correlation Matrix with Survey Weights

2010-02-25 Thread John Fox
Dear Chris,

As you surmised, the functions in the polycor package make no provision for 
survey weights. You could get polychoric correlations by using weighted 
contingency tables as input, but that approach won't work for polyserial 
correlations.

Regards,
 John


John Fox
Senator William McMaster 
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Christopher T. Moore
> Sent: February-25-10 6:00 PM
> To: r-help@r-project.org
> Subject: [R] Heterogeneous Correlation Matrix with Survey Weights
> 
> Hello,
> 
> I have a data set containing categorical and ordinal factors, as well as
> sampling weights (i.e., survey weights reflecting unequal probabilities of
> selection). I want to fit a structural equation model with sem(). I have
> run sem() on weighted covariance matrices using advice from John Fox (see
>  and
>  date.html>).
> However, since I have categorical/ordinal variables, I would like to
> compute a weighted heterogeneous correlation matrix with hetcor().
> 
> Is there a way to do this in R? I couldn't find any guidance in the r-help
> archives or in the polycor help files. Should I truncate the sampling
> weights to integers and then populate the data set with redundant
> rows/cases so that the number of rows equals the population size
> (N>700,000)? Or is there a better way to compute a weighted heterogeneous
> correlation matrix?
> 
> Thanks,
> Chris
> 
> --
> Christopher T. Moore, M.P.P.
> Doctoral Student
> Quantitative Methods in Education
> University of Minnesota
> 44.9785°N, 93.2396°W
> moor0...@umn.edu
> http://umn.edu/~moor0554
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Accessing named elements of a vector

2010-02-25 Thread Henrique Dallazuanna
You can convert this to list:

as.list(vx)$a

On Thu, Feb 25, 2010 at 6:53 PM, Matthias Gondan  wrote:
> Dear R developers,
>
> A great R feature is that elements of vectors, lists and dataframes can have
> names:
>
> vx = c(a=1, b=2)
> lx = list(a=1, b=2)
>
> Accessing element "a" of vx: vx['a']
> Accessing element "a" of lx: lx[['a']] or lx$a
>
> Might be a matter of taste, but I like the $ very much. Unfortunately, vx$a
> is not
> functional. Would it break existing compatibility if the $ would be allowed
> to
> access elements of a vector, as well?
>
> Best regards,
>
> Matthias
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] RODBC looping sql script

2010-02-25 Thread Jason Gasper

Dear R users,

I am querying an Oracle database using sqlQuery()  from the RODBC 
package. What I would like to do is embed my R Sql query in a for loop.  
For example
suppose the data.frame "vessel" contains two columns: vessel[,1]= vessel 
id and vessel[,2]=permit year


I am using  "vessel" as an input in a SQL based function that require 
inputs of permit year and vessel id as described below:


query<-"Select * From vessel Where common.utility(vessel ID,vessel year)"

final<-sqlQuery(channel,paste(query))

Now suppose I want to loop through my vessel table such that the vessel 
ID and vessel year  corresponds with  i:


for (i in 1:length(vessel[,1])) {
query<-"Select * From vessel Where common.utility(vessel[i,1],vessel 
year[i,2])"

"
final<-sqlQuery(channel,paste(query))

}
Ignoring the fact I didn't include code to create and ever expanding 
final table for loop,  does anyone know how to index inside the Where 
clause of a sql statement (i.e., common.utility(vessel[i,1],vessel 
year[i,2])? 






--
Jason Gasper
National Marine Fisheries Service
Alaska Region, Sustainable Fisheries Division
709 W. 9th St. Juneau, Alaska 99801 
Juneau, Alaska 99801


Phone  907-586-7237
Fax 907-586-7249

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Ordering categories on a boxplot - a serious trap??

2010-02-25 Thread Schwab,Wilhelm K
Phil,

That works[*], but I still think there is a big problem given how easy it is to 
do the wrong thing, and that searches lead to dangerous instructions.  
Hopefully this will serve to keep others out of trouble, but so might an 
immutable return value from levels().

[*] I have not yet done anything with selecting parts of the data frame.  Using 
a separate factor, I quickly hit trouble with size mismatches, though I could 
probably work around them by recreating the factor after any such change.  
Proceeding with caution...

Bill

---
Wilhelm K. Schwab, Ph.D.



-Original Message-
From: Phil Spector [mailto:spec...@stat.berkeley.edu]
Sent: Thursday, February 25, 2010 7:06 PM
To: Schwab,Wilhelm K
Subject: Re: [R] Ordering categories on a boxplot - a serious trap??

Wilhelm -
I don't know if this is correct for your problem because you didn't provide 
a reproducible example, but perhaps you could try

v$doseGroup = factor(v$doseGroup,levels=c("L", "M", "H"))

instead of setting the levels directly.

- Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 spec...@stat.berkeley.edu

On Thu, 25 Feb 2010, Schwab,Wilhelm K wrote:

> Hello all,
>
> I think I probably did something stupid, and R's part was to allow me to do 
> it.  My goal was to control the order of factor levels appearing horizontally 
> on a boxplot.  Enter search engines and perhaps some creative stupidity on my 
> part, and I came up with the following:
>
>   v=read.table("factor-order.txt",header=TRUE);
>   levels(v$doseGroup) = c("L", "M", "H");
>   boxplot(v$dose~v$doseGroup);
>
>
> A good way to see the trap is to evaluate:
>
>   v=read.table("factor-order.txt",header=TRUE);
>   par(mfrow=c(2,1));
>   boxplot(v$dose~v$doseGroup);
>   levels(v$doseGroup) = c("L", "M", "H");
>   boxplot(v$dose~v$doseGroup);
>   par(mfrow=c(1,1));
>
> The above creates two plots, one correct with the factors in an inconvient 
> order, and one that is WRONG.  In the latter, the labels appear in the 
> desired order, but the data does not "move with them."  I did not discover 
> the problem until I repeated the same type of plot with something that had a 
> known relationship with the levels, and the result was clearly not correct.
>
> I *think* the problem is to assign to the return value of levels().  
> How did I think to do that?  I'm not really sure, but please look at
>
>  https://stat.ethz.ch/pipermail/r-help/2008-August/171884.html
>
>
> Perhaps it does not say to do exactly what I did, but it sure was easy to 
> follow to the mistake, it appeared to do what I wanted, and the consequences 
> of the mistake are ugly.  Perhaps levels() should return something that is 
> immutable??  If I am looking at this correctly, levels() is an accident 
> waiting to happen.
>
> What should I have done?  It seems:
>
>   read data and order factor levels
>   v=read.table("factor-order.txt",header=TRUE);
>   group = factor(v$doseGroup,levels = c("L", "M", "H") );
>   boxplot(v$dose~group);
>
>
> One disappointment is that the above factor() call apparently needs to be 
> repeated for any subset of v - I'm still trying to get my mind around that 
> one.
>
> Can anyone confirm this?  It strikes me as a trap that should be addressed so 
> that an error results rather than a garbage graph.
>
> Bill
>
>
> ---
> Wilhelm K. Schwab, Ph.D.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Building R packages in Windows 7

2010-02-25 Thread Duncan Murdoch

On 25/02/2010 7:56 PM, Eric Ferreira wrote:

Thank you, Sir, but how can I demand it to create HTML files?


The tools::Rd2HTML function will do the translation, but it takes a bit
of work to prepare input for it.  The idea is that you don't need to
save the files, R just produces them when the browser asks for them.

There's an option --enable-prebuilt-html that can be used when
installing a package, but I don't recommend using it.  You'll get the
help page as it exists at install time, not as it is intended to be
displayed at run time.  Links to other packages likely won't work properly.

Duncan Murdoch

P.S. Please copy your responses to the group, so that others can see the 
questions and answers.






On 25 February 2010 14:41, Duncan Murdoch  wrote:


On 25/02/2010 11:49 AM, Eric Ferreira wrote:


Ok,

I'm working under:
Windows 7 Professional 32bits, 4 GB RAM, 320 GB HD, Intel Core 2 Duo
processor
R 2.10.1

I've installed:
Rtools211
MikteX 2.8
HTML Help Workshop

Setting my PATH to:
c:\Rtools\bin;c:\Rtools\perl\bin;c:\Rtools\MinGW\bin;c:\Arquivos de
Programas\R\R-2.10.1pat\bin;c:\Arquivos de Programas\MikTeX
2.8\miktex\bin;c:\Program Files\HTML Help Workshop

...creating the package called "ExpDes" and asking (at the prompt) :

Rcmd build --binary ExpDes

Among others, a warning message is printed: "WARNING: some HTML links may
not be found", and no html files are produced.



Right, HTML help files are produced on demand, they aren`t stored in the
binary package zip file.  HTML Help Workshop is not being used at all.

Duncan Murdoch

 Thank you again.






On 25 February 2010 13:02, Duncan Murdoch  wrote:


On 25/02/2010 10:56 AM, Eric Ferreira wrote:


This is my first package. I'm just getting started doing that,

following

the
steps described on you website... I really don't know how I asking for
CHMs
to be produced, sorry.



All I can suggest is that you need to be less stingy with information.
 Tell us what you did.  Tell us what symptoms you saw.  Do both of those

by

cut and paste from your console, don't paraphrase, or refer to vague
instructions like "your website".

Duncan Murdoch



On 25 February 2010 12:52, Duncan Murdoch 

wrote:

On 25/02/2010 10:40 AM, Eric Ferreira wrote:


Dear Duncan

Thank so much for your reply.
Actually, I'm using the latest version of R and the problem

persists.

What

do you use instead of HTML Help Workshop for newer R versions?



We just produce text and HTML help pages on demand, and LaTeX ones

for

the

pdf manuals.  How are you asking for CHMs to be produced?

Duncan Murdoch

 Best regards

Eric.

On 25 February 2010 11:43, Duncan Murdoch 

wrote:

On 25/02/2010 9:06 AM, Eric Ferreira wrote:


Dear useRs,

I'm having trouble building R packages in Windows 7 regarding

HTML

help

Workshop.
Pointing PATH to c:\Program Files\HTML help Workshop does work in

Windows

(e.g. Vista) and does not in Windows 7.

Some tips??



We don't use the HTML Help Workshop any more since R 2.10.0, so

you

could

upgrade to the current R, and the problem will go away.

 Otherwise, I

think

you'll have to ask Microsoft for help.  But they aren't likely to

be

helpful:  Win XP is the most recent OS listed as supported.

Duncan Murdoch

























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


Re: [R] R and Wordpress

2010-02-25 Thread C.H.
I have found a partial solution to this. Wordpress will only chew the
first <- on a given post. Therefore, I add a comment with a <-.

e.g.

# <-
hello <- c(1,2,3)

WP will only break the first <-.


On Thu, Feb 25, 2010 at 9:33 PM, Steve Lianoglou
 wrote:
> Hi,
>
> On Wed, Feb 24, 2010 at 11:40 PM, C.H.  wrote:
>> Dear R helpers,
>>
>> I have a question regarding wordpress and R. I have asked this
>> question in Wordpress support (
>> http://wordpress.org/support/topic/368312 ) but there is no answer so
>> far, maybe the R community can have a better answer.
>>
>> I followed the excellent tutorial on r-statistics-blog (
>> http://www.r-statistics.com/2010/02/r-syntax-highlight-on-your-blog-a-wordpress-plugin/
>> ) to enable syntax hightlighting but Wordpress keeps breaking "<-"
>> into "< -" and I have to use "=" instead. (I think "=" is confusing.)
>> And I think it is not related to the theme as well.
>>
>> Is there any clue to solve this? I am using Wordpress 2.9.2.
>
> I'm guessing that your best bet is to ask the author of the blog that
> you linked to in your post ... just post a comment on that post there.
>
> -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
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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] two questions for R beginners

2010-02-25 Thread Patrick Burns

* What were your biggest misconceptions or
stumbling blocks to getting up and running
with R?

* What documents helped you the most in this
initial phase?

I especially want to hear from people who are
lazy and impatient.

Feel free to write to me off-list.  Definitely
write off-list if you are just confirming what
has been said on-list.

--
Patrick Burns
pbu...@pburns.seanet.com
http://www.burns-stat.com
(home of 'The R Inferno' and 'A Guide for the Unwilling S User')

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


Re: [R] Plotting 15 million points

2010-02-25 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Abhishek Pratap
> Sent: Thursday, February 25, 2010 3:12 PM
> To: r-help@r-project.org
> Subject: [R] Plotting 15 million points
> 
> Hi All
> 
> I have a vector of about 15 million numbers which I would like to
> plot. The goal is the see the distribution.  I tired the usual steps.
> 
> 1. Histogram : never gets complete my window freezes w/out log base 10
> 2. Density  : I first calculated the kernel density and then plotted
> it which worked.
> 
> It would be nice to superimpose histogram with density but as of now I
> am not able to get this data as a histogram. I tried ggplot2 which
> also hangs.
> 
> Any efficient methods to play with > 10 million numbers in a vector.
> 
> Thanks,
> -Abhi
> 

You need to show us what you did.  Generating 15 million random normals and 
plotting a histogram worked just fine on my desktop in a matter of ~6 seconds.

> x <- rnorm(15e6)
> hist(x)

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Subset Question

2010-02-25 Thread Chertudi

Thank you Eric and Petr.  It seems to be working now!
-- 
View this message in context: 
http://n4.nabble.com/Subset-Question-tp1568555p1569461.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] Subset Question

2010-02-25 Thread Chertudi

Thank you Eric and Petr.  It seems to be working now!
-- 
View this message in context: 
http://n4.nabble.com/Subset-Question-tp1568555p1569464.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] Ordering categories on a boxplot - a serious trap??

2010-02-25 Thread William Dunlap
> -Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of Schwab,Wilhelm K
> Sent: Thursday, February 25, 2010 3:51 PM
> To: r-help@r-project.org
> Subject: [R] Ordering categories on a boxplot - a serious trap??
> 
> Hello all,
> 
> I think I probably did something stupid, and R's part was to 
> allow me to do it.  My goal was to control the order of 
> factor levels appearing horizontally on a boxplot.  Enter 
> search engines and perhaps some creative stupidity on my 
> part, and I came up with the following:
> 
>   v=read.table("factor-order.txt",header=TRUE);
>   levels(v$doseGroup) = c("L", "M", "H");
>   boxplot(v$dose~v$doseGroup);

levels<- translated the current level labels into
another language, it did not change the integer
codes of the factor.  If you want to reorder the
levels call factor(..., levels=).  E.g.,

  > z <- factor(c("Small","Large","Medium","Small"))
  > str(z)
   Factor w/ 3 levels "Large","Medium",..: 3 1 2 3
  > str(factor(z, levels=c("Small","Medium","Large")))
   Factor w/ 3 levels "Small","Medium",..: 1 3 2 1

You can relabel them also by using the labels= argument
to factor
  > str(factor(z, levels=c("Small","Medium","Large"),
labels=c("S","M","L")))
 Factor w/ 3 levels "S","M","L": 1 3 2 1

Calling levels<- changes nothing but the level labels:
  > zcopy <- z
  > levels(zcopy) <- c("Small","Medium","Large")
  > str(zcopy)
Factor w/ 3 levels "Small","Medium",..: 3 1 2 3

levels<- is handy for low-level manipulations but not
for general use.  Even factor(,levels=) can be a bit
dangerous: if a new level is misspelled it will silently
add NA's to the data:
  > str(factor(z, levels=c("Smal", "Medium", "Large")))
   Factor w/ 3 levels "Smal","Medium",..: NA 3 2 NA

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> 
> 
> A good way to see the trap is to evaluate:
> 
>   v=read.table("factor-order.txt",header=TRUE);
>   par(mfrow=c(2,1));
>   boxplot(v$dose~v$doseGroup);
>   levels(v$doseGroup) = c("L", "M", "H");
>   boxplot(v$dose~v$doseGroup);
>   par(mfrow=c(1,1));
> 
> The above creates two plots, one correct with the factors in 
> an inconvient order, and one that is WRONG.  In the latter, 
> the labels appear in the desired order, but the data does not 
> "move with them."  I did not discover the problem until I 
> repeated the same type of plot with something that had a 
> known relationship with the levels, and the result was 
> clearly not correct.
> 
> I *think* the problem is to assign to the return value of 
> levels().  How did I think to do that?  I'm not really sure, 
> but please look at
> 
>   https://stat.ethz.ch/pipermail/r-help/2008-August/171884.html
> 
> 
> Perhaps it does not say to do exactly what I did, but it sure 
> was easy to follow to the mistake, it appeared to do what I 
> wanted, and the consequences of the mistake are ugly.  
> Perhaps levels() should return something that is immutable??  
> If I am looking at this correctly, levels() is an accident 
> waiting to happen.
> 
> What should I have done?  It seems:
> 
>   read data and order factor levels
>   v=read.table("factor-order.txt",header=TRUE);
>   group = factor(v$doseGroup,levels = c("L", "M", "H") );
>   boxplot(v$dose~group);
> 
> 
> One disappointment is that the above factor() call apparently 
> needs to be repeated for any subset of v - I'm still trying 
> to get my mind around that one.
> 
> Can anyone confirm this?  It strikes me as a trap that should 
> be addressed so that an error results rather than a garbage graph.
> 
> Bill
> 
> 
> ---
> Wilhelm K. Schwab, Ph.D.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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 ANOVA gives diferent results than SPSS

2010-02-25 Thread John Protzko
Thanks all of you.  the main problem I had then was it was not recognizing
one of my variables as a grouping variable, it was treating its numerical
values as data, not group designations.  Thanks for the help in clarifying.
I may be a regualr in calling for help on these R sited until I can get the
hand of this program

~John Protzko

On Thu, Feb 11, 2010 at 3:50 PM, Peter Ehlers  wrote:

> Comment inserted below.
>
>
> Greg Snow wrote:
>
>> A couple of possibilities:
>>
>> The data is not the same, e.g. something in the file was interpreted
>>
> differently by the 2 programs, one of the programs may have stopped
> reading at an unrecognized value, while the other skipped it and went
> on. Or it used to be common to encode missing values as -999, if one
> program recognizes that as missing, but you did not tell the other one
> too, then it could treat that as a legitimate value.
>
>>
>> The model is not the same, e.g. one program may be interpreting your
>>
> grouping variable as a continuous variable and the other as categorical,
> which would result in 2 very different models and outcomes.
>
> My money is on this one. I'm guessing that there is a grouping
> variable coded with levels 1,2,3,etc, and that R is not being
> told that this is a grouping variable.
>
>  -Peter
>
>
>
>> If you show us your data/code/output as has been requested, then we
>>
> may be able to tell which it is. Without that information you are
> expecting either R or the members of the list to read your mind. I keep
> making notes to my future self to use the timetravel package (not
> written yet, that's why I need my future self to use it) to send a copy
> of the esp package (also not written yet) back in time to me so I can
> use it for situations like this. But so far that has not worked (maybe
> my future self is even more lazy than my present self, or my near future
> self does something to offend my far future self enough that he is
> unwilling to do this small favor for my current past self, darn, either
> way means I should probably do better on the diet/exercise).
>
>>
>> The short version of the above rambling is that we want to help, but
>>
> cannot help you until you help us to help you. Show us your
> data/code/output (or data/code/output for simulated/example data if you
> can't show your real data).
>
>>
>>
>>
>
>>
> --
> Peter Ehlers
> University of Calgary
>

[[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] Ordering categories on a boxplot - a serious trap??

2010-02-25 Thread Schwab,Wilhelm K
Hello all,

I think I probably did something stupid, and R's part was to allow me to do it. 
 My goal was to control the order of factor levels appearing horizontally on a 
boxplot.  Enter search engines and perhaps some creative stupidity on my part, 
and I came up with the following:

v=read.table("factor-order.txt",header=TRUE);
levels(v$doseGroup) = c("L", "M", "H");
boxplot(v$dose~v$doseGroup);


A good way to see the trap is to evaluate:

v=read.table("factor-order.txt",header=TRUE);
par(mfrow=c(2,1));
boxplot(v$dose~v$doseGroup);
levels(v$doseGroup) = c("L", "M", "H");
boxplot(v$dose~v$doseGroup);
par(mfrow=c(1,1));

The above creates two plots, one correct with the factors in an inconvient 
order, and one that is WRONG.  In the latter, the labels appear in the desired 
order, but the data does not "move with them."  I did not discover the problem 
until I repeated the same type of plot with something that had a known 
relationship with the levels, and the result was clearly not correct.

I *think* the problem is to assign to the return value of levels().  How did I 
think to do that?  I'm not really sure, but please look at

  https://stat.ethz.ch/pipermail/r-help/2008-August/171884.html


Perhaps it does not say to do exactly what I did, but it sure was easy to 
follow to the mistake, it appeared to do what I wanted, and the consequences of 
the mistake are ugly.  Perhaps levels() should return something that is 
immutable??  If I am looking at this correctly, levels() is an accident waiting 
to happen.

What should I have done?  It seems:

read data and order factor levels
v=read.table("factor-order.txt",header=TRUE);
group = factor(v$doseGroup,levels = c("L", "M", "H") );
boxplot(v$dose~group);


One disappointment is that the above factor() call apparently needs to be 
repeated for any subset of v - I'm still trying to get my mind around that one.

Can anyone confirm this?  It strikes me as a trap that should be addressed so 
that an error results rather than a garbage graph.

Bill


---
Wilhelm K. Schwab, Ph.D.

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


Re: [R] Plotting 15 million points

2010-02-25 Thread David Winsemius


On Feb 25, 2010, at 6:11 PM, Abhishek Pratap wrote:


Hi All

I have a vector of about 15 million numbers which I would like to
plot. The goal is the see the distribution.



 I tired the usual steps.


I get that way after a long day myself.



1. Histogram : never gets complete my window freezes w/out log base 10


What expressions?


2. Density  : I first calculated the kernel density and then plotted
it which worked.

It would be nice to superimpose histogram with density but as of now I
am not able to get this data as a histogram.


?cut
?table



I tried ggplot2 which
also hangs.

Any efficient methods to play with > 10 million numbers in a vector.


Well, I only have 4.5 million rows (in a hundred plus variable  
dataframe) but the typical commands seem to work fine. hist() gave a  
plot almost instantly:


hist(TRdta$ur_procreat, breaks=c(seq(0, 4, by=0.2), 20)  )



Thanks,
-Abhi

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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
Heritage Laboratories
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] two questions for R beginners

2010-02-25 Thread Ralf B
My biggest blocker was my misconception that R is extremely difficult
to start with. It is powerful and one can do very complicated things (
that consequently turn things  complicated) but it comes with very
nice defaults and one can produce great results with standard tasks in
very little time - especially if one has done programming and/or
scripting before.

I pushed it away for too long that way. I wish I would have used it
years ago and avoided SPSS altogether - must have wasted 100s of hours
doing repetitive tasks by click and partial scripts in SPSS. Not to
mention a horrible license policy and a visualization unit that is
simply embarrassing for a product that is in its 18th or 19th version.

Ralf

On Thu, Feb 25, 2010 at 1:11 PM, Tal Galili  wrote:
> My biggest stumbling blocks to getting up and running with R was whenever I
> was lazy and impatient.
>
> The more you love R, the more it loves you back.
>
> Tal
>
>
>
>
> Contact
> Details:---
> Contact me: tal.gal...@gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
> --
>
>
>
>
> On Thu, Feb 25, 2010 at 7:31 PM, Patrick Burns 
> wrote:
>
>> * What were your biggest misconceptions or
>> stumbling blocks to getting up and running
>> with R?
>>
>> * What documents helped you the most in this
>> initial phase?
>>
>> I especially want to hear from people who are
>> lazy and impatient.
>>
>> Feel free to write to me off-list.  Definitely
>> write off-list if you are just confirming what
>> has been said on-list.
>>
>> --
>> Patrick Burns
>> pbu...@pburns.seanet.com
>> http://www.burns-stat.com
>> (home of 'The R Inferno' and 'A Guide for the Unwilling S User')
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>        [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] Plotting 15 million points

2010-02-25 Thread Glover, Tim
Have you considered taking a random subset and plotting that?  I'd bet you can 
get a really impression of the distribution with a few hundred thousand points 
at most.

Tim Glover 
Senior Environmental Scientist - Geochemistry 
Geoscience Department Atlanta Area 
MACTEC Engineering and Consulting, Inc. 
Kennesaw, Georgia, USA 
Office 770-421-3310 
Fax 770-421-3486 
Email ntglo...@mactec.com 
Web www.mactec.com 
 


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Abhishek Pratap
Sent: Thursday, February 25, 2010 6:12 PM
To: r-help@r-project.org
Subject: [R] Plotting 15 million points

Hi All

I have a vector of about 15 million numbers which I would like to
plot. The goal is the see the distribution.  I tired the usual steps.

1. Histogram : never gets complete my window freezes w/out log base 10
2. Density  : I first calculated the kernel density and then plotted
it which worked.

It would be nice to superimpose histogram with density but as of now I
am not able to get this data as a histogram. I tried ggplot2 which
also hangs.

Any efficient methods to play with > 10 million numbers in a vector.

Thanks,
-Abhi

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Plotting 15 million points

2010-02-25 Thread Liviu Andronic
On 2/25/10, Abhishek Pratap  wrote:
>  Any efficient methods to play with > 10 million numbers in a vector.
>
Did you try rggobi?
Liviu

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


Re: [R] two questions for R beginners

2010-02-25 Thread RICHARD M. HEIBERGER
On Thu, Feb 25, 2010 at 5:39 PM, Carl Witthoft  wrote:
> Well, here goes...
>
> I still wish there were a really good monograph on the use and
> implementation of factors.

To get a good handle on factors, and the sets of contrasts they encode,
it is really necessary to study a good statistics book.  I recommend mine

Statistical Analysis and Data Display, An Intermediate Course with
Examples in S-Plus, R, and SAS,
Richard M. Heiberger and Burt Holland, Springer 2004

But I will acknowledge that other books are available.

Rich

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


[R] Plotting 15 million points

2010-02-25 Thread Abhishek Pratap
Hi All

I have a vector of about 15 million numbers which I would like to
plot. The goal is the see the distribution.  I tired the usual steps.

1. Histogram : never gets complete my window freezes w/out log base 10
2. Density  : I first calculated the kernel density and then plotted
it which worked.

It would be nice to superimpose histogram with density but as of now I
am not able to get this data as a histogram. I tried ggplot2 which
also hangs.

Any efficient methods to play with > 10 million numbers in a vector.

Thanks,
-Abhi

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


Re: [R] two questions for R beginners

2010-02-25 Thread Tal Galili
My biggest stumbling blocks to getting up and running with R was whenever I
was lazy and impatient.

The more you love R, the more it loves you back.

Tal




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




On Thu, Feb 25, 2010 at 7:31 PM, Patrick Burns wrote:

> * What were your biggest misconceptions or
> stumbling blocks to getting up and running
> with R?
>
> * What documents helped you the most in this
> initial phase?
>
> I especially want to hear from people who are
> lazy and impatient.
>
> Feel free to write to me off-list.  Definitely
> write off-list if you are just confirming what
> has been said on-list.
>
> --
> Patrick Burns
> pbu...@pburns.seanet.com
> http://www.burns-stat.com
> (home of 'The R Inferno' and 'A Guide for the Unwilling S User')
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] two questions for R beginners

2010-02-25 Thread Sharpie


Patrick Burns wrote:
> 
> * What were your biggest misconceptions or
> stumbling blocks to getting up and running
> with R?
> 

R was the first scripting language that I *really* invested time in
learning.  Prior to R I had a few years experience programming in Fortran
and had worked on a few projects using Matlab.  Because most of my
programming experience was with Fortran, the toughest thing to get my head
around was definitely lexical scoping and that unlike Fortran subroutines, R
function results had to be assigned to something in order to persist outside
of the function. 


Patrick Burns wrote:
> 
> * What documents helped you the most in this
> initial phase?
> 

Definitely the "An Introduction to R" manual that ships with the core
distribution.  It helped me translate my knowledge of programming concepts
to the R language very quickly.


Patrick Burns wrote:
> 
> I especially want to hear from people who are
> lazy and impatient.
> 
> Feel free to write to me off-list.  Definitely
> write off-list if you are just confirming what
> has been said on-list.
> 
> -- 
> Patrick Burns
> 

-- 
View this message in context: 
http://n4.nabble.com/two-questions-for-R-beginners-tp1569384p1569901.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] Heterogeneous Correlation Matrix with Survey Weights

2010-02-25 Thread Christopher T. Moore

Hello,

I have a data set containing categorical and ordinal factors, as well as 
sampling weights (i.e., survey weights reflecting unequal probabilities of 
selection). I want to fit a structural equation model with sem(). I have 
run sem() on weighted covariance matrices using advice from John Fox (see 
 and 
). 
However, since I have categorical/ordinal variables, I would like to 
compute a weighted heterogeneous correlation matrix with hetcor().


Is there a way to do this in R? I couldn't find any guidance in the r-help 
archives or in the polycor help files. Should I truncate the sampling 
weights to integers and then populate the data set with redundant 
rows/cases so that the number of rows equals the population size 
(N>700,000)? Or is there a better way to compute a weighted heterogeneous 
correlation matrix?


Thanks,
Chris

--
Christopher T. Moore, M.P.P.
Doctoral Student
Quantitative Methods in Education
University of Minnesota
44.9785°N, 93.2396°W
moor0...@umn.edu
http://umn.edu/~moor0554

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


Re: [R] two questions for R beginners

2010-02-25 Thread Albert-Jan Roskam
> "The best way to spread information is to tell someone that it is a secret, 
> the best way to keep it secret is to put it in  > a manual."

==> Nice quote. ;-) The problem is not that there's too little information, 
rather there's so much. That's probably because R is so powerful, but it makes 
it tough to sieve out the relevant bits. Some of the info is way too technical 
to be practical. If I want to drive a car I do not necessarily need to know all 
the nitty gritty about engine technology.

> * What were your biggest misconceptions or
> stumbling blocks to getting up and running
> with R?

==> That R can't deal very well with large data, which is not entirely untrue. 
Also, I was learning another language (Python) and I didn't want R to interfere 
with that. Finally, in a working
 environment, it;s almost impossible to justify the time 'lost' learning a new 
language. Managers generally don't give a %$# about the beauty and robustness 
of a language. They just want to get the job done asap.

>
> * What documents helped you the most in this
> initial phase?
>
==> Many docs. CRAN documents (pdfs), other tutorials, Bob Muenchen's book. 
Many docs == many angles == a good way to learn things.

> I especially want to hear from people who are
> lazy and impatient.
>
==> Lazy? n/a. Impatient? Yup, guilty as charged.

> Feel free to write to me off-list.  Definitely
> write off-list if you are just confirming what
> has been said on-list.

Cheers!!

Albert-Jan



~~

In the face of ambiguity, refuse the temptation to guess.

~~

--- On Thu, 2/25/10, Greg Snow  wrote:

From: Greg Snow 
Subject: Re: [R] two questions for R beginners
To: "Patrick Burns" , "r-help@r-project.org" 

Date: Thursday, February 25, 2010, 9:42 PM

Patrick,

I would add one more question:

* where did you look for help expecting answers, but did not find them?

If you add hubris to laziness and impatience, you have Larry Wall's 3 virtues 
of a programmer.

To new users of R who may not understand why Patrick is asking:

Patrick Burns is the author of some great tutorials/references on S/R and is 
probably looking for questions to answer in
 his next contribution.

Lately there have been a large number of questions on some fairly basic issues 
(and some rather complex issues that people expected to be simple/basic).  My 
initial response (and probably others as well) to some of these requests was to 
quickly think that the answer is obvious and that the obvious place to look is 
..., but then I realize that I am a high school dropout who has been using S/R 
for over 20 years, majored in statistics but reads Shakespeare for fun, and 
have been known to saw people in half for the entertainment of others; so I am 
probably not representative of most beginners.  Fortune(89) probably applies 
here.  If R beginners will share their frustrations, where they looked but did 
not find answers (and why they looked there), what would have helped them, 
etc.  Then we (well probably Patrick mostly) can do more to help the next set 
of beginners.

It does not matter how good our
 answers are if they answer the wrong questions or are in places that the 
questioner never sees them.

"The best way to spread information is to tell someone that it is a secret, the 
best way to keep it secret is to put it in a manual."

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Patrick Burns
> Sent: Thursday, February 25, 2010 10:31 AM
> To: r-help@r-project.org
> Subject: [R] two questions for R beginners
>
 
> * What were your biggest misconceptions or
> stumbling blocks to getting up and running
> with R?
> 
> * What documents helped you the most in this
> initial phase?
> 
> I especially want to hear from people who are
> lazy and impatient.
> 
> Feel free to write to me off-list.  Definitely
> write off-list if you are just confirming what
> has been said on-list.
> 
> --
> Patrick Burns
> pbu...@pburns.seanet.com
> http://www.burns-stat.com
> (home of 'The R Inferno' and 'A Guide for the Unwilling S User')
> 
> __
> R-help@r-project.org
 mailing list
> https://stat.ethz.ch/mailman/listinfo/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.



  
[[alternative HTML version deleted]]

__

Re: [R] two questions for R beginners

2010-02-25 Thread Carl Witthoft

Well, here goes...

I still wish there were a really good monograph on the use and 
implementation of factors.


I had to do a certain amount of digging to learn that {assign, get, 
eval, expression, call, parse, deparse} all existed and how they play 
together.  Sometimes they are look like the C language's  indirect 
addressing, *foo and &foo , and sometimes they don't. :-)


Remembering exactly what " y~x " can do and what it can't took a while.

Learning about, and watching for 'lazy evaluation,' especially in 
variables passed to a function, was a bit of a surprise.


And to echo others, "R-inferno" has been invaluable, along with the 
Zoonek manual.


Carl

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Restructure some data

2010-02-25 Thread Phil Spector

Harold -
   Here's what I came up with:


 tapply(as.vector(as.matrix(dat[5:7])),

+ list(rep(dat$id,3),as.vector(as.matrix(dat[2:4]))),I)
  item1 item10 item2 item3 item4 item5 item7 item9
1NA NA 1NANA 1NA 0
2 0 NANANANA 1 1NA
3 1 NA 0 1NANANANA
4NA NANA 1 0NA 0NA
5NA  1NA 0 1NANANA

I thought there would be a way to use xtabs, but I had
trouble preserving the NAs.

The columns aren't in the right order, and the item6 column is
missing, but it's pretty close.
Thanks for the easily reproducible example, and the interesting
puzzle.

- Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 spec...@stat.berkeley.edu


On Thu, 25 Feb 2010, Doran, Harold wrote:


Suppose I have a data frame like "dat" below. For some context, this is the 
format that represents student's taking a computer adaptive test. first.item is the first 
item that student was administered and then score.1 is the student's response to that 
item and so forth.

item.pool <- paste("item", 1:10, sep = "")
set.seed(54321)
dat <- data.frame(id = c(1,2,3,4,5), first.item = sample(item.pool, 5, 
replace=TRUE),
   second.item = sample(item.pool, 5,replace=TRUE), third.item = 
sample(item.pool, 5,replace=TRUE),
   score1 = sample(c(0,1), 5,replace=TRUE), score2 = sample(c(0,1), 
5,replace=TRUE), score3 = sample(c(0,1), 5,replace=TRUE))

I need to restructure this into a new format. The new matrix df (after the 
loop) is exactly what I want in the end. But, I'm annoyed at myself for not 
thinking of a more efficient way to restructure this without using a loop.

df <- matrix(NA, ncol = length(item.pool), nrow = nrow(dat))
colnames(df) <- unique(item.pool)

for(i in 1:5){
   for(j in 2:4){
   rr <- which(dat[i,j] == colnames(df))
   df[i,rr] <- dat[i, (j+3)]
   }
}

Any thoughts?

Harold

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


[R] missing values in 'ncdf', integer versus byte

2010-02-25 Thread Albert Vernon Smith
I'm working with the ncdf package, and I'm seeing a behavior which I
am unsure whether it is a bug or a feature.  I am creating a variable,
which I make with the precision of "byte" and also set a missing
value,  When I put into this variable, all my NA values are put in
properly as the missing value.  However, when I read it back, I get
the missing value rather than NA.  However, if I have a variable with
precision of "integer" it comes back as NA.

Is this the desired behavior?  If so, how might I read missing byte
values as NA?

The following shows the behavior:

--

vardim<-dim.def.ncdf("variable","units", 1:10)

variable_byte<-
var.def.ncdf("as.byte","case",dim=vardim,missval=-99,prec="byte")
variable_int<- 
var.def.ncdf("as.int","case",dim=vardim,missval=-99,prec="integer")


ncfilename <- "test.nc"

ncfile <- create.ncdf(ncfilename,list(variable_byte,variable_int))

array <- c(1:5,NA,7:10)

put.var.ncdf(ncfile,variable_byte,array,start=1,count=10)
put.var.ncdf(ncfile,variable_int,array,start=1,count=10)

close(ncfile)

nc <- open.ncdf(ncfile)

int_return <- get.var.ncdf(nc, "as.int", start=1, count=10)
byte_return <- get.var.ncdf(nc, "as.byte", start=1, count=10)

--

> int_return
 [1]  1  2  3  4  5 NA  7  8  9 10
> byte_return
 [1]  1  2  3  4  5 -99  7  8  9 10

Thanks,
-albert

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Alternatives to linear regression with multiple variables

2010-02-25 Thread David Winsemius


On Feb 22, 2010, at 7:46 AM, Guy Green wrote:



I wonder if someone can give some pointers on alternatives to linear
regression (e.g. Loess) when dealing with multiple variables.

Taking any simple table with three variables, you can very easily  
get the

intercept and coefficients with:
summary(lm(read_table))

For obvious reasons, the coefficients in a multiple regression are  
quite
different from what you get if you calculate regressions for the  
single

variables separately.  Alternative approaches such as Loess seem
straightforward when you have only one variable, and have the  
advantage that

they can cope even if the relationship is not linear.

My question is: how can you extend a flexible approach like Loess to a
multi-variable scenario?  I assume that any non-parametric calculation
becomes very resource-intensive very quickly.  Can anyone suggest
alternatives (preferably R-based) that cope with multiple variables,  
even

when the relationship (linear, etc) is not known in advance?


Frank Harrell illustrates several methods for appropriate  
consideration and computation of non-linear relationships in a  
regression framework. His book "Regression Modeling Strategies" has  
been uniformly praised by the people to whom I have recommended it. At  
one point he compares graphically the effect measures using a 2-d  
loess fit to that achieved with a crossed regression spline approach.


Another text that demonstrates R-implemented multiple dimensional non-  
(or semi-)parametric regression approaches is Simon Wood's  
"Generalized Linear Models". I have less experience with the methods  
in that text, but hope to increase my familiarity in the future, since  
it would extend the types of models I would have access to.


And Andy has mentioned "Local Regression and Likelihood" by Loader,  
which if you use Bookfinder.com will save you $30 off the $90 price in  
Amazon at the moment. (No financial interests to declare.)


I surnise that the geospatial applications are of necessity dealing  
with 2 and 3 dimensional data arrangements so you might took at their  
Task View and mailing list archive for worked examples and advice.


--
David



Thanks,

Guy
--
View this message in context: 
http://n4.nabble.com/Alternatives-to-linear-regression-with-multiple-variables-tp1564370p1564370.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
Heritage Laboratories
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] two questions for R beginners

2010-02-25 Thread Peter Dalgaard

Patrick Burns wrote:

* What were your biggest misconceptions or
stumbling blocks to getting up and running
with R?

* What documents helped you the most in this
initial phase?

I especially want to hear from people who are
lazy and impatient.


Can't be bothered with questionnaires and can't wait to see your next 
book... ;-)


-pd


--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Accessing named elements of a vector

2010-02-25 Thread Matthias Gondan

Dear R developers,

A great R feature is that elements of vectors, lists and dataframes can 
have names:


vx = c(a=1, b=2)
lx = list(a=1, b=2)

Accessing element "a" of vx: vx['a']
Accessing element "a" of lx: lx[['a']] or lx$a

Might be a matter of taste, but I like the $ very much. Unfortunately, 
vx$a is not
functional. Would it break existing compatibility if the $ would be 
allowed to

access elements of a vector, as well?

Best regards,

Matthias

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Including Rcpp in Eclipse C++ project

2010-02-25 Thread Sam Garrett
Hello. I am trying to include R in an eclipse C++ project so that I can use
Rcpp and Rinside. Right now I have R installed on my Ubuntu machine and both
plugins are installed too. I have the directories of the corresponding .so
files set in the Project > Properties > Settings Gcc c++ linker under
Library Search Path. Here is the error that I'm getting when I try to build
my code:

>/home/sam/workspace/StockWatcher/Debug/StockWatcher: error while

>loading shared libraries: libR.so: cannot open shared object file:

>No such file or directory

>

Which doesn't make sense because I'm including the file under the settings
and I've looked at the folder and the file is there. Any help would be
greatly appreciated. Thank you!

-- 
Sam

[[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] taking the median across similar data

2010-02-25 Thread Jorge Ivan Velez
Hi Hari,

Here is a suggestion:

with(x, aggregate(x[,-1], list(probename), median))

where x is your data set.

HTH,
Jorge


On Thu, Feb 25, 2010 at 4:25 PM, Harikrishnadhar <> wrote:

> Dear All,
>
> I am analyzing the miRNA data set in which I have 817 unique probes for
> each
> they have 20  features each . I have to group the similar features and take
> the median across them so that I have a data with no repeats to perform
> invariant analysis .
>
> My data looks something  similar format
>
> probename  sample1 sample2 sample3
> A 2.3  2.42.5
> A 8.9  3.67.9
> A 4.7   4.4   2.2
> C 2.2   2.1   2.3
> C 1.3   1.3   2.9
> B 2.22.1  2.7
> B 2.22.1  2.8
>
> I want to get some thing like after the means for similar probename are
> calculated
> A   2.3 2.4 2.5
> B  8.9  3.6 7.9
> C  2.2  2.1 2.8
> I have to group the probename  elements and and get median across them.
> Please help with this so that I can get complete my analysis .
>
>
>
>
>
> --
> Thanks
> Hari
> 215-385-4122
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> "If there is anyone out there who still doubts that America is a place
> where
> all things are possible"
>
>
>
> --
> Thanks
> Hari
> 215-385-4122
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> "If there is anyone out there who still doubts that America is a place
> where
> all things are possible"
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] Normal distribution (Lillie.test())

2010-02-25 Thread David Winsemius


On Feb 25, 2010, at 12:20 PM, Bosken wrote:



Hi,

Thanks for your reaction.

The purpose of my test is to check if my NoiseGenerators really are  
Normal

Distributed en witch circuit is the best!

So I need some good test to do this.

But what with: Fortune(), can't find anything about it..


# This might work, but if not, you should get the idea.

install.packages(pkgs="fortunes")
require(fortunes)
fortune(117)
fortune(234)




Thanks for the help!

Bosken
--
View this message in context: 
http://n4.nabble.com/Normal-distribution-Lillie-test-tp1565083p1569361.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
Heritage Laboratories
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] taking the median across similar data

2010-02-25 Thread Harikrishnadhar
Dear All,

I am analyzing the miRNA data set in which I have 817 unique probes for each
they have 20  features each . I have to group the similar features and take
the median across them so that I have a data with no repeats to perform
invariant analysis .

My data looks something  similar format

probename  sample1 sample2 sample3
A 2.3  2.42.5
A 8.9  3.67.9
A 4.7   4.4   2.2
C 2.2   2.1   2.3
C 1.3   1.3   2.9
B 2.22.1  2.7
B 2.22.1  2.8

I want to get some thing like after the means for similar probename are
calculated
A   2.3 2.4 2.5
B  8.9  3.6 7.9
C  2.2  2.1 2.8
I have to group the probename  elements and and get median across them.
Please help with this so that I can get complete my analysis .





-- 
Thanks
Hari
215-385-4122






















"If there is anyone out there who still doubts that America is a place where
all things are possible"



-- 
Thanks
Hari
215-385-4122






















"If there is anyone out there who still doubts that America is a place where
all things are possible"

[[alternative HTML version deleted]]

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


Re: [R] How to add a title to represent four different plot in lm function

2010-02-25 Thread Tal Galili
Hi there,

Try this:

par(mfrow=c(2,2))
for( i in 1:4 ) plot(1:10)
mtext("Title",side=3,outer=TRUE,padj=3)






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




On Thu, Feb 25, 2010 at 10:43 PM, Greg Snow  wrote:

> Try something like:
>
> > par(oma=c(0,0,3,0))
> 
> > mtext("your text here", outer=TRUE
>
> Hope this helps,
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.s...@imail.org
> 801.408.8111
>
>
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> > project.org] On Behalf Of FMH
> > Sent: Thursday, February 25, 2010 9:01 AM
> > To: r-help@r-project.org
> > Cc: r-sig...@stat.math.ethz.ch
> > Subject: [R] How to add a title to represent four different plot in lm
> > function
> >
> > Dear All,
> >
> > A linear regression model could be fitted by using lm function and the
> > plot function can be used to check the assumptions of the model. The
> > example is as followed.
> >
> > require(graphics)
> > ## Annette Dobson (1990) "An Introduction to Generalized Linear
> > Models".
> > ## Page 9: Plant Weight Data.
> > ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
> > trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> > group <- gl(2,10,20, labels=c("Ctl","Trt"))
> > weight <- c(ctl, trt)
> > anova(lm.D9 <- lm(weight ~ group))
> > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> > plot(lm.D9, las = 1)
> >
> > Could someone advice me the way to add a single title either at the
> > above or bottom of these 4 plots, entitled "The verification of model
> > assumtion via four different plots" ?
> >
> > Thanks
> > Fir
> >
> >
> >
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/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.
>

[[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] Restructure some data

2010-02-25 Thread Doran, Harold
Suppose I have a data frame like "dat" below. For some context, this is the 
format that represents student's taking a computer adaptive test. first.item is 
the first item that student was administered and then score.1 is the student's 
response to that item and so forth.

item.pool <- paste("item", 1:10, sep = "")
set.seed(54321)
dat <- data.frame(id = c(1,2,3,4,5), first.item = sample(item.pool, 5, 
replace=TRUE),
second.item = sample(item.pool, 5,replace=TRUE), third.item = 
sample(item.pool, 5,replace=TRUE),
score1 = sample(c(0,1), 5,replace=TRUE), score2 = 
sample(c(0,1), 5,replace=TRUE), score3 = sample(c(0,1), 5,replace=TRUE))

I need to restructure this into a new format. The new matrix df (after the 
loop) is exactly what I want in the end. But, I'm annoyed at myself for not 
thinking of a more efficient way to restructure this without using a loop.

df <- matrix(NA, ncol = length(item.pool), nrow = nrow(dat))
colnames(df) <- unique(item.pool)

for(i in 1:5){
for(j in 2:4){
rr <- which(dat[i,j] == colnames(df))
df[i,rr] <- dat[i, (j+3)]
}
}

Any thoughts?

Harold

[[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] read.table (trying one more time)

2010-02-25 Thread David Winsemius


On Feb 25, 2010, at 3:10 PM, Mestat wrote:



Hey listers,
I've posted this doubt other day... But I am still having a hard  
time...

I have a MAC and I am not getting how to use the read.table command...
At the bottom of the FINDER application I have the following path:

Macintosh HD>Usuários>User>Marcio>UdeM>Travail Dirigé>Data>MU284
Population.txt

I didn't find out how I could copy and paste this path as it is  
possible to
do with the Windows. But, it's ok, cause I am trying the following  
command

with all possible choices, as below:

file<-read.table("/User/Marcio/UdeM/Travail Dirigé/Data/MU284
Population.txt",header=T,skip=24)
file<-read.table("/Users/Marcio/UdeM/Travail Dirigé/Data/MU284
Population.txt",header=T,skip=24)
file<-read.table("/Usuários/User/Marcio/UdeM/Travail Dirigé/Data/MU284
Population.txt",header=T,skip=24)
file<-read.table("/Usuários/Users/Marcio/UdeM/Travail Dirigé/Data/ 
MU284

Population.txt",header=T,skip=24)




I've checked already the forum and I found a similar post that says  
to use

the command with the following path: "/Users/Marcio/UdeM/Travail
Dirigé/Data/MU284 Population.txt"
But at the bottom of the FINDER application is just USER.
Anyway I tried those options and other... But didn't work...
If anybody could give me a clue... THANKS A LOT!!!


Two choices (and in any case, don't call your input dataframe just  
"file", although that is probably not why you are having problems):


option 1) Type in:

file_inp <-read.table("",header=T,skip=24)
### then click-hold-drag the file from a Finder window to the R  
console until the cursor bar is between the two quotes, then "release- 
click".


optiuon 2)

file_inp<-read.table(file=file.choose(),header=T,skip=24)

## and then navigate to the location of your file using the Mac File  
Chooser window.


And in the future, such questions should go to the Mac-SIG list.

--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


Re: [R] How to fill in a region with different patterns?

2010-02-25 Thread baptiste auguie
Hi,

If you are curious you might like to try a highly experimental Grid
function I wrote some time ago,

library(grid)
source("http://gridextra.googlecode.com/svn/trunk/R/patternGrob.r";)

grid.newpage()
grid.pattern(x=seq(1/6, 5/6, length=6), width=unit(1/8,"npc"),
height=unit(0.5,"npc"),
 motif.width=unit(10, "mm"),  pattern=c(1:6),
orientation=45, motif.alpha=0.5,
 motif.cex=c(1, 0.5), motif.col=1:2, motif.fill=NA,
 gp=gpar(fill="blue", lwd=2, alpha=0.5),  clip=T)

If you really insist on using shading patterns despite Greg's sound
advice, it might give you some inspiration.

HTH,

baptiste


On 25 February 2010 04:34, St.Jeff Shang  wrote:
> Hi to all,
>
>
>
> Here is a question which I cannot solve. Appreciate so much for any 
> suggestions!
>
>
>
> I have a squared region which is irregularly divided into many rectangular 
> patches.
>
> Each patch is associated with a value, and two patches possibly share a 
> common value.
>
> I hope to fill in each patch a pattern according to its value. For
> instance, if a patch has value 1, then I fill in that patch with
> pattern A; if it has value 2, then fill in it with pattern B,...
>
>
>
> The pattern is something like a rectangular region with certain colored
> lines in it. For instance, pattern A may be a white rectangular region
> filled in by two thick black lines;
>
> pattern B may be a white rectagular region filled in by 10 thick black 
> lines,...
>
>
>
> Is this available in matlab? I have serached "polygnon" in matlab user guide 
> and found a
>
> "fill function" may work, however, there is still a long way to finally 
> complete it.
>
>
>
> Many thanks again!
>
> Jeff
>
>
>
>        [[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.
>



-- 


Baptiste Auguié

Departamento de Química Física,
Universidade de Vigo,
Campus Universitario, 36310, Vigo, Spain

tel: +34 9868 18617
http://webs.uvigo.es/coloides

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Linear models interaction

2010-02-25 Thread gauravbhatti

My data looks like following:
cera3[i, ] batch lcl29 pdt
Untreated 3.185867 1 0   0
Untreated.4   3.185867 0 0   0
LCL29  4.357552 1 1   0
LCL29.6   3.446256 0 1   0
PDT   2.765535 1 0   1
PDT.5 3.584963 0 0   1
PDT+LCL29.1   2.867896 1 1   1
PDT+LCL29.3   2.827819 0 1   1

As you can see there are three factorls batch , lcl29 and pdt. I am trying
to fit the model: 
Y = batch +pdt*lcl29. I get the following coefficients:
Estimate Std. Errort value Pr(>|t|)
(Intercept)  3.1524122  0.2487796 12.6715049 1.242191e-12
batch1  -0.2267947  0.2291590 -0.9896827 3.314508e-01
lcl291   0.6350186  0.3122910  2.0334194 5.233525e-02
pdt1 0.1046388  0.3122910  0.3350684 7.402619e-01
lcl291:pdt1 -0.6633316  0.4521381 -1.4670995 1.543419e-01

I know that the coef. of lcl291 i.e 0.635 is difference in means between
rows with lcl29 present alone and untreated ones. Same is true for the coef
of PDT1. However I am not sure about the coefficient of  lcl291:pdt1. 
where does this value come from? How is it calculated?
what does it tell? Is it Interaction versus all the rest because it is
certailnly not interaction versus untreated? 

Thank You

-- 
View this message in context: 
http://n4.nabble.com/Linear-models-interaction-tp1569497p1569497.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] Alternatives to linear regression with multiple variables

2010-02-25 Thread Greg Snow
Well, the help page for the loess function says that the formula can include up 
to 4 predictor variables.  There are also additive models (mgcv or gam (or 
other) package).

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Guy Green
> Sent: Monday, February 22, 2010 5:47 AM
> To: r-help@r-project.org
> Subject: [R] Alternatives to linear regression with multiple variables
> 
> 
> I wonder if someone can give some pointers on alternatives to linear
> regression (e.g. Loess) when dealing with multiple variables.
> 
> Taking any simple table with three variables, you can very easily get
> the
> intercept and coefficients with:
>   summary(lm(read_table))
> 
> For obvious reasons, the coefficients in a multiple regression are
> quite
> different from what you get if you calculate regressions for the single
> variables separately.  Alternative approaches such as Loess seem
> straightforward when you have only one variable, and have the advantage
> that
> they can cope even if the relationship is not linear.
> 
> My question is: how can you extend a flexible approach like Loess to a
> multi-variable scenario?  I assume that any non-parametric calculation
> becomes very resource-intensive very quickly.  Can anyone suggest
> alternatives (preferably R-based) that cope with multiple variables,
> even
> when the relationship (linear, etc) is not known in advance?
> 
> Thanks,
> 
> Guy
> --
> View this message in context: http://n4.nabble.com/Alternatives-to-
> linear-regression-with-multiple-variables-tp1564370p1564370.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: How to read percentage and currency data?

2010-02-25 Thread Greg Snow
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Hrishi Mittal
> Sent: Wednesday, February 24, 2010 8:56 AM
> To: r-help@r-project.org
> Subject: Re: [R] Odp: How to read percentage and currency data?

[snip]

> It's a shame that something which Excel deals with trivially is such a
> hack
> in R. 

I believe that this is a consequence of a fundamental difference in the 
philosophies of the authors of R and the authors of MS Excel.

The authors of R assume that their users are intelligent and have a greater 
understanding of their own data than the authors do.



-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 with simple bootstrap test

2010-02-25 Thread xonix

Hi all
Forgive me, I'm a total R newbie, and this seems to be a straightforward
simple bootstrap problem, but after a whole day of trying to figure out how
to do it I'm ready to give up. Part of the problem is that every example and
every help page seems to be about doing something more far more complex.


I'm got a table with 40 columns and 750 rows. I sum all the values across
the whole table (and subsets of the columns). I want to bootstrap to get the
95% confidence intervals for that sum value. 

result <- boot(table, , 1000)
boot.ci (result, bca)

It seems to me that the 'function' is something to sum all the columns and
rows of the table (or a subset should I desire). I've tried writing 'sum'
for the function, but this gives me a huge figure which can't possibly be
right.

Thanks,
-- 
View this message in context: 
http://n4.nabble.com/Help-with-simple-bootstrap-test-tp1569459p1569459.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] Restructure some data

2010-02-25 Thread William Dunlap
> -Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of Doran, Harold
> Sent: Thursday, February 25, 2010 10:35 AM
> To: r-help@r-project.org
> Subject: [R] Restructure some data
> 
> Suppose I have a data frame like "dat" below. For some 
> context, this is the format that represents student's taking 
> a computer adaptive test. first.item is the first item that 
> student was administered and then score.1 is the student's 
> response to that item and so forth.
> 
> item.pool <- paste("item", 1:10, sep = "")
> set.seed(54321)
> dat <- data.frame(id = c(1,2,3,4,5), first.item = 
> sample(item.pool, 5, replace=TRUE),
> second.item = sample(item.pool, 
> 5,replace=TRUE), third.item = sample(item.pool, 5,replace=TRUE),
> score1 = sample(c(0,1), 5,replace=TRUE), 
> score2 = sample(c(0,1), 5,replace=TRUE), score3 = 
> sample(c(0,1), 5,replace=TRUE))
> 
> I need to restructure this into a new format. The new matrix 
> df (after the loop) is exactly what I want in the end. But, 
> I'm annoyed at myself for not thinking of a more efficient 
> way to restructure this without using a loop.
> 
> df <- matrix(NA, ncol = length(item.pool), nrow = nrow(dat))
> colnames(df) <- unique(item.pool)
> 
> for(i in 1:5){
> for(j in 2:4){
> rr <- which(dat[i,j] == colnames(df))
> df[i,rr] <- dat[i, (j+3)]
> }
> }
> 
> Any thoughts?

You can try subscripting by a 2-column matrix, the first
giving the row index and the second the column index.  E.g.,

  > f <- function(dat) {
  allItems <- paste("item", 1:10, sep = "")
  items <- as.matrix(dat[2:4])
  scores <- as.matrix(dat[, 5:7])
  retval <- matrix(NA_real_, nrow = nrow(dat), ncol = 10,
  dimnames = list(character(), allItems))
  retval[cbind(dat$id, match(items, allItems))] <- scores
  retval
  }
  > identical(f(dat), df)
  [1] TRUE

That was a very nice problem description, letting me
reproduce the example data and desired output with
just copy and paste.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> 
> Harold
> 
>   [[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] Normal distribution (Lillie.test())

2010-02-25 Thread Bosken

Hi,

Thanks for your reaction.

The purpose of my test is to check if my NoiseGenerators really are Normal
Distributed en witch circuit is the best!

So I need some good test to do this.

But what with: Fortune(117) and fortune(234), can't find anything about it..

Thanks for the help!

Bosken
-- 
View this message in context: 
http://n4.nabble.com/Normal-distribution-Lillie-test-tp1565083p1569361.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] Inverse function

2010-02-25 Thread Greg Snow
?uniroot

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of li li
> Sent: Wednesday, February 24, 2010 2:31 PM
> To: Bert Gunter
> Cc: r-help
> Subject: Re: [R] Inverse function
> 
> This is not a homework problem.
> 
> How to solve numerically for y from f(y,r) - a=g(y)=0? I am not too
> sure.
> 
> Thanks!
>Hannah
> 
> 
> 2010/2/24 Bert Gunter 
> 
> > 1. Is this a homework problem?
> >
> > 2. Etiquette on this list is to sign with your full real name.
> Adhering to
> > the list etiquette may enhance your chance of a useful response,
> especially
> > in view of (1), as we (or at least some of us) do not wish to do
> students'
> > homework for them.
> >
> > 3. Hint: f(y,r) = a  <==>  g(y) = 0 where g(y) == f(y,r) - a
> > (for numerical solutions).
> >
> >
> > Bert Gunter
> > Genentech Nonclinical Biostatistics
> >
> >  -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org]
> > On
> > Behalf Of li li
> > Sent: Wednesday, February 24, 2010 12:46 PM
> > To: r-help
> > Subject: [R] Inverse function
> >
> > Hi all,
> >   I have a function like the following:
> >
> >  f <- function(r,
> > y){r/(2*pi)*exp(1)^(-y)*(1+r*(y/2)+r^(2)*(y-1)^(2)/6)}
> >
> > For fixed r, I want to find the inverse funtion in terms y.
> > In other words, for fixed r, if the value of the function is given, I
> want
> > to
> > find the corrsponding y value that will achieve the specific function
> > value.
> >
> > Can anyone help me?
> >Hannah
> >
> >[[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 project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Single character input without Enter

2010-02-25 Thread Dieter Menne


Greg Snow-2 wrote:
> 
> The playSudoku function in the sudoku package has 2 examples/methods of
> responding to single key strokes, whether those methods will work for your
> application or not depends on what you are trying to do.
> 
> 

Thanks, Greg, it boils down to the rather basic

getGraphicsEvent(prompt = "Waiting for input", 
 onMouseDown = NULL, onMouseMove = NULL,
 onMouseUp = NULL, onKeybd = NULL)

in grDevices; so no tclk needed.  Strange that nobody told me

Dieter




-- 
View this message in context: 
http://n4.nabble.com/Single-character-input-without-Enter-tp1564153p1569460.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to fill in a region with different patterns?

2010-02-25 Thread Greg Snow
The rect function will draw a rectangle and can fill it with diagonal lines at 
specified angle and density.  But before you do that, really consider if and 
why you want to.  Using the diagonal lines became popular when the only way to 
get quality graphics was with a pen plotter (mechanical arm actually drawing 
the plot with a pen), filling an area was not reasonable (you could use a 
really high density of lines, but that usually made you unpopular with everyone 
else waiting for their turns, and often just wore a hole in your paper).

Research has shown (see Tufte's book) that patterns of lines are not the best 
approach, they can produce what is called the Moire effect which gives an 
illusion of color and movement.  These pattern fills are better at producing 
headaches and nausea and less effective at conveying information and producing 
useful plots.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of St.Jeff Shang
> Sent: Wednesday, February 24, 2010 8:34 PM
> To: r-help@r-project.org
> Subject: [R] How to fill in a region with different patterns?
> 
> Hi to all,
> 
> 
> 
> Here is a question which I cannot solve. Appreciate so much for any
> suggestions!
> 
> 
> 
> I have a squared region which is irregularly divided into many
> rectangular patches.
> 
> Each patch is associated with a value, and two patches possibly share a
> common value.
> 
> I hope to fill in each patch a pattern according to its value. For
> instance, if a patch has value 1, then I fill in that patch with
> pattern A; if it has value 2, then fill in it with pattern B,...
> 
> 
> 
> The pattern is something like a rectangular region with certain colored
> lines in it. For instance, pattern A may be a white rectangular region
> filled in by two thick black lines;
> 
> pattern B may be a white rectagular region filled in by 10 thick black
> lines,...
> 
> 
> 
> Is this available in matlab? I have serached "polygnon" in matlab user
> guide and found a
> 
> "fill function" may work, however, there is still a long way to finally
> complete it.
> 
> 
> 
> Many thanks again!
> 
> Jeff
> 
> 
> 
>   [[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] How to add a title to represent four different plot in lm function

2010-02-25 Thread Greg Snow
Try something like:

> par(oma=c(0,0,3,0))

> mtext("your text here", outer=TRUE

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of FMH
> Sent: Thursday, February 25, 2010 9:01 AM
> To: r-help@r-project.org
> Cc: r-sig...@stat.math.ethz.ch
> Subject: [R] How to add a title to represent four different plot in lm
> function
> 
> Dear All,
> 
> A linear regression model could be fitted by using lm function and the
> plot function can be used to check the assumptions of the model. The
> example is as followed.
> 
> require(graphics)
> ## Annette Dobson (1990) "An Introduction to Generalized Linear
> Models".
> ## Page 9: Plant Weight Data.
> ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
> trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> group <- gl(2,10,20, labels=c("Ctl","Trt"))
> weight <- c(ctl, trt)
> anova(lm.D9 <- lm(weight ~ group))
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(lm.D9, las = 1)
> 
> Could someone advice me the way to add a single title either at the
> above or bottom of these 4 plots, entitled "The verification of model
> assumtion via four different plots" ?
> 
> Thanks
> Fir
> 
> 
> 
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] two questions for R beginners

2010-02-25 Thread Greg Snow
Patrick,

I would add one more question:

* where did you look for help expecting answers, but did not find them?

If you add hubris to laziness and impatience, you have Larry Wall's 3 virtues 
of a programmer.

To new users of R who may not understand why Patrick is asking:

Patrick Burns is the author of some great tutorials/references on S/R and is 
probably looking for questions to answer in his next contribution.

Lately there have been a large number of questions on some fairly basic issues 
(and some rather complex issues that people expected to be simple/basic).  My 
initial response (and probably others as well) to some of these requests was to 
quickly think that the answer is obvious and that the obvious place to look is 
..., but then I realize that I am a high school dropout who has been using S/R 
for over 20 years, majored in statistics but reads Shakespeare for fun, and 
have been known to saw people in half for the entertainment of others; so I am 
probably not representative of most beginners.  Fortune(89) probably applies 
here.  If R beginners will share their frustrations, where they looked but did 
not find answers (and why they looked there), what would have helped them, etc. 
 Then we (well probably Patrick mostly) can do more to help the next set of 
beginners.

It does not matter how good our answers are if they answer the wrong questions 
or are in places that the questioner never sees them.

"The best way to spread information is to tell someone that it is a secret, the 
best way to keep it secret is to put it in a manual."

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Patrick Burns
> Sent: Thursday, February 25, 2010 10:31 AM
> To: r-help@r-project.org
> Subject: [R] two questions for R beginners
> 
> * What were your biggest misconceptions or
> stumbling blocks to getting up and running
> with R?
> 
> * What documents helped you the most in this
> initial phase?
> 
> I especially want to hear from people who are
> lazy and impatient.
> 
> Feel free to write to me off-list.  Definitely
> write off-list if you are just confirming what
> has been said on-list.
> 
> --
> Patrick Burns
> pbu...@pburns.seanet.com
> http://www.burns-stat.com
> (home of 'The R Inferno' and 'A Guide for the Unwilling S User')
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Minimum Spanning Trees

2010-02-25 Thread harunpirim

Hi,

I need to find all minimum spanning trees of an unweighted graph. 
Is there a way in R to do that?

Thanks
-- 
View this message in context: 
http://n4.nabble.com/Minimum-Spanning-Trees-tp1569351p1569351.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] nested design

2010-02-25 Thread ixi10

This is a nested design where team is nested in group. Method is fixed, while
team and group are random. Is this the correct R code for this?

gunload.aov <- aov(rounds ~ method+group + Error((team %in%
group)/method),data=gunload, qr=T)
-- 
View this message in context: 
http://n4.nabble.com/nested-design-tp1569449p1569449.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] two questions for R beginners

2010-02-25 Thread Liviu Andronic
On 2/25/10, Patrick Burns  wrote:
> * What were your biggest misconceptions or
>  stumbling blocks to getting up and running
>  with R?
>
>  * What documents helped you the most in this
>  initial phase?
>
>  I especially want to hear from people who are
>  lazy and impatient.
>
I'm quite resilient so I don't think I got to the point of
frustration, but getting up to speed was a lengthy process. The
biggest stumbler was getting onto the console, and not knowing what to
do next. (My first encounter with stats was SPSS, so it was similar to
getting onto a UNIX virtual console after a life-long experience with
point-and-click windows: it's not very reassuring to know that there
are man pages.) I stayed in the what-do-I-do-next state of mind for
about 6-12 months (I learned R myself, and my professors were quite
reticent when I first introduced them to R).

Of particular help to making progress were JGR (arguments suggestions,
editor with syntax highlighting, object browser, etc.), Rcmdr (quick
access to examples for performing specific tasks, etc.) and Sweave +
LyX (for easy results transfer and report creation, without the burden
of learning LaTeX). For graphics, playwith latticist and rggobi come
in very handy. From the documentation, right now I can recall Quick-R
and "R for SAS and SPSS users". And of course, RSiteSearch (also via
the sos package), Rseek and the vignettes are a must.

Regards
Liviu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 simple bootstrap test

2010-02-25 Thread Robert A LaBudde
The boot() function in the 'boot' package expects to find a function 
for the statistic with two arguments: The data object plus a row index object.


You don't indicate enough to see how you will be resampling. It you 
sum all elements in your table, resampling would have to be one of:


1. A sample with replacement of rows, or
2. A sample with replacement of columns, or
3. A sample with replacement of elements in the whole table.

Assuming you want sampling with replacement of rows:

sumf<- function (x, i) { sum(x[i,]) }
result<- boot(mytable, sumf, 1000)
boot.ci(result, type='bca')

A simulation:

> mytable<- matrix(rnorm(2000), ncol=20)
> sum(mytable)
[1] -14.92842
> sumf<- function(x,i) sum(x[i,])
> require('boot')
Loading required package: boot
> b1<- boot(mytable, sumf, 1000)
> boot.ci(b1, type='bca')
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates

CALL :
boot.ci(boot.out = b1, type = "bca")

Intervals :
Level   BCa
95%   (-101.49,   85.20 )
Calculations and Intervals on Original Scale

At 01:28 PM 2/25/2010, xonix wrote:

Hi all
Forgive me, I'm a total R newbie, and this seems to be a straightforward
simple bootstrap problem, but after a whole day of trying to figure out how
to do it I'm ready to give up. Part of the problem is that every example and
every help page seems to be about doing something more far more complex.


I'm got a table with 40 columns and 750 rows. I sum all the values across
the whole table (and subsets of the columns). I want to bootstrap to get the
95% confidence intervals for that sum value.

result <- boot(table, , 1000)
boot.ci (result, bca)

It seems to me that the 'function' is something to sum all the columns and
rows of the table (or a subset should I desire). I've tried writing 'sum'
for the function, but this gives me a huge figure which can't possibly be
right.



Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: r...@lcfltd.com
Least Cost Formulations, Ltd.URL: http://lcfltd.com/
824 Timberlake Drive Tel: 757-467-0954
Virginia Beach, VA 23464-3239Fax: 757-467-2947

"Vere scire est per causas scire"

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] read.table (trying one more time)

2010-02-25 Thread Mestat

Hey listers,
I've posted this doubt other day... But I am still having a hard time...
I have a MAC and I am not getting how to use the read.table command...
At the bottom of the FINDER application I have the following path:

Macintosh HD>Usuários>User>Marcio>UdeM>Travail Dirigé>Data>MU284
Population.txt

I didn't find out how I could copy and paste this path as it is possible to
do with the Windows. But, it's ok, cause I am trying the following command
with all possible choices, as below:

file<-read.table("/User/Marcio/UdeM/Travail Dirigé/Data/MU284
Population.txt",header=T,skip=24)
file<-read.table("/Users/Marcio/UdeM/Travail Dirigé/Data/MU284
Population.txt",header=T,skip=24)
file<-read.table("/Usuários/User/Marcio/UdeM/Travail Dirigé/Data/MU284
Population.txt",header=T,skip=24)
file<-read.table("/Usuários/Users/Marcio/UdeM/Travail Dirigé/Data/MU284
Population.txt",header=T,skip=24)

I've checked already the forum and I found a similar post that says to use
the command with the following path: "/Users/Marcio/UdeM/Travail
Dirigé/Data/MU284 Population.txt"
But at the bottom of the FINDER application is just USER.
Anyway I tried those options and other... But didn't work...
If anybody could give me a clue... THANKS A LOT!!!
Marcio


-- 
View this message in context: 
http://n4.nabble.com/read-table-trying-one-more-time-tp1569653p1569653.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] Normal distribution (Lillie.test())

2010-02-25 Thread Ravi Varadhan
May be you should have said:

"Normality tests are standard farce in a host of statistical texts."

Ravi.


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvarad...@jhmi.edu

Webpage:
http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h
tml

 





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Bert Gunter
Sent: Thursday, February 25, 2010 12:24 PM
To: 'Greg Snow'; 'Bosken'; r-help@r-project.org
Subject: Re: [R] Normal distribution (Lillie.test())

...

But,quoting Pogo, "We have met the enemy, and he is us."

Normality tests are standard fare in a host of statistical texts.

Bert Gunter
Genentech Nonclinical Biostatistics
 
 

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Greg Snow
Sent: Thursday, February 25, 2010 9:00 AM
To: Bosken; r-help@r-project.org
Subject: Re: [R] Normal distribution (Lillie.test())

You should probably read fortune(117) and fortune(234) (and possibly some of
the original discussions that lead to the fortunes).  Reading the help page
for the SnowsPenultimateNormalityTest function (TeachingDemos package) may
also help.  If you are happy with the plots, but still feel the need for a
"test" of some sort, then you should investigate using the vis.test function
in the TeachingDemos package.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Bosken
> Sent: Tuesday, February 23, 2010 4:13 AM
> To: r-help@r-project.org
> Subject: Re: [R] Normal distribution (Lillie.test())
> 
> 
> Hi,
> 
> Thanks for your reaction;
> 
> How do you come to the decision that my data not is normal distributed?
> 
> With the 69-95-99.7 test and Q-Q plot seems it ok! But these test are
> not
> exact, they only give you an image.
> 
> Gr. Bosken
> --
> View this message in context: http://n4.nabble.com/Normal-distribution-
> Lillie-test-tp1565083p1565762.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Normal distribution (Lillie.test())

2010-02-25 Thread Greg Snow
Install and load the fortunes package first, then run fortune(117), etc.  Then 
run fortune() quite a few times for possible enlightenment (or at least mild 
entertainment).

Do your NoiseGenerotors need to generate exactly normal data (they don't, see 
SnowsPenultimateNormalityTest), or is there a level of close enough?  If I 
remember correctly, you were testing 2000 values, with that sample size most 
normality tests will find very small differences to be significantly different, 
even if those small differences are practically meaningless.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Bosken
> Sent: Thursday, February 25, 2010 10:21 AM
> To: r-help@r-project.org
> Subject: Re: [R] Normal distribution (Lillie.test())
> 
> 
> Hi,
> 
> Thanks for your reaction.
> 
> The purpose of my test is to check if my NoiseGenerators really are
> Normal
> Distributed en witch circuit is the best!
> 
> So I need some good test to do this.
> 
> But what with: Fortune(117) and fortune(234), can't find anything about
> it..
> 
> Thanks for the help!
> 
> Bosken
> --
> View this message in context: http://n4.nabble.com/Normal-distribution-
> Lillie-test-tp1565083p1569361.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] Single character input without Enter

2010-02-25 Thread Greg Snow
The getGraphicsEvent function only works on windows (at least last time I 
checked), so if you are working only on windows, you can use that.  If you want 
something that works cross platform, then the tcltk solution is a possibility.

Your original question did not indicate if you would be willing to have this 
working through a graph or not, so I was not sure if this was a good solution 
or not.

I would have told you this on Monday, but I was out of town the first part of 
the week and not reading r-help.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Dieter Menne
> Sent: Thursday, February 25, 2010 11:29 AM
> To: r-help@r-project.org
> Subject: Re: [R] Single character input without Enter
> 
> 
> 
> Greg Snow-2 wrote:
> >
> > The playSudoku function in the sudoku package has 2 examples/methods
> of
> > responding to single key strokes, whether those methods will work for
> your
> > application or not depends on what you are trying to do.
> >
> >
> 
> Thanks, Greg, it boils down to the rather basic
> 
> getGraphicsEvent(prompt = "Waiting for input",
>  onMouseDown = NULL, onMouseMove = NULL,
>  onMouseUp = NULL, onKeybd = NULL)
> 
> in grDevices; so no tclk needed.  Strange that nobody told me
> 
> Dieter
> 
> 
> 
> 
> --
> View this message in context: http://n4.nabble.com/Single-character-
> input-without-Enter-tp1564153p1569460.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] two questions for R beginners

2010-02-25 Thread Patrick Burns

Apparently I need to explain the "lazy and
impatient" comment.  No offence was intended
(quite the contrary).  The meaning of it is
that the higher your level of frustration,
the more valuable your comments are likely to
be to me.

On 25/02/2010 17:31, Patrick Burns wrote:

* What were your biggest misconceptions or
stumbling blocks to getting up and running
with R?

* What documents helped you the most in this
initial phase?

I especially want to hear from people who are
lazy and impatient.

Feel free to write to me off-list. Definitely
write off-list if you are just confirming what
has been said on-list.



--
Patrick Burns
pbu...@pburns.seanet.com
http://www.burns-stat.com
(home of 'The R Inferno' and 'A Guide for the Unwilling S User')

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] angle phase mapping

2010-02-25 Thread Greg Snow
Look at the my.symbols function in the TeachingDemos package.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Magali teurlai
> Sent: Thursday, February 25, 2010 3:51 AM
> To: r-help@r-project.org
> Subject: Re: [R] angle phase mapping
> 
> Hi all,
> 
> sorry,
> here is the pdf and I re post my question :
> 
> could anyone give me a clue for the name of a function that would
> allow me to create the same kind of plot as the attached image in R?
> 
> I know how to create a map (shapefile polygons), I just want to add
> the phase information as triangles , pointing in the direction
> according to the phase, and the colors of the triangle describing as
> well the phase
> I will have a vector of phases : one scalr (the phase) per polygon
> plotted on the map
> 
> Thanks very much for any help
> 
> Magali
> 
> 2010/2/25 Magali teurlai 
> >
> > Hi all,
> >
> > could anyone give me a clue for the name of a function that would
> allow me create the same kind of plot as the attached image in R?
> >
> > I know how to create a map (shapfile polygons), I just want to add
> the phase information
> >
> > Thanks very much for any help
> >
> > Magali

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


Re: [R] two questions for R beginners

2010-02-25 Thread Clint Bowman
I started using statistical software with the commercial product S+ 
when I obtained a new HP735 workstation.  We kept the S+ license 
going for a number of years until I heard about R.  It was an easy 
transition and because I have been proficient in fortran and perl, 
the scripting came naturally--except for some syntax 
similarities/differences between perl and R interacting with a 
natural tendency towards dyslexia.


I especially like that I can slice and dice the data to ferret out 
relationships e.g., concentration by hour of day, by month, by wind 
speed, by wind direction--love those boxplots.


I also find that even the default settings produce some pretty 
attractive plots that are useable in many settings--I've also 
produced some pretty awful ones.


And the price always reminds me that I need to find every way 
possible to contribute to the overall good--I've forgotten too much 
of my fortran and C programming skills to contribute directly to 
the R Project.


Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Thu, 25 Feb 2010, Ralf B wrote:


My biggest blocker was my misconception that R is extremely difficult
to start with. It is powerful and one can do very complicated things (
that consequently turn things  complicated) but it comes with very
nice defaults and one can produce great results with standard tasks in
very little time - especially if one has done programming and/or
scripting before.

I pushed it away for too long that way. I wish I would have used it
years ago and avoided SPSS altogether - must have wasted 100s of hours
doing repetitive tasks by click and partial scripts in SPSS. Not to
mention a horrible license policy and a visualization unit that is
simply embarrassing for a product that is in its 18th or 19th version.

Ralf

On Thu, Feb 25, 2010 at 1:11 PM, Tal Galili  wrote:

My biggest stumbling blocks to getting up and running with R was whenever I
was lazy and impatient.

The more you love R, the more it loves you back.

Tal




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




On Thu, Feb 25, 2010 at 7:31 PM, Patrick Burns wrote:


* What were your biggest misconceptions or
stumbling blocks to getting up and running
with R?

* What documents helped you the most in this
initial phase?

I especially want to hear from people who are
lazy and impatient.

Feel free to write to me off-list.  Definitely
write off-list if you are just confirming what
has been said on-list.

--
Patrick Burns
pbu...@pburns.seanet.com
http://www.burns-stat.com
(home of 'The R Inferno' and 'A Guide for the Unwilling S User')

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



       [[alternative HTML version deleted]]

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



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Bimodal distribution

2010-02-25 Thread Greg Snow
You could use:

library(TeachingDemos)

x <- c(rnorm(1000,0,1),rnorm(1000,3,1))
TeachingDemos:::vis.test( x, TeachingDemos:::vt.normhist )

Then click on the plot that looks most different.

Sorry about needing TeachingDemos::: for now, the functions were accidentally 
left out of the NAMESPACE file, this has been fixed and will not be needed for 
version 2.6 on.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Samor Gandhi
> Sent: Wednesday, February 24, 2010 5:23 AM
> To: r-help@r-project.org
> Subject: [R] Bimodal distribution
> 
> Hello,
> 
> Is there any test  for bimodality in R that
> 
> x <- c(rnorm(1000,0,1),rnorm(1000,3,1))
> hist(x,nclass=100)
> 
> Thank you in advance for any help.
> 
> Regards,
> Samor
> 
> 
> 
>   [[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] Minimum Spanning Trees

2010-02-25 Thread Steve Lianoglou
Hi,

On Thu, Feb 25, 2010 at 12:16 PM, harunpirim  wrote:
>
> Hi,
>
> I need to find all minimum spanning trees of an unweighted graph.
> Is there a way in R to do that?

If you're working with graphs in R, you'll probably want to see what
the igraph library has to offer. For instance, it has a
"minimum.spanning.tree" function ...

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


[R] error in lmLists in lme4 package (bug?)

2010-02-25 Thread Elizabeth Purdom

Hello,
I am trying to use lmLists in the lme4 package and copying over very 
standard code from the nlme package given in 'Mixed-Effects Models in S 
and S-Plus'. It appears to not accept an 'I(age-11)' in the formula, 
though it will accept the formula with out the subtraction of 11 from 
age. This seems like it would be a bug, since this is standard formula 
syntax, unless I'm missing something about lmList in lme4. Please see my 
session info and output below.

Thanks for your help,
Elizabeth

> library(lme4)
> data(Orthodont)
> sessionInfo()
R version 2.10.0 (2009-10-26)
x86_64-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

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


other attached packages:
[1] MEMSS_0.3-6lme4_0.999375-32   Matrix_0.999375-31 
lattice_0.17-26  


loaded via a namespace (and not attached):
[1] grid_2.10.0  tools_2.10.0
> fm1Orth.lis<-lmList(distance~age|Subject, data=Orthodont)
> fm2Orth.lis<-lmList(distance~I(age-11)|Subject, data=Orthodont)
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found
Error in unique(c("AsIs", oldClass(x))) : object 'age' not found

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


Re: [R] Reading a password-protected Excel workbook

2010-02-25 Thread Gabor Grothendieck
Use RDCOMClient or rcom to open it and then use RODBC to read it.

On Thu, Feb 25, 2010 at 7:26 AM, Dimitri Shvorob
 wrote:
>
> I try reading a password-protected spreadsheet with RODBC, passing a file or
> an ODBC source to odbcConnect, e.g.
>
> con = odbcConnect(dsn = "mywkbk", uid = "", pwd = "mypwd")
>
> but get "Could not decrypt file" pop-up error message.
>
> Can anyone help?
>
> Thank you.
>
> --
> View this message in context: 
> http://n4.nabble.com/Reading-a-password-protected-Excel-workbook-tp1568925p1568925.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] Building R packages in Windows 7

2010-02-25 Thread Duncan Murdoch

On 25/02/2010 11:49 AM, Eric Ferreira wrote:

Ok,

I'm working under:
Windows 7 Professional 32bits, 4 GB RAM, 320 GB HD, Intel Core 2 Duo
processor
R 2.10.1

I've installed:
Rtools211
MikteX 2.8
HTML Help Workshop

Setting my PATH to:
c:\Rtools\bin;c:\Rtools\perl\bin;c:\Rtools\MinGW\bin;c:\Arquivos de
Programas\R\R-2.10.1pat\bin;c:\Arquivos de Programas\MikTeX
2.8\miktex\bin;c:\Program Files\HTML Help Workshop

...creating the package called "ExpDes" and asking (at the prompt) :

Rcmd build --binary ExpDes

Among others, a warning message is printed: "WARNING: some HTML links may
not be found", and no html files are produced.
  


Right, HTML help files are produced on demand, they aren`t stored in the 
binary package zip file.  HTML Help Workshop is not being used at all.


Duncan Murdoch

Thank you again.






On 25 February 2010 13:02, Duncan Murdoch  wrote:

> On 25/02/2010 10:56 AM, Eric Ferreira wrote:
>
>> This is my first package. I'm just getting started doing that, following
>> the
>> steps described on you website... I really don't know how I asking for
>> CHMs
>> to be produced, sorry.
>>
>>
>
> All I can suggest is that you need to be less stingy with information.
>  Tell us what you did.  Tell us what symptoms you saw.  Do both of those by
> cut and paste from your console, don't paraphrase, or refer to vague
> instructions like "your website".
>
> Duncan Murdoch
>
>
>> On 25 February 2010 12:52, Duncan Murdoch  wrote:
>>
>> > On 25/02/2010 10:40 AM, Eric Ferreira wrote:
>> >
>> >> Dear Duncan
>> >>
>> >> Thank so much for your reply.
>> >> Actually, I'm using the latest version of R and the problem persists.
>> What
>> >> do you use instead of HTML Help Workshop for newer R versions?
>> >>
>> >>
>> >
>> > We just produce text and HTML help pages on demand, and LaTeX ones for
>> the
>> > pdf manuals.  How are you asking for CHMs to be produced?
>> >
>> > Duncan Murdoch
>> >
>> >  Best regards
>> >>
>> >> Eric.
>> >>
>> >> On 25 February 2010 11:43, Duncan Murdoch 
>> wrote:
>> >>
>> >> > On 25/02/2010 9:06 AM, Eric Ferreira wrote:
>> >> >
>> >> >> Dear useRs,
>> >> >>
>> >> >> I'm having trouble building R packages in Windows 7 regarding HTML
>> help
>> >> >> Workshop.
>> >> >> Pointing PATH to c:\Program Files\HTML help Workshop does work in
>> >> Windows
>> >> >> (e.g. Vista) and does not in Windows 7.
>> >> >>
>> >> >> Some tips??
>> >> >>
>> >> >>
>> >> >
>> >> > We don't use the HTML Help Workshop any more since R 2.10.0, so you
>> >> could
>> >> > upgrade to the current R, and the problem will go away.  Otherwise, I
>> >> think
>> >> > you'll have to ask Microsoft for help.  But they aren't likely to be
>> >> > helpful:  Win XP is the most recent OS listed as supported.
>> >> >
>> >> > Duncan Murdoch
>> >> >
>> >>
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>>
>>
>
>





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


Re: [R] Normal distribution (Lillie.test())

2010-02-25 Thread Greg Snow
You should probably read fortune(117) and fortune(234) (and possibly some of 
the original discussions that lead to the fortunes).  Reading the help page for 
the SnowsPenultimateNormalityTest function (TeachingDemos package) may also 
help.  If you are happy with the plots, but still feel the need for a "test" of 
some sort, then you should investigate using the vis.test function in the 
TeachingDemos package.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Bosken
> Sent: Tuesday, February 23, 2010 4:13 AM
> To: r-help@r-project.org
> Subject: Re: [R] Normal distribution (Lillie.test())
> 
> 
> Hi,
> 
> Thanks for your reaction;
> 
> How do you come to the decision that my data not is normal distributed?
> 
> With the 69-95-99.7 test and Q-Q plot seems it ok! But these test are
> not
> exact, they only give you an image.
> 
> Gr. Bosken
> --
> View this message in context: http://n4.nabble.com/Normal-distribution-
> Lillie-test-tp1565083p1565762.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] Use 2 "ifelse" to sort data

2010-02-25 Thread Greg Snow
There is the %<% operator in the TeachingDemos package that allows comparisons 
like:

5 %<% a %<% 10

But in this case it is not needed (and in this case it takes more key strokes 
than 5 < a & a < 5, so may not be worth it).

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of bill.venab...@csiro.au
> Sent: Monday, February 22, 2010 8:55 PM
> To: tu_chun...@yahoo.com; r-help@r-project.org
> Subject: Re: [R] Use 2 "ifelse" to sort data
> 
> a <- 1:20
> tt <- ifelse(a > 10, "A", ifelse(a > 5, "B", "C"))
> 
> The problem you have is with '5 < a <= 10'.  Such double sided
> inequalities are used in mathematics but not in R.  Here you only need
> the first part, but if you did need both you would need to write
> 
> 5 < a & a <= 10
> 
> Look carefully and spot the difference.
> 
> Bill Venables
> CSIRO/CMIS Cleveland Laboratories
> 
> 
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Chunhao
> Sent: Tuesday, 23 February 2010 12:13 PM
> To: r-help@r-project.org
> Subject: [R] Use 2 "ifelse" to sort data
> 
> 
> Dear R users,
> I have a question how to use 2 "ifelse" to sort my data. Such as
> from 11 to 20 assign to A; 6 to 10 assign to B, and the rest of them
> assign
> to C
> 
> a<-1:20
> 
> tt<-ifelse(a>10, "A",no=ifelse( 5< a <=10, "B", "C"))
> 
> 
> Many Thanks
> Chunhao
> 
> --
> View this message in context: http://n4.nabble.com/Use-2-ifelse-to-
> sort-data-tp1565422p1565422.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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: export results

2010-02-25 Thread jim holtman
If your data can fit in memory, consider creating a list of the
intermediate values and then 'cbind'ing the result into a matrix that
you want to write out.

result <- lapply(1:100, function(x)  your function )
# if everything is the same size
result <- do.call(cbind, result)

On Thu, Feb 25, 2010 at 10:44 AM, Petr PIKAL  wrote:
> Hi
>
> r-help-boun...@r-project.org napsal dne 25.02.2010 12:42:46:
>
>>
>> Hi all,
>>
>> I am looping through a function for 100 time in the middle of my code,
> and I
>> want to output the results from this function. Is there a way to write
> the
>> results into a txt or csv fil? For example, I write the results from the
>> first loop to the first column of a spreadsheet and the results from the
>> second loop to the second coclumn of a spreadsheet etc.
>
> make a data frame, let say res
>
> res=as.data.frame(matrix(NA, n, 100)) #predefine data frame
>
> for (i in ...) {
>
> some stuff
> res[,i] <- some function result
> }
>
> write.table(res,)
>
> Regards
> Petr
>
>
>
>
>>
>> Thank you very much,
>> Wendy
>> --
>> View this message in context:
> http://n4.nabble.com/export-results-tp1568880p1568880.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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] data mining

2010-02-25 Thread Tal Galili
It depends on what you want to do.
Start by looking at:
http://cran.r-project.org/web/views/

There are also some nice startup
tutorials on google, start from that...

Tal

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




On Thu, Feb 25, 2010 at 1:32 PM, chinna  wrote:

>
> how can we achieve data mining using R Project.
> how to install Rattle gui for R project.
>
>
> can anyone please help me.
>
> i want to forecast the results .
>
> Thanks in advance.
> --
> View this message in context:
> http://n4.nabble.com/data-mining-tp1568872p1568872.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] How to extract one of four plots in a linear regression model

2010-02-25 Thread Alain Guillet

Hi,

You can extract a plot in using the option which in specifying the 
number of the plot (from 1 to 6). For example:


> plot(lm.D9, which=1)

Regards,
Alain Guillet


On 25-Feb-10 16:50, FMH wrote:

Dear All,

A linear regression model could be fitted by using lm function and the plot 
function can be used to check the assumption of the model.

The help menu shows few instances on suitable coding for fitting such a linear 
model. In addition, four different plots could be extracted simultaneously with 
only a single plot function as followed:



require(graphics)
## Annette Dobson (1990) "An Introduction to Generalized Linear Models".
## Page 9: Plant Weight Data.
ctl<- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt<- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group<- gl(2,10,20, labels=c("Ctl","Trt"))
weight<- c(ctl, trt)
anova(lm.D9<- lm(weight ~ group))
opar<- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
plot(lm.D9, las = 1) 





The plot function gives four different plots simulaneously but i just need only 
part of them, for instance the normality plot. Could someone  give some ideas 
the way to extract this single plot as i need to copy only this plot and paste 
it into Word document.

Thanks
Fir





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

   


--
Alain Guillet
Statistician and Computer Scientist

SMCS - Institut de statistique - Université catholique de Louvain
Bureau c.316
Voie du Roman Pays, 20
B-1348 Louvain-la-Neuve
Belgium

tel: +32 10 47 30 50

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Building R packages in Windows 7

2010-02-25 Thread Duncan Murdoch

On 25/02/2010 10:56 AM, Eric Ferreira wrote:

This is my first package. I'm just getting started doing that, following the
steps described on you website... I really don't know how I asking for CHMs
to be produced, sorry.
  


All I can suggest is that you need to be less stingy with information.  
Tell us what you did.  Tell us what symptoms you saw.  Do both of those 
by cut and paste from your console, don't paraphrase, or refer to vague 
instructions like "your website".


Duncan Murdoch


On 25 February 2010 12:52, Duncan Murdoch  wrote:

> On 25/02/2010 10:40 AM, Eric Ferreira wrote:
>
>> Dear Duncan
>>
>> Thank so much for your reply.
>> Actually, I'm using the latest version of R and the problem persists. What
>> do you use instead of HTML Help Workshop for newer R versions?
>>
>>
>
> We just produce text and HTML help pages on demand, and LaTeX ones for the
> pdf manuals.  How are you asking for CHMs to be produced?
>
> Duncan Murdoch
>
>  Best regards
>>
>> Eric.
>>
>> On 25 February 2010 11:43, Duncan Murdoch  wrote:
>>
>> > On 25/02/2010 9:06 AM, Eric Ferreira wrote:
>> >
>> >> Dear useRs,
>> >>
>> >> I'm having trouble building R packages in Windows 7 regarding HTML help
>> >> Workshop.
>> >> Pointing PATH to c:\Program Files\HTML help Workshop does work in
>> Windows
>> >> (e.g. Vista) and does not in Windows 7.
>> >>
>> >> Some tips??
>> >>
>> >>
>> >
>> > We don't use the HTML Help Workshop any more since R 2.10.0, so you
>> could
>> > upgrade to the current R, and the problem will go away.  Otherwise, I
>> think
>> > you'll have to ask Microsoft for help.  But they aren't likely to be
>> > helpful:  Win XP is the most recent OS listed as supported.
>> >
>> > 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] How to add a title to represent four different plot in lm function

2010-02-25 Thread FMH
Dear All,

A linear regression model could be fitted by using lm function and the plot 
function can be used to check the assumptions of the model. The example is as 
followed.

require(graphics)
## Annette Dobson (1990) "An Introduction to Generalized Linear Models".
## Page 9: Plant Weight Data.
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2,10,20, labels=c("Ctl","Trt"))
weight <- c(ctl, trt)
anova(lm.D9 <- lm(weight ~ group))
opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
plot(lm.D9, las = 1) 

Could someone advice me the way to add a single title either at the above or 
bottom of these 4 plots, entitled "The verification of model assumtion via four 
different plots" ?

Thanks
Fir




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 do: Correlation with "blocks" (or - "repeated measures" ?!) ?

2010-02-25 Thread Tal Galili
Hello dear R help group,

I have the following setup to analyse:
We have about 150 subjects, and for each subject we performed a pair of
tests (under different conditions) 18 times.
The 18 different conditions of the test are complementary, in such a way so
that if we where to average over the tests (for each subject), we would get
no correlation between the tests (between subjects).
What we wish to know is the correlation (and P value) between the tests, in
within subjects, but over all the subjects.

The way I did this by now was to perform the correlation for each subject,
and then look at the distribution of the correlations received so to see if
it's mean is different then 0.
But I suspect there might be a better way for answering the same question
(someone said to me something about "geographical correlation", but a
shallow search didn't help).

p.s: I understand there might be a place here to do some sort of mixed
model, but I would prefer to present a "correlation", and am not sure how to
extract such an output from a mixed model.

Also, here is a short dummy code to give an idea of what I am talking about:

attach(longley)
N <- length(Unemployed)
block <- c(
rep( "a", N),
rep( "b", N),
 rep( "c", N)
)
 Unemployed.3 <- c(Unemployed + rnorm(1),
Unemployed + rnorm(1),
Unemployed + rnorm(1))

GNP.deflator.3 <- c(GNP.deflator + rnorm(1),
GNP.deflator + rnorm(1),
GNP.deflator + rnorm(1))

cor(Unemployed, GNP.deflator)
cor(Unemployed.3, GNP.deflator.3)
cor(Unemployed.3[block == "a"], GNP.deflator.3[block == "a"])
cor(Unemployed.3[block == "b"], GNP.deflator.3[block == "b"])
cor(Unemployed.3[block == "c"], GNP.deflator.3[block == "c"])

(I would like to somehow combine the last three correlations...)



Any ideas will be welcomed.

Best,
Tal






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

[[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] Building R packages in Windows 7

2010-02-25 Thread Duncan Murdoch

On 25/02/2010 10:40 AM, Eric Ferreira wrote:

Dear Duncan

Thank so much for your reply.
Actually, I'm using the latest version of R and the problem persists. What
do you use instead of HTML Help Workshop for newer R versions?
  


We just produce text and HTML help pages on demand, and LaTeX ones for 
the pdf manuals.  How are you asking for CHMs to be produced?


Duncan Murdoch

Best regards

Eric.

On 25 February 2010 11:43, Duncan Murdoch  wrote:

> On 25/02/2010 9:06 AM, Eric Ferreira wrote:
>
>> Dear useRs,
>>
>> I'm having trouble building R packages in Windows 7 regarding HTML help
>> Workshop.
>> Pointing PATH to c:\Program Files\HTML help Workshop does work in Windows
>> (e.g. Vista) and does not in Windows 7.
>>
>> Some tips??
>>
>>
>
> We don't use the HTML Help Workshop any more since R 2.10.0, so you could
> upgrade to the current R, and the problem will go away.  Otherwise, I think
> you'll have to ask Microsoft for help.  But they aren't likely to be
> helpful:  Win XP is the most recent OS listed as supported.
>
> 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] How to extract one of four plots in a linear regression model

2010-02-25 Thread FMH
Dear All,

A linear regression model could be fitted by using lm function and the plot 
function can be used to check the assumption of the model. 

The help menu shows few instances on suitable coding for fitting such a linear 
model. In addition, four different plots could be extracted simultaneously with 
only a single plot function as followed:



require(graphics)
## Annette Dobson (1990) "An Introduction to Generalized Linear Models".
## Page 9: Plant Weight Data.
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2,10,20, labels=c("Ctl","Trt"))
weight <- c(ctl, trt)
anova(lm.D9 <- lm(weight ~ group))
opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
plot(lm.D9, las = 1) 




The plot function gives four different plots simulaneously but i just need only 
part of them, for instance the normality plot. Could someone  give some ideas 
the way to extract this single plot as i need to copy only this plot and paste 
it into Word document.

Thanks
Fir





__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Odp: export results

2010-02-25 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 25.02.2010 12:42:46:

> 
> Hi all,
> 
> I am looping through a function for 100 time in the middle of my code, 
and I
> want to output the results from this function. Is there a way to write 
the
> results into a txt or csv fil? For example, I write the results from the
> first loop to the first column of a spreadsheet and the results from the
> second loop to the second coclumn of a spreadsheet etc.

make a data frame, let say res

res=as.data.frame(matrix(NA, n, 100)) #predefine data frame
 
for (i in ...) {

some stuff
res[,i] <- some function result
}

write.table(res,)

Regards
Petr




> 
> Thank you very much, 
> Wendy 
> -- 
> View this message in context: 
http://n4.nabble.com/export-results-tp1568880p1568880.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] mtext with at=NULL

2010-02-25 Thread Duncan Murdoch

On 25/02/2010 8:58 AM, Ulrike Feldmann wrote:

Hello,

in the help of mtext I found

"at: If ‘length(at)==0’ (the default), the location will be determined
by ‘adj’"

But if I use mtext( "hello world", at=NULL) there comes the following
error message:

Fehler in mtext("hallo Welt", side = 3, adj = NA, at = NULL) :
  'at' mit Länge 0 angegeben

So the help says it is ok to use at with length(at) == 0 but if I use an
at with length(at) == 0 I get an error message.

This is a bug, isn't it?


I'd say it's a documentation error:  it claims that the default is 
length 0, but the default is NA, which is length 1.  The actual test in 
the code uses adj when a C equivalent of is.finite(at) is TRUE, so I'll 
change the docs to match the behaviour, rather than changing the 
behaviour to match the docs.


Duncan Murdoch

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


Re: [R] error using pvcm() on unbalanced panel data

2010-02-25 Thread Liviu Andronic
On 2/25/10, Liviu Andronic  wrote:
>  I can reproduce the error on a modified example from the vignette:
>  > require(plm)
>  > data("Hedonic")
>  > Hed <- pvcm(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + 
> tax + ptratio + blacks + lstat, Hedonic, model = "within",index = "townid")
>  Error in FUN(X[[1L]], ...) : insufficient number of observations
>  > ##it fails for both FE and RE cases
>  > Hed <- pvcm(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + 
> tax + ptratio + blacks + lstat, Hedonic, model = "random",index = "townid")
>  Error in FUN(X[[1L]], ...) : insufficient number of observations
>

A quick update, the function pooltest() used via its formula interface
fails in a similar way:
> pooltest(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + tax + 
> ptratio + blacks + lstat, Hedonic, model = "within",index = "townid")
Error in FUN(X[[1L]], ...) : insufficient number of observations
> pooltest(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + tax + 
> ptratio + blacks + lstat, Hedonic, model = "pooling",index = "townid")
Error in FUN(X[[1L]], ...) : insufficient number of observations

Liviu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] export results

2010-02-25 Thread Wendy

Hi all,
 
I am looping through a function for 100 time in the middle of my code, and I
want to output the results from this function. Is there a way to write the
results into a txt or csv fil? For example, I write the results from the
first loop to the first column of a spreadsheet and the results from the
second loop to the second coclumn of a spreadsheet etc.
 
Thank you very much, 
Wendy 
-- 
View this message in context: 
http://n4.nabble.com/export-results-tp1568880p1568880.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] mtext with at=NULL

2010-02-25 Thread Ulrike Feldmann
Hello,

in the help of mtext I found

"at: If ‘length(at)==0’ (the default), the location will be determined
by ‘adj’"

But if I use mtext( "hello world", at=NULL) there comes the following
error message:

Fehler in mtext("hallo Welt", side = 3, adj = NA, at = NULL) :
  'at' mit Länge 0 angegeben

So the help says it is ok to use at with length(at) == 0 but if I use an
at with length(at) == 0 I get an error message.

This is a bug, isn't it?

Kind regards,

Ulrike Feldmann

-- 
Ulrike Feldmann   ZKRD
Statistician  Zentrales Knochenmarkspender-Register
Fon: +49 731 1507-45  fuer die Bundesrepublik Deutschland
Fax: +49 731 1507-01  Gemeinnützige Gesellschaft mbH
http://www.zkrd.deHelmholtzstraße 10, 89081 Ulm, Germany
-
Registergericht: Amtsgericht Ulm, HRB 2566
Geschäftsführer: Manfred Stähle und Dr. Dr. Carlheinz Müller

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Reading a password-protected Excel workbook

2010-02-25 Thread Dimitri Shvorob

I try reading a password-protected spreadsheet with RODBC, passing a file or
an ODBC source to odbcConnect, e.g.

con = odbcConnect(dsn = "mywkbk", uid = "", pwd = "mypwd")

but get "Could not decrypt file" pop-up error message.

Can anyone help?

Thank you.

-- 
View this message in context: 
http://n4.nabble.com/Reading-a-password-protected-Excel-workbook-tp1568925p1568925.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] error using pvcm() on unbalanced panel data

2010-02-25 Thread Liviu Andronic
Dear all
I am trying to fit Variable Coefficients Models on Unbalanced Panel
Data. I managed to fit such models on balanced panel data (the example
from the "plm" vignette), but I failed to do so on my real, unbalanced
panel data.

I can reproduce the error on a modified example from the vignette:
> require(plm)
> data("Hedonic")
> Hed <- pvcm(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + tax + 
> ptratio + blacks + lstat, Hedonic, model = "within",index = "townid")
Error in FUN(X[[1L]], ...) : insufficient number of observations
> ##it fails for both FE and RE cases
> Hed <- pvcm(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + tax + 
> ptratio + blacks + lstat, Hedonic, model = "random",index = "townid")
Error in FUN(X[[1L]], ...) : insufficient number of observations

Would this be expected behaviour for unbalanced data? The vignette
warns of several limitations regarding such data, but doesn't mention
this specific case as a limitation. I would like to subsequently
perform  a test of poolability on my real data.

Thank you
Liviu


> sessionInfo()
R version 2.10.1 (2009-12-14)
x86_64-pc-linux-gnu

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

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

other attached packages:
 [1] plm_1.2-3sandwich_2.2-5   zoo_1.6-2MASS_7.3-5
 [5] Formula_0.2-0kinship_1.1.0-23 lattice_0.18-3   nlme_3.1-96
 [9] survival_2.35-8  fortunes_1.3-7   RGtk2_2.12.18cairoDevice_2.10
[13] sos_1.2-5brew_1.0-3   hints_1.0.1-1

loaded via a namespace (and not attached):
[1] grid_2.10.1  tools_2.10.1

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] behavior of seq_along

2010-02-25 Thread David Winsemius


On Feb 25, 2010, at 9:02 AM, Dale Steele wrote:

I'm trying to understand the behavior of seq_along in the following  
example:


x <- 1:5; sum(x)
y <- 6:10; sum(y)

data <- c(x,y)
S <- sum( data[seq_along(x)] )
S
T <- sum( data[seq_along(y)] )
T

Why is T != sum(y) ?


Look at

seq_along(y)

seq_along returns indices for the purpose of accession of elements, so  
it starts with 1 and ends with the length of the object.


Had you asked for sum(data[y[seq_along(y)]]) you might have achieved  
your expectation.




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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
Heritage Laboratories
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] Building R packages in Windows 7

2010-02-25 Thread Duncan Murdoch

On 25/02/2010 9:06 AM, Eric Ferreira wrote:

Dear useRs,

I'm having trouble building R packages in Windows 7 regarding HTML help
Workshop.
Pointing PATH to c:\Program Files\HTML help Workshop does work in Windows
(e.g. Vista) and does not in Windows 7.

Some tips??
  


We don't use the HTML Help Workshop any more since R 2.10.0, so you 
could upgrade to the current R, and the problem will go away.  
Otherwise, I think you'll have to ask Microsoft for help.  But they 
aren't likely to be helpful:  Win XP is the most recent OS listed as 
supported.


Duncan Murdoch

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


Re: [R] reducing data.frame

2010-02-25 Thread John Kane
Perhaps the reshape package?

It's just about impossible to read your data layout.  Could you resubmit the 
example using dput()?

Thanks

--- On Thu, 2/25/10, AC Del Re  wrote:

> From: AC Del Re 
> Subject: [R] reducing data.frame
> To: r-help@r-project.org
> Received: Thursday, February 25, 2010, 12:44 AM
> Hi All,
> 
> Is there an easy way to reduce a data.frame to 1 'id' per
> row while keeping
> information from the other rows of that same variable, if
> applicable? e.g.:
> 
> # data
> 
>  multi[1:15,]
>      id     
>    r  n wi   wi.tau 
>        z   k
> alliance a.rater   eml
> treatment outcome  o.rater german
> 1   100 0.280 44 41 21.72514 0.2876821
> 210    
>   
>     
>    Client   
> 2   100 0.280 44 41 21.80953 0.2876821
> 182    
>  Early
>       
>   
> 3   100 0.280 44 41 22.36641 0.2876821
> 206   Client 
> 
>       
>   
> 4   100 0.280 44 41 23.59224 0.2876821
> 188    
>   
>       
>  Other
> 5   100 0.280 44 41 23.83157 0.2876821
> 147      WAI     
> 
>       
>   
> 6   101 0.000 37 34 19.65678 0.000
> 182    
>  Early
>       
>   
> 7   101 0.5423790 37 34 17.65078
> 0.6075200  98  
>     
> Psychodymic     
>   
> 8   101 0.5423790 37 34 19.58820 0.6075200
> 210    
>   
>      
> Observer   
> 9   101 0.5423790 37 34 21.09334 0.6075200
> 188    
>   
>       
>  Other
> 10  101 0.9075737 37 34 19.65678 1.5135878 182 
>     
> Late
>       
>   
> 11 103a 0.495 18 15 10.36364 0.5426615  90 
>     
> 
>       SCL 
>   
> 12 103a 0.6171548 18 15 11.32425 0.7203964 210 
>     
> 
>      
> Observer   
> 13 103a 0.6171548 18 15 11.34714 0.7203964 182 
>     Early
>       
>   
> 14 103a 0.6171548 18 15 11.49606 0.7203964 206 
>  Client  
>       
>   
> 15 103a 0.6171548 18 15 11.81150 0.7203964 188 
>     
> 
>       
>  Other
> 
> # with the goal of having a reduced df (1 id per row) like
> this:
> 
>    id     
>    r  n wi   wi.tau 
>        z   k
> alliance a.rater   eml
> treatment outcome  o.rater german
> 1   100 0.280 44 41 21.72514 0.2876821
> 210     wai    client 
> early
>   
>    Client   other
>      101 etc...
> 
> Ideally, I would like to reduce by id and r, if the values
> are the same and
> keep any discrepant values as a separate row (if possible),
> e.g.:
> 
> 6   101 0.000 37 34 19.65678 0.000
> 182    
>  Early
>       
>   
> 7   101 0.5423790 37 34 17.65078
> 0.6075200  98  
>     Late
> Psychodymic   
>    Observer  Other
> 
> I appreciate any assistance,
> 
> AC
> 
>     [[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.
> 


  __
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/

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


  1   2   >