Re: [R] can't find and install reshape2??

2010-10-12 Thread chris howden
Hi Guys,

Thanks for your suggestions and sorry for the delay in replying, I've been
having one of those weeks.

I feel a little silly not trying the package name input as a character
string, I should have know that. However I have tried your suggestions and
neither worked. The code and error messages are at the bottom of this email
and U can see the reason would appear the reshape2 package is not
available on the repositories I'm trying to access.

I then tried closing R, reopening it and looking in the following CRAN
mirrors:
Australia
UK(London)
Canada(BC)
USA(AZ)

Reshape 2 was in none of them, my choices were:
ResearchMethods
Reshape
ResistorArray

But no reshape2

Any ideas as to why I can't see reshape2? 

Is it just me or are other people having this problem?

thanks

 download.packages('reshape2', destdir=c:\\)
Warning in download.packages(reshape2, destdir = c:\\) :
  no package 'reshape2' at the repositories
 [,1] [,2]


 install.packages('reshape2')
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
  package ‘reshape2’ is not available





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Jeffrey Spies
Sent: Monday, 4 October 2010 10:57 AM
To: Chris Howden
Cc: r-help@r-project.org
Subject: Re: [R] can't find and install reshape2??

The first argument in download.packages should be of type character or
a vector of characters.

This worked for me:

install.packages('reshape2')

as did:

download.packages('reshape2', '~/Downloads/')

Cheers,

Jeff.

On Sun, Oct 3, 2010 at 8:57 PM, Chris Howden
ch...@trickysolutions.com.au wrote:
 Hi everyone,



 I’m trying to install reshape2.



 But when I click on “install package” it’s not coming up!?!?! I’m getting
 reshape, but no reshape2?



 I’ve also tried download.packages(reshape2, destdir=c:\\) 
 download.packages(Reshape2, destdir=c:\\)…but no luck!!!



 Does anyone have any ideas what could be going on?



 Chris Howden

 Founding Partner

 Tricky Solutions

 Tricky Solutions 4 Tricky Problems

 Evidence Based Strategic Development, IP development, Data Analysis,
 Modelling, and Training

 (mobile) 0410 689 945

 (fax / office) (+618) 8952 7878

 ch...@trickysolutions.com.au

        [[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] can't find and install reshape2??

2010-10-12 Thread chris howden
Just wanted to say that I've gone onto the CRAN website and downloaded it
directly from there.

So its no longer a problem for me.

But it may be one for other people, it is kinda weird I couldn't see it on
the list of packages on 4 mirrors!!

Thanks for your help though.


-Original Message-
From: chris howden [mailto:tall.chr...@yahoo.com.au] 
Sent: Tuesday, 12 October 2010 3:48 PM
To: 'Jeffrey Spies'; 'David Winsemius'
Cc: 'r-help@r-project.org'
Subject: RE: [R] can't find and install reshape2??

Hi Guys,

Thanks for your suggestions and sorry for the delay in replying, I've been
having one of those weeks.

I feel a little silly not trying the package name input as a character
string, I should have know that. However I have tried your suggestions and
neither worked. The code and error messages are at the bottom of this email
and U can see the reason would appear the reshape2 package is not
available on the repositories I'm trying to access.

I then tried closing R, reopening it and looking in the following CRAN
mirrors:
Australia
UK(London)
Canada(BC)
USA(AZ)

Reshape 2 was in none of them, my choices were:
ResearchMethods
Reshape
ResistorArray

But no reshape2

Any ideas as to why I can't see reshape2? 

Is it just me or are other people having this problem?

thanks

 download.packages('reshape2', destdir=c:\\)
Warning in download.packages(reshape2, destdir = c:\\) :
  no package 'reshape2' at the repositories
 [,1] [,2]


 install.packages('reshape2')
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
  package ‘reshape2’ is not available





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Jeffrey Spies
Sent: Monday, 4 October 2010 10:57 AM
To: Chris Howden
Cc: r-help@r-project.org
Subject: Re: [R] can't find and install reshape2??

The first argument in download.packages should be of type character or
a vector of characters.

This worked for me:

install.packages('reshape2')

as did:

download.packages('reshape2', '~/Downloads/')

Cheers,

Jeff.

On Sun, Oct 3, 2010 at 8:57 PM, Chris Howden
ch...@trickysolutions.com.au wrote:
 Hi everyone,



 I’m trying to install reshape2.



 But when I click on “install package” it’s not coming up!?!?! I’m getting
 reshape, but no reshape2?



 I’ve also tried download.packages(reshape2, destdir=c:\\) 
 download.packages(Reshape2, destdir=c:\\)…but no luck!!!



 Does anyone have any ideas what could be going on?



 Chris Howden

 Founding Partner

 Tricky Solutions

 Tricky Solutions 4 Tricky Problems

 Evidence Based Strategic Development, IP development, Data Analysis,
 Modelling, and Training

 (mobile) 0410 689 945

 (fax / office) (+618) 8952 7878

 ch...@trickysolutions.com.au

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


[R] merging and working with BIG data sets. Is sqldf the best way??

2010-10-12 Thread Chris Howden
Hi everyone,



I’m working with some very big datasets (each dataset has 11 million rows
and 2 columns). My first step is to merge all my individual data sets
together (I have about 20)



I’m using the following command from sqldf

   data1 - sqldf(select A.*, B.* from A inner join B
using(ID))



But it’s taking A VERY VERY LONG TIME to merge just 2 of the datasets (well
over 2 hours, possibly longer since it’s still going).





I was wondering if anyone could suggest a better way, or maybe some
suggestions on how I could tweak my computer set up to speed it up?





I’ve looked at the following packages and this is the only way I’ve found to
actually merge large data sets in R. These packages seem great for accessing
large data sets by avoiding storing them in RAM….but I can’t see how they
can be used to merge data sets together:

·ff

·filehash

·bigmemory



Does anyone have any ideas?



At the moment my best idea is to hand it over to someone with a dedicated
database server and get them to do the merges (and then hope package biglm
can do the modelling)



Thanks for any ideas at all!!







Chris Howden

Founding Partner

Tricky Solutions

Tricky Solutions 4 Tricky Problems

Evidence Based Strategic Development, IP development, Data Analysis,
Modelling, and Training

(mobile) 0410 689 945

(fax / office) (+618) 8952 7878

ch...@trickysolutions.com.au

[[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] merging and working with BIG data sets. Is sqldf the best way??

2010-10-12 Thread Jeff Newmiller

Chris Howden wrote:

Hi everyone,

I’m working with some very big datasets (each dataset has 11 million rows
and 2 columns). My first step is to merge all my individual data sets
together (I have about 20)

I’m using the following command from sqldf
   data1 - sqldf(select A.*, B.* from A inner join B
using(ID))

But it’s taking A VERY VERY LONG TIME to merge just 2 of the datasets (well
over 2 hours, possibly longer since it’s still going).

I was wondering if anyone could suggest a better way, or maybe some
suggestions on how I could tweak my computer set up to speed it up?

I’ve looked at the following packages and this is the only way I’ve found to
actually merge large data sets in R. These packages seem great for accessing
large data sets by avoiding storing them in RAM….but I can’t see how they
can be used to merge data sets together:

·ff
·filehash
·bigmemory

Does anyone have any ideas?

At the moment my best idea is to hand it over to someone with a dedicated
database server and get them to do the merges (and then hope package biglm
can do the modelling)
  


SQLite is not optimized for large datasets. If you don't have
familiarity with index generation in SQL databases, then you
may well be best served by finding someone who has such
experience.

If the data are already sorted by ID, it may be feasible to do the
merge with a Perl or Python script, processing records
from two files at a time incrementally.

Good luck!



Thanks for any ideas at all!!


Chris Howden
Founding Partner
Tricky Solutions
Tricky Solutions 4 Tricky Problems
Evidence Based Strategic Development, IP development, Data Analysis,
Modelling, and Training
(mobile) 0410 689 945
(fax / office) (+618) 8952 7878
ch...@trickysolutions.com.au




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

2010-10-12 Thread Gavin Simpson
On Tue, 2010-10-12 at 11:44 +0800, elaine kuo wrote:
 Dear list,

 I want to make a plot based on the following information, using the command
 plot.
 
 variable A for x axis : temperature (range: -20 degrees to 40 degree)
 
 variable B for y axis : altitude (range: 50 m to 2500 m )

Use the subset argument of plot():

## dummy data
dat - data.frame(temperature = seq(-20, 40, by = 1),
  altitude = seq(50, 2500, length = 61))
## use subset to select out the data we want
plot(altitude ~ temperature, data = dat, subset = temperature = 0)

To understand what this is doing, consider:

with(dat, temperature = 0)

So temperature = 0 is yielding a logical vector indicating which rows
of dat are used to form the plot.

If you need to permanently subset your data, there is a subset function
that works the same way:

subset(dat, subset = temperature = 0)

but yields a data frame of the rows of dat that matched the temperature
condition.

HTH

G

 The data below 0 degree of X variable wants to be erased tentatively.
 
 Please kindly advise the command to extract the data ranging from 0 degree
 to 40 degrees.
 
 Thank you.
 
 
 
 Elaine
 
   [[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.

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] can't find and install reshape2??

2010-10-12 Thread Uwe Ligges
My guess is you are using an outdated R version for which the rather new 
reshape2 package has not been compiled.


Uwe Ligges


On 12.10.2010 08:23, chris howden wrote:

Just wanted to say that I've gone onto the CRAN website and downloaded it
directly from there.

So its no longer a problem for me.

But it may be one for other people, it is kinda weird I couldn't see it on
the list of packages on 4 mirrors!!

Thanks for your help though.


-Original Message-
From: chris howden [mailto:tall.chr...@yahoo.com.au]
Sent: Tuesday, 12 October 2010 3:48 PM
To: 'Jeffrey Spies'; 'David Winsemius'
Cc: 'r-help@r-project.org'
Subject: RE: [R] can't find and install reshape2??

Hi Guys,

Thanks for your suggestions and sorry for the delay in replying, I've been
having one of those weeks.

I feel a little silly not trying the package name input as a character
string, I should have know that. However I have tried your suggestions and
neither worked. The code and error messages are at the bottom of this email
and U can see the reason would appear the reshape2 package is not
available on the repositories I'm trying to access.

I then tried closing R, reopening it and looking in the following CRAN
mirrors:
Australia
UK(London)
Canada(BC)
USA(AZ)

Reshape 2 was in none of them, my choices were:
ResearchMethods
Reshape
ResistorArray

But no reshape2

Any ideas as to why I can't see reshape2?

Is it just me or are other people having this problem?

thanks


download.packages('reshape2', destdir=c:\\)

Warning in download.packages(reshape2, destdir = c:\\) :
   no package 'reshape2' at the repositories
  [,1] [,2]



install.packages('reshape2')

Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
   package ‘reshape2’ is not available





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Jeffrey Spies
Sent: Monday, 4 October 2010 10:57 AM
To: Chris Howden
Cc: r-help@r-project.org
Subject: Re: [R] can't find and install reshape2??

The first argument in download.packages should be of type character or
a vector of characters.

This worked for me:

install.packages('reshape2')

as did:

download.packages('reshape2', '~/Downloads/')

Cheers,

Jeff.

On Sun, Oct 3, 2010 at 8:57 PM, Chris Howden
ch...@trickysolutions.com.au  wrote:

Hi everyone,



I’m trying to install reshape2.



But when I click on “install package” it’s not coming up!?!?! I’m getting
reshape, but no reshape2?



I’ve also tried download.packages(reshape2, destdir=c:\\)
download.packages(Reshape2, destdir=c:\\)…but no luck!!!



Does anyone have any ideas what could be going on?



Chris Howden

Founding Partner

Tricky Solutions

Tricky Solutions 4 Tricky Problems

Evidence Based Strategic Development, IP development, Data Analysis,
Modelling, and Training

(mobile) 0410 689 945

(fax / office) (+618) 8952 7878

ch...@trickysolutions.com.au

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


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

2010-10-12 Thread Dennis Murphy
Hi:

Try
str(u.ts)
class(u.ts)

That should give you more information about the type of object being input
to stl.

I tried the following, which worked on my system:

u - rnorm(100)
u.ts - ts(u, start = c(2001, 1), frequency = 12)
u.stl - stl(u.ts, 'per')
plot(u.stl)

 sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages:
 [1] rgl_0.92Hmisc_3.8-3 survival_2.35-8 sos_1.3-0
 [5] brew_1.0-4  lattice_0.19-11 ggplot2_0.8.8   proto_0.3-8
 [9] reshape_0.8.3   plyr_1.2.1

loaded via a namespace (and not attached):
[1] cluster_1.13.1 tools_2.11.1

Since stl() is part of the base distribution, my attached packages should
have no relevance in whether stl() works or not. The help page says that the
input must be a univariate ts object with frequency greater than 1.

My guess is that you have input a multiple time series object, which is why
it is worth looking at str() and class().

HTH,
Dennis

On Mon, Oct 11, 2010 at 9:39 PM, CALEF ALEJANDRO RODRIGUEZ CUEVAS 
alejandro.rodriguez.cue...@gmail.com wrote:

 Hi everyone.

 I'm having some troubles with STL function to decompose some data.

 My issue is that I have monthly data from September 2005 up to August 2010
 i. e. 60 observations.

 I define it in the following way:

 *u-read.csv(C:/CELEBREX.csv,header = TRUE)
 u.ts-ts(u, start=c(2005,9), frequency=12)
 *
 The issue is that when I try to use

 stl(u.ts, 'per')

 Then the following error message is displayed:

 *Error en stl(u.ts, per) : only univariate series are allowed
 *

 I know that stl needs a univariate time series in order to run, but I've
 already defined it in *u.ts.

 *Moreover, if I use the same *u.ts* with functions which also requires
 univariate time series, i. e.

 *auto.arima(u.ts, d=1, D=1)*

 Series: u.ts
 ARIMA(0,1,0)(0,1,1)[12]

 Call: auto.arima(x = u.ts, d = 1, D = 1)

 Coefficients:  sma1
  -0.5300
 s.e.  0.2553

 sigma^2 estimated as 22788111:  log likelihood = -466.79
 AIC = 937.57   AICc = 937.85   BIC = 941.27

 or in

 *StructTS(u.ts)

 *Call:
 StructTS(x = u.ts)

 Variances:
   level slope  seas   epsilon
   0 0142829  12358227


 or in

 *decompose(u.ts)*

 then I don't have any problem with *u.ts *defined as univariate time serie.

 What is it happening with STL?, What am I doing wrong?

 Thanks in advance.

[[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


[R] clustered data in wilcox_test

2010-10-12 Thread Devin M. Caughey
Dear all,

I have R code of the following form:

wilcox_test(categoricalResponse ~ binaryTreatment | matchedCluster)

The data consist of 11 matched pairs of clusters, each of which contains a 
variable number of units on which the response variable is measured. Treatment, 
however, was assigned at the level of the cluster. First, is there any way to 
make `wilcox_test' calculate p-value based on the permutation distribution of 
the _clusters_, rather than treating all units in each stratum as independent? 
Second, does the function `wilcox_test' (and similar functions like 
`surv_test') in the `coin' package weights the linear statistic in each stratum 
by 1/(N_s + 1), where N_s is the number of observations in the stratum, as is 
suggested by van Elteren (1960)? 

Thank you for your assistance.

Devin


---
Devin M. Caughey
PhD Candidate, Political Science
IGERT-PEPPP Fellow
UC Berkeley, 210 Barrows Hall, Berkeley, CA 94720-1950
caug...@berkeley.edu
www.devincaughey.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] Rpart query

2010-10-12 Thread jagdeesh_mn

Hi,

Being a novice this is my first usage of R.

I am trying to use rpart for building a decision tree in R. And I have the
following dataframe 


Outlook TempHumidityWindy   Class
Sunny   75  70  Yes Play
Sunny   80  90  Yes Don't Play
Sunny   85  85  No  Don't Play
Sunny   72  95  No  Don't Play
Sunny   69  70  No  Play
Overcast72  90  Yes Play
Overcast83  78  No  Play
Overcast64  65  Yes Play
Overcast81  75  No  Play

The first line indicating the header. When I use the formula,

CART-rpart(Class ~ Outlook + Temp + Humidity + Windy, data=dataframe)

and trying to plot the values of CART using plot(CART), I get the following
error,

Error in plot.rpart(CART) : fit is not a tree, just a root.

Am I missing something here? Any help would be greatly appreciated. Btw, the
dataframe was obtained by reading a csv which shouldn't be an issue. 

-Jagdeesh


-- 
View this message in context: 
http://r.789695.n4.nabble.com/Rpart-query-tp2991198p2991198.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] GLM Gamma Regression error message in R

2010-10-12 Thread Stratos Laskarides
 Dear Madam/Sir

This may be quite a long shot...

By way of intro, I am a masters student in actuarial science at the
University of Cape Town, and I am doing a project in R on some healthcare
cost data. During my coding in R I encountered an error message, which I
then googled, but I am still unable to resolve the issue.

I would like to please ask if and how it is possible to resolve the problem
raised by the error message Error: NA/NaN/Inf in foreign function call (arg
1) In addition: Warning message: *step size truncated due to divergence *in
R?

As for some background on my specific data and research problem at hand, I
am fitting a gamma regression model to 13 000 lines of insurance claims
data, which will be regressed against categorical variables such as Age
Band, Gender, and Region.

Perhaps my problem arises because the data set is too large and the
iteratively reweighted least squares algorithm therefore cannot converge, in
which case I perhaps need another GLM type. Or maybe the categorical
explanatory variables can take on too many values (e.g. there are 15 Age
Bands, 5 Regions).

Any insights you could provide would be much appreciated.

Thank you ever so much.

Kind regards
Stratos Laskarides
South Africa

[[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] fast rowCumsums wanted for calculating the cdf

2010-10-12 Thread Gregor
Dear all,

I am struggling with a (currently) cost-intensive problem: calculating the
(non-normalized) cumulative distribution function, given the (non-normalized)
probabilities. something like:

probs - t(matrix(rep(1:100),nrow=10)) # matrix with row-wise probabilites
F - t(apply(probs, 1, cumsum)) #SLOOOW!

One (already faster, but for sure not ideal) solution - thanks to Henrik 
Bengtsson:

F - matrix(0, nrow=nrow(probs), ncol=ncol(probs));
F[,1] - probs[,1,drop=TRUE];
for (cc in 2:ncol(F)) {
  F[,cc] - F[,cc-1,drop=TRUE] + probs[,cc,drop=TRUE];
}

In my case, probs is a (30,000 x 10) matrix, and i need to iterate this step 
around
200,000 times, so speed is crucial. I currently can make sure to have no NAs, 
but in
order to extend matrixStats, this could be a nontrivial issue.

Any ideas for speeding up this - probably routine - task?

Thanks in advance,
Gregor

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] filled.contour: colour key decoupled from main plot?

2010-10-12 Thread Panos Hadjinicolaou
I have solved it by modifying the filled.contour function: added another 
parameter (e.g. key.levels) in the argument list (and accordingly in the 
function statements used to plot the legend) to decouple the colour key colour 
bars length from the main plot. 

key.levels is a vector with equally spaced numbers (using the previous example 
code) :

key.levels - c(1:(length(zprcp.colour)+1))

key.axes is set to key.axes = axis(4,at=klevels,labels=tlabels)) 

where tlabels -as.character(zprcp.breaks) in order to draw the user-defined 
labels.



  _  
From: Panos Hadjinicolaou [mailto:p.hadjinicol...@cyi.ac.cy]
To: r-help@r-project.org
Sent: Mon, 11 Oct 2010 17:09:29 +0300
Subject: filled.contour: colour key decoupled from main plot?

Dear R colleagues,

I am trying to plot some geophysical data as a filled contour on a continent 
map and so far the guidance from the R-help archives has been invaluable. The 
only bit that still eludes me is the colour key (legend) coming with 
filled.contour:

I prefer to generate my own colour palette, mainly based on the quantiles of 
tenths of the data in order to capture the whole range (of rainfall for 
example), including the more extreme values both sides. In the colour key this 
results in uneven distribution of the colour bars (and I understood why). Here 
is the code with simplistic data:

xlon - seq(10, 60, len=10) 
ylat - seq(20, 50, len=10) 
prcp - abs(rnorm(length(xlon)*length(ylat)))*1000
zprcp - array(zprcp,c(length(xlon),length(ylat)))

zprcp.colour 
-c(#EDFFD2,#00FFD2,#00F0FF,#00B4FF,#0078FF,#003CFF,#FF,#3C00FF,#7800FF,#B400FF,#FF0096)
zprcp.quants - 
rev(quantile(zprcp,na.rm=T,probs=c(1,0.98,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1)))
zprcp.breaks -c(0,10*ceiling(zprcp.quants/10))

filled.contour(xlon,ylat,zprcp,ylim=c(20,50),xlim=c(10,60), asp=1.0, 
plot.axes=map('worldHires',xlim=c(10,60),ylim=c(20,50), border=0.9, add 
=TRUE),levels=zprcp.breaks,col=zprcp.colour,key.axes = axis(4,zprcp.breaks))

I would like the colour bars to be even (and the labels to represent the actual 
quantile values). 

I tried to modify the key.axes=axis(..) to force an evenly spaced colour key 
(and keeping the same colours) but it seems that this ultimately obeys the 
'levels' and 'col' parameters already defined, which are also used for the main 
image. I have also tried to decouple the 'levels' and 'col' settings between 
the main plot and the legend by fiddling with the filled.contour function but 
without success yet.

I would be grateful for any ideas, ideally based on the basic graphics package.

Thanks,

Panos



---
Dr Panos Hadjinicolaou

Energy Environment Water Research Center (EEWRC)
The Cyprus Institute

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

2010-10-12 Thread Joel

Dont know if it will work but you can try ctree from the party package

require(party)
bla - ctree(Class ~ Outlook + Temp + Humidity + Windy, data=dataframe)

plot(bla)

//Joel
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Rpart-query-tp2991198p2991417.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] can't find and install reshape2??

2010-10-12 Thread Bernardo Rangel Tura
On Mon, 2010-10-04 at 10:27 +0930, Chris Howden wrote:
 Hi everyone,
 
 
 
 Im trying to install reshape2.
 
 
 
 But when I click on install package its not coming up!?!?! Im getting
 reshape, but no reshape2?
 
 
 
 Ive also tried download.packages(reshape2, destdir=c:\\) 
 download.packages(Reshape2, destdir=c:\\)but no luck!!!
 
 
 
 Does anyone have any ideas what could be going on?
 
 
 
 Chris Howden
 

Hi Chris,

I have two guess:

1- You don't have installed 'stringr' pakage
2- Your R is outdated

Try this two things and after this mail me

-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil

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

2010-10-12 Thread Joel

My guess is that you have two few observations is your dataset for rpart to
determin a safe dissision.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Rpart-query-tp2991198p2991461.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] Rpart query

2010-10-12 Thread Joel

Or now Im pretty sure of it as when I took your dataset and used the magic
way of ctrl-c ctrl-v to make some more observations I get a decision tree.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Rpart-query-tp2991198p2991469.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] Read from a website

2010-10-12 Thread Santosh Srinivas
Something similar to this was discussed recently, but I'm unable to find the
thread.

 

I want to read from a site where I need to enter the date into a form before
I am presented with the CSV link. E.g. like reading ticker data from yahoo
(but assuming you HAVE to enter the dates and click on request).

 

How do I simulate this from R?

 

Thanks for the help.

 


[[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] Factors in an regression using lm()

2010-10-12 Thread Gabriel Bergin
Hi,

I am trying to do a multiple regression on the dataset Hdma, available in
the Ecdat package.

The data looks like this:
 str(Hdma)
'data.frame': 2381 obs. of  13 variables:
 $ dir: num  0.221 0.265 0.372 0.32 0.36 ...
 $ hir: num  0.221 0.265 0.248 0.25 0.35 ...
 $ lvr: num  0.8 0.922 0.92 0.86 0.6 ...
 $ ccs: num  5 2 1 1 1 1 1 2 2 2 ...
 $ mcs: num  2 2 2 2 1 1 2 2 2 1 ...
 $ pbcr   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
 $ dmi: Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 2 1 ...
 $ self   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
 $ single : Factor w/ 2 levels no,yes: 1 2 1 1 1 1 2 1 1 2 ...
 $ uria   : num  3.9 3.2 3.2 4.3 3.2 ...
 $ comdominiom: num  0 0 0 0 0 0 1 0 0 0 ...
 $ black  : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
 $ deny   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 2 1 ...

I would like to try a more complex regression, but even this relatively
uncomplicated one returns an error:

summary(lm(deny ~ hir + dir + ccs + mcs + black))

The error I get is:
Error in storage.mode(y) - double :
  invalid to change the storage mode of a factor
In addition: Warning message:
In model.response(mf, numeric) :
  using type=numeric with a factor response will be ignored

I understand that there is something wrong due to the fact that some of the
variables are factors. But as far as I've grasped, it should be possible to
include factor variables when using lm(). Am I in error in thinking this?

Sincerely,
Gabriel Bergin
Undergraduate economics student

[[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] Rpart query

2010-10-12 Thread Achim Zeileis

On Mon, 11 Oct 2010, jagdeesh_mn wrote:



Hi,

Being a novice this is my first usage of R.

I am trying to use rpart for building a decision tree in R. And I have the
following dataframe


Outlook TempHumidityWindy   Class
Sunny   75  70  Yes Play
Sunny   80  90  Yes Don't Play
Sunny   85  85  No  Don't Play
Sunny   72  95  No  Don't Play
Sunny   69  70  No  Play
Overcast72  90  Yes Play
Overcast83  78  No  Play
Overcast64  65  Yes Play
Overcast81  75  No  Play

The first line indicating the header. When I use the formula,

CART-rpart(Class ~ Outlook + Temp + Humidity + Windy, data=dataframe)

and trying to plot the values of CART using plot(CART), I get the following
error,

Error in plot.rpart(CART) : fit is not a tree, just a root.

Am I missing something here? Any help would be greatly appreciated. Btw, the
dataframe was obtained by reading a csv which shouldn't be an issue.


The error message says it all: In this tiny data set rpart() decides that 
it doesn't split the data at all and thus just retains a root and not a 
tree.


If you want to make rpart() split the data, you can modify some of its 
hyperparameters, e.g., the minimum number of observations required to 
attempt a split.


The data above are often used in machine learning textbooks to introduce 
the concept of recursive partitioning. They are also provided in the 
RWeka package. However, many (statistical) recursive partitioning 
algorithms will be default consider the data too small to attempt 
splitting.


## load RWeka and data
library(RWeka)
weather - read.arff(system.file(arff, weather.arff,
  package = RWeka))

## J4.8 tree (Java implementation of C4.5, revision 8)
j48 - J48(play ~ ., data = weather)
j48

## RPart tree (R implementation of CART)
library(rpart)
rp - rpart(play ~ ., data = weather, minsplit = 5)
plot(rp)
text(rp)

## Conditional inference tree
library(party)
ct - ctree(play ~ ., data = weather,
  control = ctree_control(minsplit = 5, mincriterion = 0.3))
plot(ct)

As you see, all trees have different opinions about how the data should be 
split. However, in this tiny data set, nothing could be considered 
statistically significant.


I would recommend to use some larger data set to try to understand how the 
different algorithms work.


hth,
Z


-Jagdeesh


--
View this message in context: 
http://r.789695.n4.nabble.com/Rpart-query-tp2991198p2991198.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] GEE with user-specified link function

2010-10-12 Thread Kun Liu

Hello,

I would like to try to fit a GEE with user-specified link function. 


I read through a couple of thread on the list, for example 
http://tolstoy.newcastle.edu.au/R/help/04/12/9768.html#start and 
http://tolstoy.newcastle.edu.au/R/help/06/04/25298.html. I noticed that they 
are all 6 or more years old and the answer is very clear for GLM, however for 
GEE I am still not sure.

There are two existing package for GEE. One is called gee and anther is called 
geepack. However, in both package, they do not seem to involve the option of 
using user-defined link function. Could anyone help me with this please?

Thanks very much indeed for any help.

Best regards,

Yours Sincerely,


Victor


PhD in Statistics 
The University of Manchester, UK
  
[[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] Factors in an regression using lm()

2010-10-12 Thread ONKELINX, Thierry
The problem is not in the covariates but in the respons variable. lm()
can only handle numerical variables. Deny is a factor, hence you get an
error.

HTH,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie  Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics  Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
thierry.onkel...@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
  

 -Oorspronkelijk bericht-
 Van: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] Namens Gabriel Bergin
 Verzonden: dinsdag 12 oktober 2010 11:39
 Aan: r-help@r-project.org
 Onderwerp: [R] Factors in an regression using lm()
 
 Hi,
 
 I am trying to do a multiple regression on the dataset 
 Hdma, available in the Ecdat package.
 
 The data looks like this:
  str(Hdma)
 'data.frame': 2381 obs. of  13 variables:
  $ dir: num  0.221 0.265 0.372 0.32 0.36 ...
  $ hir: num  0.221 0.265 0.248 0.25 0.35 ...
  $ lvr: num  0.8 0.922 0.92 0.86 0.6 ...
  $ ccs: num  5 2 1 1 1 1 1 2 2 2 ...
  $ mcs: num  2 2 2 2 1 1 2 2 2 1 ...
  $ pbcr   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
  $ dmi: Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 2 1 ...
  $ self   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
  $ single : Factor w/ 2 levels no,yes: 1 2 1 1 1 1 2 1 1 2 ...
  $ uria   : num  3.9 3.2 3.2 4.3 3.2 ...
  $ comdominiom: num  0 0 0 0 0 0 1 0 0 0 ...
  $ black  : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
  $ deny   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 2 1 ...
 
 I would like to try a more complex regression, but even this 
 relatively uncomplicated one returns an error:
 
 summary(lm(deny ~ hir + dir + ccs + mcs + black))
 
 The error I get is:
 Error in storage.mode(y) - double :
   invalid to change the storage mode of a factor In addition: 
 Warning message:
 In model.response(mf, numeric) :
   using type=numeric with a factor response will be ignored
 
 I understand that there is something wrong due to the fact 
 that some of the variables are factors. But as far as I've 
 grasped, it should be possible to include factor variables 
 when using lm(). Am I in error in thinking this?
 
 Sincerely,
 Gabriel Bergin
 Undergraduate economics student
 
   [[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] Factors in an regression using lm()

2010-10-12 Thread Ivan Calandra

 Hi,

Your response (dependent) variable, which has to be on the left side of 
the '~' in the formula, should be numeric. In your example deny is a 
factor; first problem
The explaining variables, on the right side of the '~', should be 
factors. Here, hir, dir, css and mcs are numeric; second problem. Only 
black is a factor.


There are two possibilities (not mutually exclusive):
- you should transform your factors into numeric and vice-versa as 
needed, see ?factor and ?as.numeric, as well as StringAsFactor argument 
from ?read.table (I guess you imported your data.frame that way)
- you should adjust your model formula. It might be that you mixed up 
the variables in the formula. See ?formula


HTH,
Ivan

Le 10/12/2010 11:39, Gabriel Bergin a écrit :

Hi,

I am trying to do a multiple regression on the dataset Hdma, available in
the Ecdat package.

The data looks like this:

str(Hdma)

'data.frame': 2381 obs. of  13 variables:
  $ dir: num  0.221 0.265 0.372 0.32 0.36 ...
  $ hir: num  0.221 0.265 0.248 0.25 0.35 ...
  $ lvr: num  0.8 0.922 0.92 0.86 0.6 ...
  $ ccs: num  5 2 1 1 1 1 1 2 2 2 ...
  $ mcs: num  2 2 2 2 1 1 2 2 2 1 ...
  $ pbcr   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
  $ dmi: Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 2 1 ...
  $ self   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
  $ single : Factor w/ 2 levels no,yes: 1 2 1 1 1 1 2 1 1 2 ...
  $ uria   : num  3.9 3.2 3.2 4.3 3.2 ...
  $ comdominiom: num  0 0 0 0 0 0 1 0 0 0 ...
  $ black  : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
  $ deny   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 2 1 ...

I would like to try a more complex regression, but even this relatively
uncomplicated one returns an error:

summary(lm(deny ~ hir + dir + ccs + mcs + black))

The error I get is:
Error in storage.mode(y)- double :
   invalid to change the storage mode of a factor
In addition: Warning message:
In model.response(mf, numeric) :
   using type=numeric with a factor response will be ignored

I understand that there is something wrong due to the fact that some of the
variables are factors. But as far as I've grasped, it should be possible to
include factor variables when using lm(). Am I in error in thinking this?

Sincerely,
Gabriel Bergin
Undergraduate economics student

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



--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php

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

2010-10-12 Thread Łukasz Ręcławowicz
Hi,

I don't know how to sample such data, it can't be done by row sampling
as default method on matrix in boot.
Function  takes matrix and returns single coefficient.

#There is a macro but I want use R :)
http://www.comm.ohio-state.edu/ahayes/SPSS%20programs/kalphav2_1.SPS
library(concord)
library(boot)
# The data are rates among observers with NA's
nmm-matrix(c(1,1,NA,1,2,2,3,2,3,3,3,3,3,3,3,3,2,2,2,2,1,2,3,4,4,4,4,4,
+  1,1,2,1,2,2,2,2,NA,5,5,5,NA,NA,1,1,NA,NA,3,NA),nrow=4)

sample.rates-function(matrix.data,i){
#mixed.rates-sample individual rates and put back in new matrix (?)
return(kripp.alpha(mixed.rates)$statistic[i])
}
to.get-boot(nmm, sample.rates, R=1e4, stype=i)

-- 
Miłego dnia

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Factors in an regression using lm()

2010-10-12 Thread Ivan Calandra

 Oops, my bad.
I rarely do regression, so I forgot that in your case the explaining 
variables do not have to be factors.

The rest stands.
Ivan

Le 10/12/2010 11:56, Ivan Calandra a écrit :

 Hi,

Your response (dependent) variable, which has to be on the left side 
of the '~' in the formula, should be numeric. In your example deny is 
a factor; first problem
The explaining variables, on the right side of the '~', should be 
factors. Here, hir, dir, css and mcs are numeric; second problem. Only 
black is a factor.


There are two possibilities (not mutually exclusive):
- you should transform your factors into numeric and vice-versa as 
needed, see ?factor and ?as.numeric, as well as StringAsFactor 
argument from ?read.table (I guess you imported your data.frame that way)
- you should adjust your model formula. It might be that you mixed up 
the variables in the formula. See ?formula


HTH,
Ivan

Le 10/12/2010 11:39, Gabriel Bergin a écrit :

Hi,

I am trying to do a multiple regression on the dataset Hdma, 
available in

the Ecdat package.

The data looks like this:

str(Hdma)

'data.frame': 2381 obs. of  13 variables:
  $ dir: num  0.221 0.265 0.372 0.32 0.36 ...
  $ hir: num  0.221 0.265 0.248 0.25 0.35 ...
  $ lvr: num  0.8 0.922 0.92 0.86 0.6 ...
  $ ccs: num  5 2 1 1 1 1 1 2 2 2 ...
  $ mcs: num  2 2 2 2 1 1 2 2 2 1 ...
  $ pbcr   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
  $ dmi: Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 2 1 ...
  $ self   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
  $ single : Factor w/ 2 levels no,yes: 1 2 1 1 1 1 2 1 1 2 ...
  $ uria   : num  3.9 3.2 3.2 4.3 3.2 ...
  $ comdominiom: num  0 0 0 0 0 0 1 0 0 0 ...
  $ black  : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 1 1 ...
  $ deny   : Factor w/ 2 levels no,yes: 1 1 1 1 1 1 1 1 2 1 ...

I would like to try a more complex regression, but even this relatively
uncomplicated one returns an error:

summary(lm(deny ~ hir + dir + ccs + mcs + black))

The error I get is:
Error in storage.mode(y)- double :
   invalid to change the storage mode of a factor
In addition: Warning message:
In model.response(mf, numeric) :
   using type=numeric with a factor response will be ignored

I understand that there is something wrong due to the fact that some 
of the
variables are factors. But as far as I've grasped, it should be 
possible to
include factor variables when using lm(). Am I in error in thinking 
this?


Sincerely,
Gabriel Bergin
Undergraduate economics student

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





--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php

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

2010-10-12 Thread Rubén Roa
Hi,

Probably Windows cann't allocate enough contiguous free space.
Try this:
Find boot.ini (usually at the root c:\)
Without changing anything else, add this line at the end of the script:
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=Microsoft Windows XP Professional 
3GB /3GB /noexecute=optin /fastdetect
Reboot.
When prompted select the 3GB boot-up. Performance will decay but bigger objects 
could be saved to disk.
Hope that this will be enough to get you code working.
When finished re-boot and start with the normal boot-up.
An example of a boot.ini script that I had to prepare for one big simulation 
work in an XP machine is at the end of my message.

HTH

Rubén

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=Microsoft Windows XP Professional 
/noexecute=optin /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=Microsoft Windows XP Professional 
3GB /3GB /noexecute=optin /fastdetect


-Original Message-
From: r-help-boun...@r-project.org on behalf of Tim Clark
Sent: Tue 10/12/2010 5:49 AM
To: r help r-help
Cc: Tim Clark
Subject: [R] Memory limit problem
 
Dear List,

I am trying to plot bathymetry contours around the Hawaiian Islands using the 
package rgdal and PBSmapping.  I have run into a memory limit when trying to 
combine two fairly small objects using cbind().  I have increased the memory to 
4GB, but am being told I can't allocate a vector of size 240 Kb.  I am running 
R 
2.11.1 on a Dell Optiplex 760 with Windows XP.  I have pasted the error message 
and summaries of the objects below.  Thanks for your help.  Tim


 xyz-cbind(hi.to.utm,z=b.depth$z)
Error: cannot allocate vector of size 240 Kb

 memory.limit()
[1] 4000
 memory.size()
[1] 1971.68

 summary(hi.to.utm)
Object of class SpatialPoints
Coordinates:
    min   max
x  708745.5  923406.7
y 2046153.1 2327910.9
Is projected: TRUE 
proj4string :
[+proj=utm +zone=4 +datum=NAD83 +ellps=GRS80 +towgs84=0,0,0]
Number of points: 15328

 str(hi.to.utm)
Formal class 'SpatialPoints' [package sp] with 3 slots
  ..@ coords : num [1:15328, 1:2] 708746 710482 712218 713944 715681 ...
  .. ..- attr(*, dimnames)=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] x y
  ..@ bbox   : num [1:2, 1:2] 708746 2046153 923407 2327911
  .. ..- attr(*, dimnames)=List of 2
  .. .. ..$ : chr [1:2] x y
  .. .. ..$ : chr [1:2] min max
  ..@ proj4string:Formal class 'CRS' [package sp] with 1 slots
  .. .. ..@ projargs: chr  +proj=utm +zone=4 +datum=NAD83 +ellps=GRS80 
+towgs84=0,0,0


 summary(b.depth)
   x    y   z    
 Min.   :-157.0   Min.   :18.50   Min.   :-5783  
 1st Qu.:-156.6   1st Qu.:18.98   1st Qu.:-4565  
 Median :-156.1   Median :19.80   Median :-3358  
 Mean   :-156.1   Mean   :19.73   Mean   :-3012  
 3rd Qu.:-155.5   3rd Qu.:20.41   3rd Qu.:-1601  
 Max.   :-155.0   Max.   :21.00   Max.   :    0  

 str(b.depth)
'data.frame':   15328 obs. of  3 variables:
 $ x: num  -157 -157 -157 -157 -157 ...
 $ y: num  21 21 21 21 21 ...
 $ z: num  -110 -114 -110 -88 -76 -122 -196 -224 -240 -238 ...

 

Tim Clark
Marine Ecologist
National Park of American Samoa





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

2010-10-12 Thread Raji

A book/online link with an example for all the parameters that are used in
nnet would help in understanding the package better.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/nnet-support-tp840467p2991572.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] GEE with user-specified link function

2010-10-12 Thread Søren Højsgaard
For geepack there are no facilities for user defined link functions.
Regards
Søren


Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org] P#229; vegne 
af Kun Liu [victo...@hotmail.co.uk]
Sendt: 12. oktober 2010 11:50
Til: r-help@r-project.org
Emne: [R] GEE with user-specified link function

Hello,

I would like to try to fit a GEE with user-specified link function.


I read through a couple of thread on the list, for example 
http://tolstoy.newcastle.edu.au/R/help/04/12/9768.html#start and 
http://tolstoy.newcastle.edu.au/R/help/06/04/25298.html. I noticed that they 
are all 6 or more years old and the answer is very clear for GLM, however for 
GEE I am still not sure.

There are two existing package for GEE. One is called gee and anther is called 
geepack. However, in both package, they do not seem to involve the option of 
using user-defined link function. Could anyone help me with this please?

Thanks very much indeed for any help.

Best regards,

Yours Sincerely,


Victor


PhD in Statistics
The University of Manchester, UK

[[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 in nnet

2010-10-12 Thread Raji

Hi R_helpers, i am learning neural networks and trying out using the nnet
package in R. R has other packages like AMORE,Qrnn,nnet and monmlp. Can you
suggest which package is the most used ?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/help-in-nnet-tp2991615p2991615.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] R Profiling

2010-10-12 Thread Lorenzo Isella

Dear All,
I need to do some very basic R profiling, something along the lines of: 
run this whole script five times and return the average completion time.
I do not want (at this stage) delve into the details of the percentage 
of the time spent in which function and doing what.

Which tools should I use?
Any recommendation is welcome.
Best Regards

Lorenzo

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] non-numerical values as input using nnet

2010-10-12 Thread Raji

Hi R-helpers , am trying out nnet package in R. Does nnet package work only
for numerical values as inputs? Can somebody give an insight on how
categorical values as inputs are handled using nnet in r with an example?
Thanks in advance for your help.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/non-numerical-values-as-input-using-nnet-tp2991623p2991623.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] Nonlinear Regression Parameter Shared Across Multiple Data Sets

2010-10-12 Thread Keith Jewell

Jared Blashka evilamaran...@gmail.com wrote in message 
news:aanlktinffmudugqnkudvr=fmf0wrrtsbjxjexuki_...@mail.gmail.com...
 I'm working with 3 different data sets and applying this non-linear
 regression formula to each of them.

 nls(Y ~ (upper)/(1+10^(X-LOGEC50)), data=std_no_outliers,
 start=list(upper=max(std_no_outliers$Y),LOGEC50=-8.5))

 Previously, all of the regressions were calculated in Prism, but I'd like 
 to
 be able to automate the calculation process in a script, which is why I'm
 trying to move to R. The issue I'm running into is that previously, in
 Prism, I was able to calculate a shared value for a constraint so that all
 three data sets shared the same value, but have other constraints 
 calculated
 separately. So Prism would figure out what single value for the constraint
 in question would work best across all three data sets. For my formula, 
 each
 data set needs it's own LOGEC50 value, but the upper value should be the
 same across the 3 sets. Is there a way to do this within R, or with a
 package I'm not aware of, or will I need to write my own nls function to
 work with multiple data sets, because I've got no idea where to start with
 that.

 Thanks,
 Jared

 [[alternative HTML version deleted]]

An approach which works for me (code below to illustrate principle, not 
tried...)

1) combine all three data sets into one dataframe with a column (e.g. 
dset) indicating data set (1, 2 or 3)

2) express your formula with upper as single valued and LOGEC50 as a vector 
inderxed by dest e.g.
 Y ~ upper/(1+10^(C-LOGEC50[dset]))

3) in the start list, make LOGEC50 a vector e.g. using -8.5 as start for all 
three LOGEC50 values
   start = 
list(start=list(upper=max(std_no_outliers$Y),LOGEC50=c(-8.5, -8.5, -8.5))

Hope that helps,

Keith J

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] non-numerical values as input using nnet

2010-10-12 Thread Łukasz Ręcławowicz
Response can be (?multinom) factor (?as.factor), while predictors
(don't know, but i think not) can be turned into numbers via varius
distance measures.
-- 
Miłego dnia

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] delta AIC for models with 2 variables using MuMIn

2010-10-12 Thread elaine kuo
Dear List,

I want to ask a AIC question based on package library(MuMIn)

The relative importance of 16 explanatory variables

are assessed using delta AIC in a generalized linear model.


Please kindly advise if it is possible to show models

with any two only certain variables.

Thank you.


Elaine

I asked a similar question and got a great help for models

with only one variable as below.

~~

In effect, you want

data(Cement)
lm1 - lm(y ~ ., data = Cement)
dd - dredge(lm1, subset = X1)

want - with(dd, is.na(X)  is.na(X2)  is.na(X3)  is.na(X4))
want
## how many models selected?
sum(want)
## OK selected just 1, show it
dd[want, , drop = FALSE]

Oh, actually, I suppose you could automate this, so it will return all
models with single variable:

dd - dredge(lm1)
parms - !is.na(dd[, -c(1, (ncol(dd) - c(0:7)))])
want - which(rowSums(parms) == 1)
dd[want, ]

Having said all this, I don't think this is a good way to do model
selection.

G

[[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] nnet support

2010-10-12 Thread Uwe Ligges



On 12.10.2010 12:24, Raji wrote:


A book/online link with an example for all the parameters that are used in
nnet would help in understanding the package better.


What about starting with the references given in the nnet help, both 
written by the author of the package?


Ripley, B. D. (1996) Pattern Recognition and Neural Networks. Cambridge.

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with 
S. Fourth edition. Springer.



Uwe Ligges

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

2010-10-12 Thread Uwe Ligges



On 12.10.2010 12:53, Raji wrote:


Hi R_helpers, i am learning neural networks and trying out using the nnet
package in R. R has other packages like AMORE,Qrnn,nnet and monmlp. Can you
suggest which package is the most used ?


The real question is which one is more appropriate for the tasks your 
are trying to tackle. But we do not know the latter.


Uwe Ligges

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


Re: [R] running R script on linux server

2010-10-12 Thread Uwe Ligges



On 12.10.2010 00:55, Lorenzo Cattarino wrote:

Hi R-users,



I have a problem running my R code on a Linux cluster. What I did was
write a .pbs file to instruct the cluster on what to do and how:



#!/bin/sh



#PBS -m ae

#PBS -M uqlca...@uq.edu.au

#PBS -A uq-CSER

#PBS -N job1_lollo

#PBS -l select=1:ncpus=1:NodeType=fast:mem=8GB

#PBS -l walltime=999:00:00





cd $PBS_O_WORKDIR



source /usr/share/modules/init/bash



module load R/2.11.1



/home/uqlcatta/script/diag.sh



The .pbs file calls a .sh file, which is located on my home directory on
the cluster, and which contains the R script (enclosed in  ) to run



#!/bin/bash



echo  mat- matrix(1:12,nrow=3,ncol=4)



diagonal- diag(mat)



write.csv(diagonal, file = diagonal.csv)



  R_tmp



echo 'source(R_tmp)' | R --vanilla --slave

rm R_tmp



However the cluster sends back to me an error message saying:



Error in write.table(diagonal, file = diagonal.csv, col.names = NA, sep
= ,,  :

   object 'diagonal.csv' not found

Calls: source ... write.csv -  eval.parent -  eval -  eval -
write.table

Execution halted



The write.csv command worked on the R consol on my computer, so I don't
know what is the problem here.



You use double quotes inside double quotes. You either have to escape 
them or use single quotes (if the shell permits the distinction).


Uwe Ligges




Thanks in advance for your help



Lorenzo


[[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] non-numerical values as input using nnet

2010-10-12 Thread Raji

Thanks Łukasz.My dataset has 5 columns in which first 3 are numerical , the
4th is a name and 5th is a number(sales).I am trying to use nnet to predict
the sales based on the other 4 parameters.The nnet takes each name value as
an input. How does nnet take the name value as?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/non-numerical-values-as-input-using-nnet-tp2991623p2991682.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] random number; was: Question

2010-10-12 Thread Uwe Ligges
If this is about (pseudo) random number generation (yes, please use a 
sensible subject line). See ?set.seed, ?runif, ?rnorm to get started.


Uwe Ligges

On 11.10.2010 19:32, Margaretta 2014 wrote:

Hello.
I would be very grateful if you could help me in using R.
I need R commands of pseudo random value and qvazi (quazi) random value.
I found commands qnorm and pnorm, but I am not sure that this is the
same as I am looking for.
Looking forward to hearing from you. Thank you
Margaret

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

2010-10-12 Thread Raji

The references have enough information about the package. But, understanding
each parameter of nnet would be easier if there is an example for its
usage.For example , how to give contrasts, an example with linear  outputs
etc.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/nnet-support-tp840467p2991691.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] Rpart query

2010-10-12 Thread jagdeesh_mn

@Above,
Thanks. That certainly helps.

I understand that the rpart splits only in binary. Is there any support in R
to make the split have more than 2 nodes?

Cheers,
Jagdeesh
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Rpart-query-tp2991198p2991643.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] Rpart query

2010-10-12 Thread jagdeesh_mn

Here is the complete dataset:


Outlook TempHumidityWindy   Class
Sunny   2   2   Yes Play
Sunny   2   1   Yes Don't Play
Sunny   3   1   No  Don't Play
Sunny   2   1   No  Don't Play
Sunny   1   2   No  Play
Overcast2   1   Yes Play
Overcast3   1   No  Play
Overcast1   2   Yes Play
Overcast3   2   No  Play
Rain2   1   Yes Don't Play
Rain1   2   Yes Don't Play
Rain2   1   No  Play
Rain1   1   No  Play
Rain1   1   No  Play

And manually I was indeed able to generate a decision tree out of it. I also
used couple of other tools to generate a valid decision tree out of it. But
I am unable to generate through R.

Or now Im pretty sure of it as when I took your dataset and used the magic
way of ctrl-c ctrl-v to make some more observations I get a decision tree.
- Pardon me, but, I couldn't decipher what you were trying to tell through
this line. Could you elaborate on this?

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Rpart-query-tp2991198p2991483.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] help in nnet

2010-10-12 Thread Raji

Sorry.The neural networks would be used for classification, regression mostly
with both numerical and non-numerical inputs.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/help-using-neural-networks-in-R-tp2991615p2991701.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] merging and working with big data sets

2010-10-12 Thread Jay Emerson
I can't speak for ff and filehash, but bigmemory's data structure
doesn't allow clever merges (for actually good reasons).  However,
it is still probably less painful (and faster) than other options,
though we don't implement it: we leave it to the user because details
may vary depending on the example and the code is trivial.

- Allocate an empty new filebacked big.matrix of the proper size.
- Fill it in chunks (typically a column at a time if you can afford
the RAM overhead, or a portion of a column at a time).   Column
operations are more efficient than row operations (again, because of
the internals of the data structure).
- Because you'll be using filebackings, RAM limitations won't matter
other than the overhead of copying each chunk.

I should note: if you used separated=TRUE, each column would have a
separate binary file, and a smart cbind() would be possible simply
by manipulating the descriptor file.  Again, not something we advise
or formally provide, but it wouldn't be hard.

Jay

-- 
John W. Emerson (Jay)
Associate Professor of Statistics
Department of Statistics
Yale University
http://www.stat.yale.edu/~jay

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

2010-10-12 Thread David Winsemius


On Oct 12, 2010, at 7:04 AM, Lorenzo Isella wrote:


Dear All,
I need to do some very basic R profiling, something along the lines  
of: run this whole script five times and return the average  
completion time.
I do not want (at this stage) delve into the details of the  
percentage of the time spent in which function and doing what.

Which tools should I use?


There are 3 packages (compliled for my version anyway) on CRAN whose  
titles contain benchmark. I have experience using the rbenchmark  
package which has a very simple syntax and would definitely meet your  
minimal requirements. From reading postings on r-devel but no direct  
experience, I suspect the benchmark package may be more full-featured.


--
David.

Any recommendation is welcome.
Best Regards

Lorenzo




David Winsemius, MD
West Hartford, CT

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


Re: [R] R Profiling

2010-10-12 Thread jim holtman
You can use 'system.time' to determine the elapsed and CPU time used.
Here is an example of repeating a script 10 times:

 replicate(10, system.time({
+ for (i in 1:1) x  runif(1)
+ }))
   [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
user.self  0.09 0.06 0.07 0.06 0.08 0.07 0.06 0.06 0.06  0.06
sys.self   0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00  0.00
elapsed0.09 0.06 0.06 0.06 0.08 0.06 0.06 0.07 0.06  0.06
user.child   NA   NA   NA   NA   NA   NA   NA   NA   NANA
sys.childNA   NA   NA   NA   NA   NA   NA   NA   NANA

 timingResult - replicate(10, system.time({
+ # this would be where your script goes
+ for (i in 1:10) x  runif(1)
+ }))

 timingResult
   [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
user.self  0.67 0.68 0.67 0.69 0.67 0.69 0.66 0.69 0.68  0.66
sys.self   0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00  0.00
elapsed0.67 0.67 0.67 0.69 0.67 0.69 0.65 0.69 0.71  0.67
user.child   NA   NA   NA   NA   NA   NA   NA   NA   NANA
sys.childNA   NA   NA   NA   NA   NA   NA   NA   NANA


On Tue, Oct 12, 2010 at 7:04 AM, Lorenzo Isella
lorenzo.ise...@gmail.com wrote:
 Dear All,
 I need to do some very basic R profiling, something along the lines of: run
 this whole script five times and return the average completion time.
 I do not want (at this stage) delve into the details of the percentage of
 the time spent in which function and doing what.
 Which tools should I use?
 Any recommendation is welcome.
 Best Regards

 Lorenzo

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


[R] graphics layout

2010-10-12 Thread Murali.Menon
Folks,

I'm battling the layout() functionality in graphics, and getting a bit mixed 
up. I'd like to create subscreens like so:

 _ _
| | |
|1|2|
|_| |
| | |
|3|4|
|_|_|
| |6|
|5|7|
|_|8|


Note that subscreens 1:5 are the same size, and 6,7,8 are the same width as, 
say, 1, but of one-third the height.

How to achieve this? 

Thanks,

Murali

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] delta AIC for models with 2 variables using MuMIn

2010-10-12 Thread Gavin Simpson
On Tue, 2010-10-12 at 19:37 +0800, elaine kuo wrote:
 Dear List,
 
 I want to ask a AIC question based on package library(MuMIn)
 
 The relative importance of 16 explanatory variables
 
 are assessed using delta AIC in a generalized linear model.
 
 
 Please kindly advise if it is possible to show models

Using the below example you quote:

dd - dredge(lm1, subset = X1  X2)

 
 with any two only certain variables.

If you are now going to ask how can I select only those models with two
variables in, this:

dd - dredge(lm1)
parms - !is.na(dd[, -c(1, (ncol(dd) - c(0:7)))])
want - which(rowSums(parms) == 2)
dd[want, ]

will do it, again using the example you quote.

HTH

G

 Thank you.
 
 
 Elaine
 
 I asked a similar question and got a great help for models
 
 with only one variable as below.
 
 ~~
 
 In effect, you want
 
 data(Cement)
 lm1 - lm(y ~ ., data = Cement)
 dd - dredge(lm1, subset = X1)
 
 want - with(dd, is.na(X)  is.na(X2)  is.na(X3)  is.na(X4))
 want
 ## how many models selected?
 sum(want)
 ## OK selected just 1, show it
 dd[want, , drop = FALSE]
 
 Oh, actually, I suppose you could automate this, so it will return all
 models with single variable:
 
 dd - dredge(lm1)
 parms - !is.na(dd[, -c(1, (ncol(dd) - c(0:7)))])
 want - which(rowSums(parms) == 1)
 dd[want, ]
 
 Having said all this, I don't think this is a good way to do model
 selection.
 
 G
 
   [[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.

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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

2010-10-12 Thread Eik Vettorazzi
Hi Murali
try

nf - layout(matrix(c(1:5,6,5,7,5,8), ncol=2, byrow=TRUE),
heights=c(1,1,rep(1/3,3)),respect=TRUE)
layout.show(nf)

hth.

Am 12.10.2010 14:19, schrieb murali.me...@avivainvestors.com:
 Folks,
 
 I'm battling the layout() functionality in graphics, and getting a bit mixed 
 up. I'd like to create subscreens like so:
 
  _ _
 | | |
 |1|2|
 |_| |
 | | |
 |3|4|
 |_|_|
 | |6|
 |5|7|
 |_|8|
 
 
 Note that subscreens 1:5 are the same size, and 6,7,8 are the same width as, 
 say, 1, but of one-third the height.
 
 How to achieve this? 
 
 Thanks,
 
 Murali
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790

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

2010-10-12 Thread Murali.Menon
Hiya,

Thanks for this. It's the height parameters that baffle me. Why are they 1, 1, 
1/3, 1/3, 1/3?
Which subscreens do these heights correspond to?

I did it like this: 

nf - layout(cbind(c(1,1,1,3,3,3,5,5,5),c(2,2,2,4,4,4,6,7,8)))

mainly because I'm not clear about how the heights work.

Thanks,
Murali

-Original Message-
From: Eik Vettorazzi [mailto:e.vettora...@uke.uni-hamburg.de] 
Sent: 12 October 2010 13:43
To: Menon Murali
Cc: r-help@r-project.org
Subject: Re: [R] graphics layout

Hi Murali
try

nf - layout(matrix(c(1:5,6,5,7,5,8), ncol=2, byrow=TRUE),
heights=c(1,1,rep(1/3,3)),respect=TRUE)
layout.show(nf)

hth.

Am 12.10.2010 14:19, schrieb murali.me...@avivainvestors.com:
 Folks,
 
 I'm battling the layout() functionality in graphics, and getting a bit mixed 
 up. I'd like to create subscreens like so:
 
  _ _
 | | |
 |1|2|
 |_| |
 | | |
 |3|4|
 |_|_|
 | |6|
 |5|7|
 |_|8|
 
 
 Note that subscreens 1:5 are the same size, and 6,7,8 are the same width as, 
 say, 1, but of one-third the height.
 
 How to achieve this? 
 
 Thanks,
 
 Murali
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] GLM Gamma Regression error message in R

2010-10-12 Thread David Winsemius


On Oct 12, 2010, at 3:51 AM, Stratos Laskarides wrote:


Dear Madam/Sir

This may be quite a long shot...

By way of intro, I am a masters student in actuarial science at the
University of Cape Town, and I am doing a project in R on some  
healthcare
cost data. During my coding in R I encountered an error message,  
which I

then googled, but I am still unable to resolve the issue.

I would like to please ask if and how it is possible to resolve the  
problem
raised by the error message Error: NA/NaN/Inf in foreign function  
call (arg
1) In addition: Warning message: *step size truncated due to  
divergence *in

R?

As for some background on my specific data and research problem at  
hand, I
am fitting a gamma regression model to 13 000 lines of insurance  
claims
data, which will be regressed against categorical variables such as  
Age

Band, Gender, and Region.

Perhaps my problem arises because the data set is too large and the
iteratively reweighted least squares algorithm therefore cannot  
converge, in

which case I perhaps need another GLM type. Or maybe the categorical
explanatory variables can take on too many values (e.g. there are 15  
Age

Bands, 5 Regions).

Any insights you could provide would be much appreciated.


You are asking the right questions. Most probably some particular  
stratum of categorical variables has  a small number of informative  
events or is pathologically distributed (from the perspective of your  
model structure). This is especially likely when you enter interaction  
terms. Tabular investigation may disclose a suspect and point to way  
to nail down the culprit.


What are the descriptive stats on your outcome variable stratified by  
age and region?


One option that immediately presents itself is modeling age as a  
continuous variable with a spline representation. I have quite a bit  
of experience working with actuaries and I do know the dominant  
analytic strategy is cutting data into discrete categories. However,  
this is a pretty small dataset and you should be prepared to argue in  
favor of the more powerful strategy of keeping continuous variables  
continuous.


Another issue: how you are handling the often statistically  
pathological zero claims that almost always occur in healthcare claims  
data? What does density(plot(claims)) look like? A gamma model is  
going have real difficulty with the typical sort of health claims  
distribution. Are you prepared to model using zero-inflated or zero- 
adjusted models?



--
David.



Thank you ever so much.

Kind regards
Stratos Laskarides
South Africa

--

David Winsemius, MD
West Hartford, CT

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


Re: [R] graphics layout

2010-10-12 Thread Ben Bolker
 Murali.Menon at avivainvestors.com writes:

 Thanks for this. It's the height parameters that baffle me. 
 Why are they 1, 1, 1/3, 1/3, 1/3?
 Which subscreens do these heights correspond to?


  They are relative heights.  The top two vertical layers 
are equal heights, and the bottom three vertical layers on the right
are each 1/3 the height of the top layers.

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

2010-10-12 Thread Vittorio Colagrande
Dear R-group,

We have begun to use it for teaching Statistics. In this context we have run 
into a problem with linear regression

where we found the results of are confusing.

Specifically, considering the data:

 

x=c(4,5,6,3,7,8,10,14,13,15,6,7,8,10,11,4,5,17,12,11)

y=c(rep(7,20))

 

and settings

 

regress=lm(y~x)

 

summary(regress) gives the following results:

 

 Estimate Std. Errort value Pr(|t|)

(Intercept)  7.000e+00  8.623e-17  8.118e+16   2e-16 ***

x   -1.116e-17  8.956e-18 -1.247e+000.229

---

Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

 

Residual standard error: 1.565e-16 on 18 degrees of freedom

Multiple R-squared: 0.6416, Adjusted R-squared: 0.6217 

 

Other statistical packages respond that the analysis can not be done. We think 
that the results of R-squared  

does not seem to express the variability of y explained by x. We would greatly 
appreciate any clarification you 

could provide.



Thanks you and best regards.

Marta di Nicola e Colagrande Vittorio
[[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] Linear Regression

2010-10-12 Thread ONKELINX, Thierry
Dear Vittorio,

Notice that anova(regress) gives a warning: ANOVA F-tests on an
essentially perfect fit are unreliable

Maybe summary(regress) should give a similar warning in case of a
perfect fit. Allthough you should notice that the residual standard
error displayed by summary() is extremly small. Which indicates that
something might be wrong.

HTH,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie  Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics  Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
thierry.onkel...@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
  

 -Oorspronkelijk bericht-
 Van: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] Namens Vittorio Colagrande
 Verzonden: dinsdag 12 oktober 2010 15:01
 Aan: r-help@r-project.org
 Onderwerp: [R] Linear Regression
 
 Dear R-group,
 
 We have begun to use it for teaching Statistics. In this 
 context we have run into a problem with linear regression
 
 where we found the results of are confusing.
 
 Specifically, considering the data:
 
  
 
 x=c(4,5,6,3,7,8,10,14,13,15,6,7,8,10,11,4,5,17,12,11)
 
 y=c(rep(7,20))
 
  
 
 and settings
 
  
 
 regress=lm(y~x)
 
  
 
 summary(regress) gives the following results:
 
  
 
  Estimate Std. Errort value Pr(|t|)
 
 (Intercept)  7.000e+00  8.623e-17  8.118e+16   2e-16 ***
 
 x   -1.116e-17  8.956e-18 -1.247e+000.229
 
 ---
 
 Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
 
  
 
 Residual standard error: 1.565e-16 on 18 degrees of freedom
 
 Multiple R-squared: 0.6416, Adjusted R-squared: 0.6217 
 
  
 
 Other statistical packages respond that the analysis can not 
 be done. We think that the results of R-squared  
 
 does not seem to express the variability of y explained by x. 
 We would greatly appreciate any clarification you 
 
 could provide.
 
 
 
 Thanks you and best regards.
 
 Marta di Nicola e Colagrande Vittorio
   [[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] Data conversion from class asc to class kasc (Adehabitat)

2010-10-12 Thread Neba Funwi-Gabga
Hello list,
I am trying to do an Ecological Niche Factor Analysis using the adehabitat
package, but I am facing problems with preparing my covariates for input.
The covariates are of class asc and i need to get them to class kasc
using the as.kasc function. But when I try to create the list, I get an
error message
saying all the objects should have the same attributes.

This is the code I am using to create the kasc object:

 covariates - as.kasc(list(dem=import.asc(elevation.asc),
slope=import.asc(slope.asc),
slope.position=import.asc(slope_position.asc),
+ water=import.asc(water_distance.asc),
vegetation=import.asc(vegetation.asc)))

Please any help on this?

-- 
Neba, Funwi-Gabga
MSc student in Geosp. Tech.

[[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] Linear Regression

2010-10-12 Thread David Winsemius


On Oct 12, 2010, at 9:01 AM, Vittorio Colagrande wrote:


Dear R-group,

We have begun to use it for teaching Statistics. In this context we  
have run into a problem with linear regression


where we found the results of are confusing.

Specifically, considering the data:

x=c(4,5,6,3,7,8,10,14,13,15,6,7,8,10,11,4,5,17,12,11)
y=c(rep(7,20))
#and settings
regress=lm(y~x)
summary(regress) gives the following results:

Estimate Std. Errort value Pr(|t|)
(Intercept)  7.000e+00  8.623e-17  8.118e+16   2e-16 ***
x   -1.116e-17  8.956e-18 -1.247e+000.229
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.565e-16 on 18 degrees of freedom
Multiple R-squared: 0.6416, Adjusted R-squared: 0.6217



Other statistical packages respond that the analysis can not be  
done. We think that the results of R-squared  does not seem to  
express the variability of y explained by x. We would greatly  
appreciate any clarification you could provide.


It is expressing the degree to which the estimate of the intercept  
explains the tendency of the data to be away from the null  
hypothesis of y=0. Consider what you get from two (equivalent to each  
other) lm calls:


 regress2=lm( I(y-7)~x )
 summary(regress2)

Call:
lm(formula = I(y - 7) ~ x)

Residuals:
   Min 1Q Median 3QMax
 0  0  0  0  0

Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept)0  0  NA   NA
x  0  0  NA   NA

Residual standard error: 0 on 18 degrees of freedom
Multiple R-squared:   NaN,  Adjusted R-squared:   NaN
F-statistic:   NaN on 1 and 18 DF,  p-value: NA

 y2=y-7
 regress2=lm( y2~x )
 summary(regress2)

Call:
lm(formula = y2 ~ x)

Residuals:
   Min 1Q Median 3QMax
 0  0  0  0  0

Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept)0  0  NA   NA
x  0  0  NA   NA

Residual standard error: 0 on 18 degrees of freedom
Multiple R-squared:   NaN,  Adjusted R-squared:   NaN
F-statistic:   NaN on 1 and 18 DF,  p-value: NA






--

David Winsemius, MD
West Hartford, CT

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


[R] New R User Group in Toronto

2010-10-12 Thread Guelman, Leo
Dear R users, 

I'm pleased to announce that the Greater Toronto Area (GTA) user's group
is now active on meetup.com, and taking suggestions for the first
meeting. If you are on the region, you can sign-up now at the link below

http://www.meetup.com/Greater-Toronto-Area-GTA-R-Users-Group

This group is aimed to bring together practitioners (from industry and
academia alike) in order to exchange knowledge and experience on using R
for data analysis, statistical modeling, visualization, data mining,
predictive analytics, statistical computing, exploratory data analysis,
etc. Users from all levels are welcome.

Special thanks to Revolution Analytics to help us get started and
sponsor the group.

Kind Regards, 

Leo Guelman.
___

This e-mail may be privileged and/or confidential, and the sender does not waive
any related rights and obligations. Any distribution, use or copying of this 
e-mail or the information
it contains by other than an intended recipient is unauthorized.
If you received this e-mail in error, please advise me (by return e-mail or 
otherwise) immediately.

Ce courriel peut contenir des renseignements protégés et confidentiels.
L’expéditeur ne renonce pas aux droits et obligations qui s’y rapportent.
Toute diffusion, utilisation ou copie de ce courriel ou des renseignements 
qu’il contient
par une personne autre que le destinataire désigné est interdite.
Si vous recevez ce courriel par erreur, veuillez m’en aviser immédiatement, 
par retour de courriel ou par un autre moyen.

[[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] append rows to Sybase datatable using RJDBC

2010-10-12 Thread Li, Jing Yi
Hi,

Does anyone have experience using RJDBC library to write to Sybase
datatable? The jdbc driver I am using is jConnect 6.0. I can
successfully write into a new datatable, but have problem appending rows
to existing one. It either complains Table *** already exists or
simply overwrite the existing one. Here is the example.

I am trying to append 'data' to the existing datatable 'tmp'

 data
SecurityID  Ticker
1   12345   AAPL

 dbWriteTable(conn, tmp, data, append = T, overwrite = F)
Error in .local(conn, name, value, ...) :
Table 'tmp' already exists

 dbWriteTable(conn, tmp, data, append = T)
[1] TRUE

The first dbWriteTable failed as it's complaining tmp already exists,
it looks strange to me as append is set to TRUE. The second dbWriteTable
succeeded but it actually overwrite existing rows with data which is
not expected as append is set to TRUE and overwrite is default to FALSE.


Can anyone shed me some lights here? Thanks a lot for your help!

Jingyi


=== 
Please access the attached hyperlink for an important el...{{dropped:8}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] append rows to Sybase datatable using RJDBC

2010-10-12 Thread David Winsemius


On Oct 12, 2010, at 9:51 AM, Li, Jing Yi wrote:


Hi,

Does anyone have experience using RJDBC library to write to Sybase
datatable? The jdbc driver I am using is jConnect 6.0. I can
successfully write into a new datatable, but have problem appending  
rows

to existing one. It either complains Table *** already exists or
simply overwrite the existing one. Here is the example.

I am trying to append 'data' to the existing datatable 'tmp'


data

SecurityID  Ticker
1   12345   AAPL


dbWriteTable(conn, tmp, data, append = T, overwrite = F)

Error in .local(conn, name, value, ...) :
Table 'tmp' already exists


dbWriteTable(conn, tmp, data, append = T)

[1] TRUE


What happens when you type c(T,F)  at your console? Do you get [1]   
TRUE FALSE ?




The first dbWriteTable failed as it's complaining tmp already exists,
it looks strange to me as append is set to TRUE. The second  
dbWriteTable

succeeded but it actually overwrite existing rows with data which is
not expected as append is set to TRUE and overwrite is default to  
FALSE.



Can anyone shed me some lights here? Thanks a lot for your help!

--

David Winsemius, MD
West Hartford, CT

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


[R] F cumulative distribution function

2010-10-12 Thread Hsih-Te Yang
Dear Sir or Madam:

Dose anyone know the R function which corresponds to fcdf, a F cumulative
distribution function of Matlab?
http://esra.univ-paris1.fr/matlab5/toolbox/stats/fcdf.html

Please guide me how to get this function if it is available.
  . or code it ab initio if no function in R
language

Thanks for kind reply further.

Hsih-Te

[[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] append rows to Sybase datatable using RJDBC

2010-10-12 Thread Li, Jing Yi
yes. c(T,F) does return
[1] TRUE FALSE 

-Original Message-
From: David Winsemius [mailto:dwinsem...@comcast.net] 
Sent: Tuesday, October 12, 2010 10:00 AM
To: Li, Jing Yi
Cc: r-help@r-project.org
Subject: Re: [R] append rows to Sybase datatable using RJDBC


On Oct 12, 2010, at 9:51 AM, Li, Jing Yi wrote:

 Hi,

 Does anyone have experience using RJDBC library to write to Sybase 
 datatable? The jdbc driver I am using is jConnect 6.0. I can 
 successfully write into a new datatable, but have problem appending 
 rows to existing one. It either complains Table *** already exists 
 or simply overwrite the existing one. Here is the example.

 I am trying to append 'data' to the existing datatable 'tmp'

 data
   SecurityID  Ticker
 1 12345   AAPL

 dbWriteTable(conn, tmp, data, append = T, overwrite = F)
 Error in .local(conn, name, value, ...) :
 Table 'tmp' already exists

 dbWriteTable(conn, tmp, data, append = T)
 [1] TRUE

What happens when you type c(T,F)  at your console? Do you get [1]   
TRUE FALSE ?


 The first dbWriteTable failed as it's complaining tmp already exists,

 it looks strange to me as append is set to TRUE. The second 
 dbWriteTable succeeded but it actually overwrite existing rows with 
 data which is not expected as append is set to TRUE and overwrite is

 default to FALSE.


 Can anyone shed me some lights here? Thanks a lot for your help!
-- 

David Winsemius, MD
West Hartford, CT


=== 
Please access the attached hyperlink for an important el...{{dropped:4}}

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

2010-10-12 Thread ONKELINX, Thierry
Have a look at qf() and pf()

HTH,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie  Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics  Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
thierry.onkel...@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
  

 -Oorspronkelijk bericht-
 Van: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] Namens Hsih-Te Yang
 Verzonden: dinsdag 12 oktober 2010 15:49
 Aan: r-help@r-project.org
 Onderwerp: [R] F cumulative distribution function
 
 Dear Sir or Madam:
 
 Dose anyone know the R function which corresponds to fcdf, 
 a F cumulative distribution function of Matlab?
 http://esra.univ-paris1.fr/matlab5/toolbox/stats/fcdf.html
 
 Please guide me how to get this function if it is available.
   . or code it ab initio if no 
 function in R language
 
 Thanks for kind reply further.
 
 Hsih-Te
 
   [[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] F cumulative distribution function

2010-10-12 Thread Ted Harding
On 12-Oct-10 13:49:07, Hsih-Te Yang wrote:
 Dear Sir or Madam:
 
 Dose anyone know the R function which corresponds to fcdf,
 a F cumulative distribution function of Matlab?
 http://esra.univ-paris1.fr/matlab5/toolbox/stats/fcdf.html
 
 Please guide me how to get this function if it is available.
 . or code it ab initio if no function in R language
 
 Thanks for kind reply further.
 Hsih-Te

The equibalent in R of P = fcdf(X,V1,V2) (as in your URL) is

  P - pf(X,V1,V2)

where X,V2,V2 should be vectors of the same length.

Note that R's pf offers additional functionality, such as a
non-centrality paramater for the no-centgral F distribution.

Enter '?pf' for more detailed information.

Ted.


E-Mail: (Ted Harding) ted.hard...@wlandres.net
Fax-to-email: +44 (0)870 094 0861
Date: 12-Oct-10   Time: 15:22:18
-- XFMail --

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


Re: [R] F cumulative distribution function

2010-10-12 Thread Eik Vettorazzi
Hi,
see
?pf

Generally in R '(d/p/q/r)distribution' stands for density, cdf,
quantiles and random numbers for a given distribution as norm, t, unif,
chisq etc
hth

Am 12.10.2010 15:49, schrieb Hsih-Te Yang:
 Dear Sir or Madam:
 
 Dose anyone know the R function which corresponds to fcdf, a F cumulative
 distribution function of Matlab?
 http://esra.univ-paris1.fr/matlab5/toolbox/stats/fcdf.html
 
 Please guide me how to get this function if it is available.
   . or code it ab initio if no function in R
 language
 
 Thanks for kind reply further.
 
 Hsih-Te
 
   [[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.

-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] repeatability/intraclass with nested levels

2010-10-12 Thread Nevil Amos
  I have a spectrophotometric dataset with repeated measures of a value 
at 200 wavelengths for each of  150 individuals.

I would like to use the repeated samples to at each wavelength to look 
at measurement/observer error, compared to difference between 
individuals error

I have looked at doing this with icc{irr} or using an anova approach, 
but I am unclear how to acheive this given that there is a nested 
structure- the value varies between wavelengths within individuals.

Many thanks

Nevil Amos

data is structured thus:

   ANWC_NO Wavelength Repeatvalue
 1   00239300   r1 0.079501
 2   00239302   r1 0.084113
 3   00239304   r1 0.087697
 202 11157300   r1 0.008449
 203 11157302   r1 0.009489
 204 11157304   r1 0.010142
 403 11158300   r1 0.026999
 404 11158302   r1 0.029612
 405 11158304   r1 0.030271
 604 11159300   r1 0.032784
 66934   38711300   r3 0.062081
 66935   38711302   r3 0.065137
 66936   38711304   r3 0.067092
 67135   38712300   r3 0.029389
 67136   38712302   r3 0.030192
 67137   38712304   r3 0.030860
 67336   38993300   r3 0.045720
 67337   38993302   r3 0.048060
 67338   38993304   r3 0.051898
 67537   38994300   r3 0.051815
 67538   38994302   r3 0.055162


[[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] heatmap

2010-10-12 Thread l.mohammadikhankahdani


Hi All

Has anyone used correlation (Pearson or cosine or others) for clustering 
in heatmaps?

If so, could  you please tell me how?
Thanks
Leila

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] repeatability/intraclass with nested levels

2010-10-12 Thread Bert Gunter
This is an example of what is commonly known as functional data analysis,
or fda for short. You can search on this term to learn more. R has
an fda package that deals with this sort of data -- and very likely
others besides: essentially you have a 200-d response vector and so
require a multivariate analysis that deals with the inherent
correlation among the wavelengths. fda seems the appropriate way to
handle this to me, but there are certainly other approaches, depending
on your context.

However, due to your relative ignorance of these matters, you would do
well to consult a local statistician to help get you started and guide
your initial forays into this arena.

-- Bert

On Tue, Oct 12, 2010 at 7:32 AM, Nevil Amos nevil.a...@gmail.com wrote:
  I have a spectrophotometric dataset with repeated measures of a value
 at 200 wavelengths for each of  150 individuals.

 I would like to use the repeated samples to at each wavelength to look
 at measurement/observer error, compared to difference between
 individuals error

 I have looked at doing this with icc{irr} or using an anova approach,
 but I am unclear how to acheive this given that there is a nested
 structure- the value varies between wavelengths within individuals.

 Many thanks

 Nevil Amos

 data is structured thus:

       ANWC_NO Wavelength Repeat    value
 1       00239        300       r1 0.079501
 2       00239        302       r1 0.084113
 3       00239        304       r1 0.087697
 202     11157        300       r1 0.008449
 203     11157        302       r1 0.009489
 204     11157        304       r1 0.010142
 403     11158        300       r1 0.026999
 404     11158        302       r1 0.029612
 405     11158        304       r1 0.030271
 604     11159        300       r1 0.032784
 66934   38711        300       r3 0.062081
 66935   38711        302       r3 0.065137
 66936   38711        304       r3 0.067092
 67135   38712        300       r3 0.029389
 67136   38712        302       r3 0.030192
 67137   38712        304       r3 0.030860
 67336   38993        300       r3 0.045720
 67337   38993        302       r3 0.048060
 67338   38993        304       r3 0.051898
 67537   38994        300       r3 0.051815
 67538   38994        302       r3 0.055162


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




-- 
Bert Gunter
Genentech Nonclinical Biostatistics

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] general construction of 'all pairwise comparison' contrast in ANOVA

2010-10-12 Thread Michael Hopkins


Hi R people

I am using regsubsets() to fit large numbers of models and collect summary 
statistics in order to perform a Bayesian analysis of multi-way ANOVA with 
specific prior information. In general the variables have differing numbers of 
levels =2.  This works well but with variable of more than 2 levels there are 
naturally some arbitrary decisions about which treatment contrasts to include 
in the model matrix.  It's obviously easy to choose the 'standard' contrasts 
using 

options( contrasts = c( contr.sum, contr.poly ))

with contr.helmert, contr.sum or contr.treatment as required.

However, what I would really like is a set of all pairwise comparison 
contrasts, and preferably in a form that can be fed straight to regsubsets() so 
that all labelling, fitting, output etc is automatically dealt with.

Are there any functions or libraries in R that will allow me to do this without 
too much grief?

Thanks in advance


Michael Hopkins
Algorithm and Statistical Modelling Expert
 
Upstream
23 Old Bond Street
London
W1S 4PZ

Mob +44 0782 578 7220
DL   +44 0207 290 1326
Fax  +44 0207 290 1321

hopk...@upstreamsystems.com
www.upstreamsystems.com
 


[[alternative HTML version deleted]]

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


[R] List or matrix of object

2010-10-12 Thread Filoche

Hi everyone.

Is it possible in R to create a matrix or a list (vector) or R object. For
instance, I have

f1 - function(x) sqrt(x%*%x);
f2 - function(x) (2x+1);

I would like to do something like 

L - List();
L[1] = f1;
L[2] = f2;

So, is there a way to create matrix or vector that can contains R object.

With regards,
Phil
-- 
View this message in context: 
http://r.789695.n4.nabble.com/List-or-matrix-of-object-tp2992101p2992101.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] can't find and install reshape2??

2010-10-12 Thread Hadley Wickham
 My guess is you are using an outdated R version for which the rather new
 reshape2 package has not been compiled.

I wonder if install.packages() could detect this case (e.g. by also
checking if the source version is not available), and offer a more
informative error message.

Hadley

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

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


Re: [R] Is there a regression surface demo?

2010-10-12 Thread Greg Snow
For another approach you might want to look at Predict.Plot and TkPredict from 
the TeachingDemos package.  The code from those could be adapted to do 3d 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 Joshua Wiley
 Sent: Monday, October 11, 2010 3:03 PM
 To: r-help@r-project.org
 Subject: Re: [R] Is there a regression surface demo?
 
 Thanks for everyone's responses. Just to follow up, here is a working
 version of my original.  The code is not pretty, but it functions.
 Assuming you have the 'rgl' package installed and have sourced this
 function, here are some examples:
 
 RegSurfaceDemo(mpg ~ vs + wt, data = mtcars)
 RegSurfaceDemo(mpg ~ vs * wt, data = mtcars)
 RegSurfaceDemo(qsec ~ disp * hp, data = mtcars)
 
 It cannot handle factors, and the axes labels are hideous...I'll get
 to that eventually.
 
 Thanks for all your help and suggestions.
 
 Josh
 
 RegSurfaceDemo - function(formula, data, xlim = NULL, ylim = NULL,
zlim = NULL, resolution = 10) {
  require(rgl)
  ## This cannot be the proper way to extract variable names from
 formula
  vars - rownames(attr(terms(formula), factors))
 
  ## if no limits set, make them nearest integer to
  ## .75 the lowest value and 1.25 the highest
  ranger - function(x) {
as.integer(range(x) * c(.75, 1.25))
  }
  if(is.null(xlim)) {xlim - ranger(data[, vars[2]])}
  if(is.null(ylim)) {ylim - ranger(data[, vars[3]])}
  if(is.null(zlim)) {zlim - ranger(data[, vars[1]])}
 
  ## This does not actually work because the data frame
  ## does not get named properly (actually it throws an error)
  f - function (x, y) {
newdat - data.frame(x, y)
colnames(newdat) - c(vars[2], vars[3])
predict(my.model, newdata = newdat)
  }
 
  ## Fit model
  my.model - lm(formula = formula, data = data)
 
  ## Create X, Y, and Z grids
  X - seq(from = xlim[1], to = xlim[2], length.out = resolution)
  Y - seq(from = ylim[1], to = ylim[2], length.out = resolution)
  Z - outer(X, Y, f)
 
  ## Create 3d scatter plot and add the regression surface
  open3d()
  with(data = data,
   plot3d(x = get(vars[2]), y = get(vars[3]), z = get(vars[1]),
  xlim = xlim, ylim = ylim, zlim = zlim))
  par3d(ignoreExtent = TRUE)
  surface3d(X, Y, Z, col = blue, alpha = .6)
  par3d(ignoreExtent = FALSE)
  return(summary(my.model))
 }
 
 
 
 On Mon, Oct 11, 2010 at 1:28 PM, Ista Zahn iz...@psych.rochester.edu
 wrote:
  There is also wireframe() in lattice and bplot in rms.
 
  -Ista
 
  On Mon, Oct 11, 2010 at 3:49 PM, G. Jay Kerns gke...@ysu.edu wrote:
  Dear Josh,
 
  On Mon, Oct 11, 2010 at 3:15 PM, Joshua Wiley
 jwiley.ps...@gmail.com wrote:
  Hi All,
 
  Does anyone know of a function to plot a regression surface for two
  predictors?  RSiteSearch()s and findFn()s have not turned up what I
  was looking for.  I was thinking something along the lines of:
  http://mallit.fr.umn.edu/fr5218/reg_refresh/images/fig9.gif
 
  I like the rgl package because showing it from different angles is
  nice for demonstrations.  I started to write my own, but it has
 some
  issues (non functioning code start below), and I figured before I
  tried to work out the kinks, I would ask for the list's feedback.
 
  Any comments or suggestions (about functions or preferred idioms
 for
  what I tried below, or...) are greatly appreciated.
 
  Josh
 
 
  [snip]
 
  I haven't tried to debug your code, but wanted to mention that the
  Rcmdr:::scatter3d function does 3-d scatterplots (with the rgl
  package) and adds a regression surface, one of 4 or 5 different
 types.
   If nothing else, it might be a good place to start for making your
  own.
 
  A person can play around with the different types in the Rcmdr under
  the Graphs menu.  Or, from the command line:
 
  library(Rcmdr)
  with(rock, scatter3d(area, peri, shape))
 
  I hope that this helps,
  Jay
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/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
 
 
 
 
 --
 Joshua Wiley
 Ph.D. Student, Health Psychology
 University of California, Los Angeles
 http://www.joshuawiley.com/
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list

Re: [R] compare histograms

2010-10-12 Thread Greg Snow
That depends a lot on what you mean by the histograms being equivalent.

You could just plot them and compare visually.  It may be easier to compare 
them if you plot density estimates rather than histograms.  Even better would 
be to do a qqplot comparing the 2 sets of data rather than the histograms.

If you want a formal test then the ks.test function can compare 2 datasets.  
Note that the null hypothesis is that they come from the same distribution, a 
significant result means that they are likely different (but the difference may 
not be of practical importance), but a non-significant test could mean they are 
the same, or that you just do not have enough power to find the difference (or 
the difference is hard for the ks test to see).  You could also use a 
chi-squared test to compare this way.

Another approach would be to use the vis.test function from the TeachingDemos 
package.  Write a small function that will either plot your 2 histograms 
(density plots), or permute the data between the 2 groups and plot the 
equivalent histograms.  The vis.test function then presents you with an array 
of plots, one of which is the original data and the rest based on permutations. 
 If there is a clear meaningful difference in the groups you will be able to 
spot the plot that does not match the rest, otherwise it will just be guessing 
(might be best to have a fresh set of eyes that have not seen the data before 
see if they can pick out the real plot).

-- 
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 solafah bh
 Sent: Monday, October 11, 2010 4:02 PM
 To: R help mailing list
 Subject: [R] compare histograms
 
 Hello
 How to compare  two statistical histograms? How i can know if these
 histograms are equivalent or not??
 
 Regards
 
 
 
   [[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] Extracting data subset for plot

2010-10-12 Thread Greg Snow
If you just want to limit the plot, then specify xlim and ylim in the plot call 
and everything outside of those ranges will be silently ignored in the plotting.

-- 
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 elaine kuo
 Sent: Monday, October 11, 2010 9:45 PM
 To: r-help@r-project.org
 Subject: [R] Extracting data subset for plot
 
 Dear list,
 
 
 
 I want to make a plot based on the following information, using the
 command
 plot.
 
 variable A for x axis : temperature (range: -20 degrees to 40 degree)
 
 variable B for y axis : altitude (range: 50 m to 2500 m )
 
 
 
 The data below 0 degree of X variable wants to be erased tentatively.
 
 Please kindly advise the command to extract the data ranging from 0
 degree
 to 40 degrees.
 
 Thank you.
 
 
 
 Elaine
 
   [[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] nnet support

2010-10-12 Thread Greg Snow
The nnet package is a support package (along with MASS and others) for a book.  
My guess is that book would be the best place to start.

-- 
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 Raji
 Sent: Tuesday, October 12, 2010 4:24 AM
 To: r-help@r-project.org
 Subject: Re: [R] nnet support
 
 
 A book/online link with an example for all the parameters that are used
 in
 nnet would help in understanding the package better.
 --
 View this message in context: http://r.789695.n4.nabble.com/nnet-
 support-tp840467p2991572.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] List or matrix of object

2010-10-12 Thread jim holtman
You probably need to review the Intro to R to understand indexing:

 f1 - function(x) sqrt(x%*%x);
 f2 - function(x) (2*x+1);
 L - list()
 L[[1]] - f1
 L[[2]] - f2
 L  # contains the objects

[[1]]
function (x)
sqrt(x %*% x)

[[2]]
function (x)
(2 * x + 1)

 L[[1]](3)  # now call the functions in the list
 [,1]
[1,]3
 L[[2]](42)
[1] 85



On Tue, Oct 12, 2010 at 11:17 AM, Filoche pmassico...@hotmail.com wrote:

 Hi everyone.

 Is it possible in R to create a matrix or a list (vector) or R object. For
 instance, I have

 f1 - function(x) sqrt(x%*%x);
 f2 - function(x) (2x+1);

 I would like to do something like

 L - List();
 L[1] = f1;
 L[2] = f2;

 So, is there a way to create matrix or vector that can contains R object.

 With regards,
 Phil
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/List-or-matrix-of-object-tp2992101p2992101.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.




-- 
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] List or matrix of object

2010-10-12 Thread Greg Snow
It is not clear exactly what you are trying to do, but this works:

f1 - function(x) sqrt(x%*%x)
f2 - function(x) {2*x+1}

L - list();
L[[1]] = f1;
L[[2]] = f2;


Then you can do something like:

L[[2]](5)

-- 
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 Filoche
 Sent: Tuesday, October 12, 2010 9:17 AM
 To: r-help@r-project.org
 Subject: [R] List or matrix of object
 
 
 Hi everyone.
 
 Is it possible in R to create a matrix or a list (vector) or R object.
 For
 instance, I have
 
 f1 - function(x) sqrt(x%*%x);
 f2 - function(x) (2x+1);
 
 I would like to do something like
 
 L - List();
 L[1] = f1;
 L[2] = f2;
 
 So, is there a way to create matrix or vector that can contains R
 object.
 
 With regards,
 Phil
 --
 View this message in context: http://r.789695.n4.nabble.com/List-or-
 matrix-of-object-tp2992101p2992101.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] List or matrix of object

2010-10-12 Thread David Winsemius


On Oct 12, 2010, at 11:17 AM, Filoche wrote:



Hi everyone.

Is it possible in R to create a matrix or a list (vector) or R  
object. For

instance, I have

f1 - function(x) sqrt(x%*%x);
f2 - function(x) (2x+1);

I would like to do something like

L - List();
L[1] = f1;
L[2] = f2;


You should learn a few things  (These should have been explained and  
illustrated as you worked your way through the An Introduction to R):


http://cran.r-project.org/doc/manuals/R-intro.pdf

... R is case sensitive so list != List. Changing List to list  
would help.


... except for the fact that 2x is not a valid expression. Need 2*x

...  and, the [- and [[- operations are different. The use of  
[[- works:


 f1 - function(x) sqrt(x%*%x)
 f2 - function(x) (2*x+1)
 L - list()
 L[[1]] - f1
 L[[2]] - f2;
 L

If you want to use [-, you will need to give it a valid list object:

 f1 - function(x) sqrt(x%*%x)
 f2 - function(x) (2*x+1)
 L - list()
 L[1] - list(f1)
 L[2] - list(f2)
 L

... and drop the use ;'s at the end of lines.

--




So, is there a way to create matrix or vector that can contains R  
object.


With regards,
Phil
--
View this message in context: 
http://r.789695.n4.nabble.com/List-or-matrix-of-object-tp2992101p2992101.html
Sent from the R help mailing list archive at Nabble.com.



.


David Winsemius, MD
West Hartford, CT

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


[R] R optimization and curve()?

2010-10-12 Thread jcress410

I'm trying to figure out how to plot basic utility maximization results with
R, Ideally I'd like to plot the value of u through x1,x2 space, so you can
graph income / substitution effects easily... 

also, it'd be nice if I could put a linear budget constraint on the graph

 here's an example with cobb douglas utility 

u - function(x) {
x1 - x[1]
x2 - x[2]
 (x1^alpha)*(x2^(1-alpha))
}
utility - function(x) x[1]^(alpha)*x[2]^(1-alpha)
p - c(2,1)
i - -100
alpha - .3
umax - function(p,i,u) {
res - constrOptim(c(.5,.5), u, grad=NULL, ui=-p, ci=i, mu = 1e-04,
control=list(fnscale=-1))
return(res)
}
curve(umax, c(c(2,1),c(2,1)), c(10,100))
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R-optimization-and-curve-tp2992244p2992244.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] (no subject)

2010-10-12 Thread davidius fyske

To Whom It may Concern,
I am *very* new to R so no answer can be too explicit or step-by-step. I have 
to plot make a Normal quantile graph for a data set that looks like 
this:density5.55.614.885.075.265.555.365.295.585.655.575.535.625.295.445.345.795.15.275.395.425.475.635.345.465.35.755.685.85
I begin with  data=name of file.txt
I know I am supposed to begin with qqnorm but I don't know what to do next. I 
have tried a couple of dozen different codes I found on the Internet and I 
always get some kind of error (usually about x or y not being defined). If  you 
are able to send back an example of how to plot this, could you also send it 
with code for the axis labels and title (if it's not too much trouble). Thank 
you for any help or advice you can give me. I know this must be a simple 
problem, but with no experience or examples, I am completely lost. Thanks - 
Dave
[[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] List or matrix of object

2010-10-12 Thread Filoche

Hi again everyone.

I found I could use a list with

l = list()
l[[1]] = myObj

instead of

l[1] = myObj

Anyone can explain me why the use of double [] is required?

Regards,
Phil

-- 
View this message in context: 
http://r.789695.n4.nabble.com/List-or-matrix-of-object-tp2992101p2992121.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] Lattice::bwplot unexpected behaviour when using vector of colors

2010-10-12 Thread Mehrdad Shamsi
Hi,
I posted this message on R-devel, but it seems to be more suitable for R-help. 
So I post it here again.

I'm trying to produce colored boxplots using lattice::bwplot function. I need 
to plot each boxplot in the panel with a specific color. Naturally, I used a 
vector of colors and expected to see colored boxplots. Although the boxplots 
were colored, the color of whiskers and the boxes  do not match. Here is an 
example:

d = data.frame(y = rnorm(100), x=1:4)
box.color - c('red','blue','black', 'green')
bwplot(y~x,
data=d,
horizontal=FALSE,
par.settings = list(
box.rectangle = list(col = box.color),
box.umbrella = list(col = box.color)
)
)

I went through the bwplot.panel to figure out what the problem was. It seems 
that bwplot.panel function is implemented with the assumption that 
box.rectangle$col and box.umberella$col are not vectors. It would be nice if 
bwplot.panel could accept vector of colors.

I use R2.11-x64 on a Windows XP machine. The lattice package version is 
lattice_0.19-13.

--Thanks

-- M.S.

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

2010-10-12 Thread Changbin Du
HI, Dear R community,

My data set has 2409 variables, the  last one is response variable.  I have
used the nnet after feature selection and works. But this time, I am using
nnet to fit a model without feature selection. I got the following error
information:

 dim(train)
[1] 1827 2409

 nnet.fit-nnet(as.factor(out) ~ ., data=train,  size=3, rang=0.3,
decay=5e-4, maxit=500)  # model fitting
*Error in nnet.default(x, y, w, entropy = TRUE, ...) :
  too many (7231) weights*


The data set is bigger than 25MB, can not be attached.

Many thanks!


-- 
Sincerely,
Changbin
--

[[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] Displaying a variable as an expression into a plot label, but the variable has brackets

2010-10-12 Thread Jared Blashka
I'm attempting to insert variables as expressions into labels for my plots,
but I'm running into the issue that characters in my labels aren't allowed
in expressions, notably '[' and ']'. An input string of [^3H]5-CT needs to
be displayed as [3H]5-CT with the 3 as superscript. But brackets aren't
particularly liked in expressions. I know I can do something like

mtext(expression(paste([,phantom()^3,H]5-CT (0.8 nM))),3,2)

but [^3H]5-CT is saved as a single variable. I'm not really sure what to
do other than splitting the string into sections that can and can't be
evaluated as expressions and then pasting as necessary.

Thanks,
Jared

[[alternative HTML version deleted]]

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


Re: [R] Lattice::bwplot unexpected behaviour when using vector of colors

2010-10-12 Thread RICHARD M. HEIBERGER
Please look at the panel.bwplot.intermediate.hh in the HH package.  This
example is on the
?position
help page, also in the HH package.
If you don't have HH yet, you can get it with
install.packages(HH)
library(HH)

The full example is
require(HH)
## boxplots coded by week
tmp - data.frame(Y=rnorm(40, rep(c(20,25,15,22), 10), 5),
  week=ordered(rep(1:4, 10)))
position(tmp$week) - c(1, 2, 4, 8)
bwplot(Y ~ week, horizontal=FALSE,
   scales=list(x=list(limits=c(0,9),
   at=position(tmp$week),
   labels=position(tmp$week))),
   data=tmp, panel=panel.bwplot.intermediate.hh)


On Tue, Oct 12, 2010 at 11:55 AM, Mehrdad Shamsi
mehrdad.sha...@oicr.on.cawrote:

 Hi,
 I posted this message on R-devel, but it seems to be more suitable for
 R-help. So I post it here again.

 I'm trying to produce colored boxplots using lattice::bwplot function. I
 need to plot each boxplot in the panel with a specific color. Naturally, I
 used a vector of colors and expected to see colored boxplots. Although the
 boxplots were colored, the color of whiskers and the boxes  do not match.
 Here is an example:

 d = data.frame(y = rnorm(100), x=1:4)
 box.color - c('red','blue','black', 'green')
 bwplot(y~x,
data=d,
horizontal=FALSE,
par.settings = list(
box.rectangle = list(col = box.color),
box.umbrella = list(col = box.color)
)
 )

 I went through the bwplot.panel to figure out what the problem was. It
 seems that bwplot.panel function is implemented with the assumption that
 box.rectangle$col and box.umberella$col are not vectors. It would be nice if
 bwplot.panel could accept vector of colors.

 I use R2.11-x64 on a Windows XP machine. The lattice package version is
 lattice_0.19-13.

 --Thanks

 -- M.S.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.htmlhttp://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] need help with nnet

2010-10-12 Thread Changbin Du
Thanks, Claudia!


On Tue, Oct 12, 2010 at 9:54 AM, Claudia Beleites cbelei...@units.itwrote:

 I'm not sure how much fun it is to fit  7000 weights with 1800 samples,
 but you can tell nnet to allow more weights with MaxNWts, see ?nnet



 On 10/12/2010 06:45 PM, Changbin Du wrote:

 HI, Dear R community,

 My data set has 2409 variables, the  last one is response variable.  I
 have
 used the nnet after feature selection and works. But this time, I am using
 nnet to fit a model without feature selection. I got the following error
 information:

  dim(train)

 [1] 1827 2409

  nnet.fit-nnet(as.factor(out) ~ ., data=train,  size=3, rang=0.3,
 decay=5e-4, maxit=500)  # model fitting
 *Error in nnet.default(x, y, w, entropy = TRUE, ...) :
   too many (7231) weights*


 The data set is bigger than 25MB, can not be attached.

 Many thanks!




 --
 Claudia Beleites
 Dipartimento dei Materiali e delle Risorse Naturali
 Università degli Studi di Trieste
 Via Alfonso Valerio 6/a
 I-34127 Trieste

 phone: +39 0 40 5 58-37 68
 email: cbelei...@units.it




-- 
Sincerely,
Changbin
--

Changbin Du
DOE Joint Genome Institute
Bldg 400 Rm 457
2800 Mitchell Dr
Walnut Creet, CA 94598
Phone: 925-927-2856

[[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] lapply to subsets

2010-10-12 Thread Feng Li
Dear R,

I have a silly question concerns with *apply. Say I have a list called A,

A - list(a  =  array(1:20, c(2, 2, 5)), b  = array(1:30, c(2, 3, 5)))

I wish to calculate the mean of A$a, and A$b w.r.t. their third dimension so
I did

lapply(A,apply,c(1,2),mean)

Now if I still wish to do the above task but take away some burn-in, e.g. do
not take A$a[,,1:2],and A$b[,,1:2] into account. How can I do then?


Thanks!



Feng


-- 
Feng Li
Department of Statistics
Stockholm University
106 91 Stockholm, Sweden
http://feng.li/

[[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] (no subject)

2010-10-12 Thread Greg Snow
This looks like homework and there are enough teachers on this list that we 
frown on doing others homework for them (sometimes help if it is clear what 
help is allowed by the teacher).

Some hints to get you started:

You should read the document An Introduction to R that comes with every R 
install, section 7 covers reading data into R, which it appears you have not 
done, but are expecting R to treat the name of the file as a number which 
confuses it.

Section 1.7 discusses getting help, in short typing ?qqnorm and pressing enter 
will bring up the help page for qqnorm along with some nice examples as the 
bottom showing how to use it (and one even shows how to change an axis label).

-- 
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 davidius fyske
 Sent: Tuesday, October 12, 2010 10:34 AM
 To: r-help@r-project.org
 Subject: [R] (no subject)
 
 
 To Whom It may Concern,
 I am *very* new to R so no answer can be too explicit or step-by-step.
 I have to plot make a Normal quantile graph for a data set that looks
 like
 this:density5.55.614.885.075.265.555.365.295.585.655.575.535.625.295.44
 5.345.795.15.275.395.425.475.635.345.465.35.755.685.85
 I begin with  data=name of file.txt
 I know I am supposed to begin with qqnorm but I don't know what to do
 next. I have tried a couple of dozen different codes I found on the
 Internet and I always get some kind of error (usually about x or y not
 being defined). If  you are able to send back an example of how to plot
 this, could you also send it with code for the axis labels and title
 (if it's not too much trouble). Thank you for any help or advice you
 can give me. I know this must be a simple problem, but with no
 experience or examples, I am completely lost. Thanks - Dave
 
   [[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] Stripes in the plot

2010-10-12 Thread Pei-ling
I'm trying to plot the spatial distribution of the precipitation within an 
area. However, I think some thing wrong with the way to create the matrix for 
the precipitation data, so it came out lots of stripes. Could somebody help to 
see what's the problem? 

Here's the code:

library(maptools);gpclibPermit()

KSR - readShapeLines(/Users/R/Code/data/KS_River_Basin_Dissolve.shp)
states - readShapeLines(/Users/R/Code/data/statesp020.shp)

ppt - read.table ('/Users/R/Code/LULC/pptnewlulc.dat', header = FALSE) # the 
size is 5764(pixels) x 528(periods)
ppt - (ppt/100)*25.4 #convert from hundredths of an inch to mm

# the range of the area
plat - as.matrix(seq(38.16836,41.29575,by=0.07273)) #dimension is (44,1)
plon - as.matrix(seq(-103.9752,-94.5,by=0.07273)) #dimension is (131,1)

ppt1 - ppt[,1]  #length is 5764
ppt1 - matrix(as.numeric(ppt[,1]), nrow=131, ncol=44)

 ppt1
   [1]  1.6107435  1.6964510  1.7840456  1.8703002  1.9060464  1.8331288
   [7]  1.7492645  1.6657609  1.5836155  1.5029230  1.4235667  1.3453415
  [13]  1.2679848  1.1911846  1.1145816  1.0377716  0.9603123  0.8817440
  [19]  0.8016514  0.7197971  0.6358195  0.5491863  0.4597592  0.3679972
  [25]  0.2760894  0.1982588  0.2476851  0.4162456  0.5978296  0.7801869
  [31]  0.9613614  1.1406394  1.3174150  1.4908873  1.6599098  1.8228706
  [37]  1.9775737  2.1211284  2.2498808  2.3594647  2.4450861  2.5021472
  [43]  2.5271773  2.5187691  2.4780429  2.4083549  2.3144392  2.2014557
  [49]  2.0743049  1.9372928  1.7940577  1.6476393  1.5006009  1.3551586
  [55]  1.2132956  1.0768556  0.9476100  0.8272998  0.7176445  0.6203169
  [61]  0.5368747  0.4686491  0.4165842  0.3810237  0.3614115  0.3558352
  [67]  0.3604144  0.3694904  0.3789373  0.3893489  0.4031113  0.4213572
  [73]  0.4439491  0.4701542  0.4990731  0.5298432  0.5617263  0.5941408
  [79]  0.6266697  0.6590616  0.6912338  0.7232838  0.7555102  0.7884400
  [85]  0.8228393  0.8596634  0.8998832  0.9441835  0.9926862  1.0449394
  [91]  1.1002318  1.1580500  1.2185293  1.2829580  1.3546013  1.4403309
  [97]  1.5538225  1.7202595  1.9752756  2.3408103  2.7993614  3.3147553
 [103]  3.8596185  4.4187127  4.9842972  5.5526464  6.1222320  6.6928247
 [109]  7.2650406  7.8401020  8.4197039  9.0059336  9.6012140 10.2082516
 [115] 10.8299745 11.4694468 12.1297462 12.8137955 13.5241426 14.2626950
.
.
.
[5701]  1.7727924  1.6088669  1.4597899  1.3320119  1.2334596  1.1726128
[5707]  1.1558909  1.1843496  1.2525310  1.3494515  1.4487511  1.4685923
[5713]  1.4405088  1.4147032  1.3983221  1.3934889  1.4017653  1.4242208
[5719]  1.4609696  1.5109698  1.5722817  1.6425184  1.7190923  1.7990668
[5725]  1.8786622  1.9527120  2.0148606  2.0596097  2.0856556  2.0971253
[5731]  2.1013309  2.1062371  2.1197684  2.1495620  2.2009875  2.2741332
[5737]  2.3639327  2.4640252  2.5699179  2.6796082  2.7929445  2.9106359
[5743]  3.0326922  3.1552148  3.2630879  3.3140082  3.2330736  3.0048286
[5749]  2.6999823  2.3698632  2.0349915  1.7047147  1.4003574  1.1866439
[5755]  1.0745487  1.0187572  1.0105229  1.0508374  1.1396213  1.2764772
[5761]  1.4637501  1.7146081  2.0986433  3.0352581

quartz()
filled.contour(plon,plat,t(ppt1),col=rainbow(20),plot.axes={axis(1);axis(2);lines(KSR,lwd=2,col='brown');lines(states)})




Thanks for help,
Peiling Lin

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

2010-10-12 Thread Greg Snow
The difference is the same as the difference between a set with 1 element and a 
single element from a set.

The single [ extracts/replaces/assigns a subset of the list elements, but the 
piece is still a list (even if it is one element).  So when you are assigning 
using [ you need to give  it a list, not a single object. If you create a list 
then do something like mode( mylist[1] ) you will see that it is still a list.

The double [[ exctracts/replaces/assigns a single element of the list, it does 
not work on anything more than a single element, but it works with that element 
as its own object, not a list (unless it is a list).  So [[ can be used to 
assign a single element without needing to create a list (but can only do a 
single element where [ can do 1 or more).  If you do mode( mylist[[1]] ) then 
you will see that the single element is no longer a list.

Hope that 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 Filoche
 Sent: Tuesday, October 12, 2010 9:29 AM
 To: r-help@r-project.org
 Subject: Re: [R] List or matrix of object
 
 
 Hi again everyone.
 
 I found I could use a list with
 
 l = list()
 l[[1]] = myObj
 
 instead of
 
 l[1] = myObj
 
 Anyone can explain me why the use of double [] is required?
 
 Regards,
 Phil
 
 --
 View this message in context: http://r.789695.n4.nabble.com/List-or-
 matrix-of-object-tp2992101p2992121.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] Displaying a variable as an expression into a plot label, but the variable has brackets

2010-10-12 Thread David Winsemius


On Oct 12, 2010, at 12:53 PM, Jared Blashka wrote:

I'm attempting to insert variables as expressions into labels for my  
plots,
but I'm running into the issue that characters in my labels aren't  
allowed
in expressions, notably '[' and ']'. An input string of [^3H]5-CT  
needs to
be displayed as [3H]5-CT with the 3 as superscript. But brackets  
aren't

particularly liked in expressions. I know I can do something like

mtext(expression(paste([,phantom()^3,H]5-CT (0.8 nM))),3,2)

but [^3H]5-CT is saved as a single variable. I'm not really sure  
what to

do other than splitting the string into sections that can and can't be
evaluated as expressions and then pasting as necessary.


bquote to the rescue!

 varname - [^3H]5-CT
 plot(1,1,xlab=expression(varname))  # nope
 plot(1,1,xlab=bquote(.(varname)) )  # Yes
 plot(1,1,xlab=bquote(.(varname)*(0.8 nM)) )
   # Yes, note need for * or ~ as plotmath separator.


==

David Winsemius, MD
West Hartford, CT

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


[R] How do I tell whether two vectors are identical?

2010-10-12 Thread ANJAN PURKAYASTHA
Hi,
I have two vectors, each of length 45000.
How do I compare the vectors to ascertain if they are identical. Secondly if
they are NOT identical, how do I determine the indices of positions at which
the vectors differ?
Thanks,
Anjan


-- 
===
anjan purkayastha, phd.
research associate
fas center for systems biology,
harvard university
52 oxford street
cambridge ma 02138
phone-703.740.6939
===

[[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] aggregate with cumsum

2010-10-12 Thread Bond, Stephen
Hello everybody,

Data is
myd - data.frame(id1=rep(c(a,b,c),each=3),id2=rep(1:3,3),val=rnorm(9))

I want to get a cumulative sum over each of id1. trying aggregate does not work

myd$pcum - aggregate(myd[,c(val)],list(orig=myd$id1),cumsum)

Please suggest a solution. In real the dataframe is huge so looping with for 
and subsetting is not a great idea (still doable, though).
Thank you


Stephen B


[[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 do I tell whether two vectors are identical?

2010-10-12 Thread Bert Gunter
Try preusing an Intro to R for such elementary questions, please. Also
the R Help facility.

But...

?identical   ##(oddly enough...)
?==

But beware numerical issues -- see R FAQ 7.31.

-- Bert


On Tue, Oct 12, 2010 at 10:35 AM, ANJAN PURKAYASTHA
anjan.purkayas...@gmail.com wrote:
 Hi,
 I have two vectors, each of length 45000.
 How do I compare the vectors to ascertain if they are identical. Secondly if
 they are NOT identical, how do I determine the indices of positions at which
 the vectors differ?
 Thanks,
 Anjan


 --
 ===
 anjan purkayastha, phd.
 research associate
 fas center for systems biology,
 harvard university
 52 oxford street
 cambridge ma 02138
 phone-703.740.6939
 ===

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




-- 
Bert Gunter
Genentech Nonclinical Biostatistics

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

2010-10-12 Thread Phil Spector

Stephen -
   In version R-2.11.1, I get


aggregate(myd[,c(val)],list(orig=myd$id1),cumsum)

  orig x.1 x.2 x.3
1a -0.62754524 -1.16194135 -0.05975811
2b  0.21954618 -0.21355521 -0.62970082
3c -0.30296239  1.44111610  0.30121880

Since myd has several observations for each value of orig,
you obviously can't just assign the output of aggregate
as a column of myd.

Were you thinking of

merge(myd,aggregate(myd[,c(val)],list(orig=myd$id1),cumsum))  ?

(Note that before version 2.11.1, aggregate *would* fail.))

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


On Tue, 12 Oct 2010, Bond, Stephen wrote:


Hello everybody,

Data is
myd - data.frame(id1=rep(c(a,b,c),each=3),id2=rep(1:3,3),val=rnorm(9))

I want to get a cumulative sum over each of id1. trying aggregate does not work

myd$pcum - aggregate(myd[,c(val)],list(orig=myd$id1),cumsum)

Please suggest a solution. In real the dataframe is huge so looping with for 
and subsetting is not a great idea (still doable, though).
Thank you


Stephen B


[[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 do I tell whether two vectors are identical?

2010-10-12 Thread David Winsemius

And ...

?which

which(abs(x-y) 0)   # or if these are subject to FAQ 7.31, then
which( zapsmall( abs(x-y))  0 )

.. for second part of question.

-- David.
On Oct 12, 2010, at 1:43 PM, Bert Gunter wrote:


Try preusing an Intro to R for such elementary questions, please. Also
the R Help facility.

But...

?identical   ##(oddly enough...)
?==

But beware numerical issues -- see R FAQ 7.31.

-- Bert


On Tue, Oct 12, 2010 at 10:35 AM, ANJAN PURKAYASTHA
anjan.purkayas...@gmail.com wrote:

Hi,
I have two vectors, each of length 45000.
How do I compare the vectors to ascertain if they are identical.  
Secondly if
they are NOT identical, how do I determine the indices of positions  
at which

the vectors differ?
Thanks,
Anjan


--
===
anjan purkayastha, phd.
research associate
fas center for systems biology,
harvard university
52 oxford street
cambridge ma 02138
phone-703.740.6939
===

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





--
Bert Gunter
Genentech Nonclinical Biostatistics

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


David Winsemius, MD
West Hartford, CT

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


Re: [R] aggregate with cumsum

2010-10-12 Thread Greg Snow
Try ave instead of aggregate.  If that does not do it, then look at the plyr 
package, probably the ddply function in that 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 Bond, Stephen
 Sent: Tuesday, October 12, 2010 11:40 AM
 To: r-help@r-project.org
 Subject: [R] aggregate with cumsum
 
 Hello everybody,
 
 Data is
 myd -
 data.frame(id1=rep(c(a,b,c),each=3),id2=rep(1:3,3),val=rnorm(9))
 
 I want to get a cumulative sum over each of id1. trying aggregate does
 not work
 
 myd$pcum - aggregate(myd[,c(val)],list(orig=myd$id1),cumsum)
 
 Please suggest a solution. In real the dataframe is huge so looping
 with for and subsetting is not a great idea (still doable, though).
 Thank you
 
 
 Stephen B
 
 
   [[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 do I tell whether two vectors are identical?

2010-10-12 Thread Łukasz Ręcławowicz
Or just:

id-seq(1,45e3,1)
compare-data.frame(id,a,b)
differences-compare$id[a!=b]

-- 
Miłego dnia

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

2010-10-12 Thread David Winsemius


On Oct 12, 2010, at 1:40 PM, Bond, Stephen wrote:


Hello everybody,

Data is
myd -  
data.frame(id1=rep(c(a,b,c),each=3),id2=rep(1:3,3),val=rnorm(9))


I want to get a cumulative sum over each of id1. trying aggregate  
does not work


myd$pcum - aggregate(myd[,c(val)],list(orig=myd$id1),cumsum)


Use ave instead of aggregate:

 ave(myd$val, list(myd$id1), FUN=cumsum)
[1]  0.362123399 -1.538797831 -2.061733393 -2.038050242 -0.344382401  
-1.365281650

[7]  0.391181119 -0.258668053 -0.007736216

myd$pcum - ave(myd$val, list(myd$id1), FUN=cumsum)

Please suggest a solution. In real the dataframe is huge so looping  
with for and subsetting is not a great idea (still doable, though).

Thank you


Stephen B

--

David Winsemius, MD
West Hartford, CT

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


Re: [R] How do I tell whether two vectors are identical?

2010-10-12 Thread ANJAN PURKAYASTHA
Thanks all for you help.
Anjan

2010/10/12 £ukasz Rêc³awowicz lukasz.reclawow...@gmail.com

 Or just:

 id-seq(1,45e3,1)
 compare-data.frame(id,a,b)
 differences-compare$id[a!=b]

 --
 Mi³ego dnia

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




-- 
===
anjan purkayastha, phd.
research associate
fas center for systems biology,
harvard university
52 oxford street
cambridge ma 02138
phone-703.740.6939
===

[[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] pvclust.plot and au

2010-10-12 Thread michy
 Hello is there anyway to just display the au values on pvclust.plot 
and not the bp values.


Thank you,
Michy

--
Michelle Simon
Bioinformatics,
MRC Mammalian Genetics Unit,
Harwell, Oxon, ox11 0rd, U.K.
E-mail: m.si...@har.mrc.ac.uk
Telephone:  +44 (0)1235 841031
www:http://www.har.mrc.ac.uk/


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

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


Re: [R] Read from a website

2010-10-12 Thread steven mosher
Hmm,

RCurl might have something on this.

otherwise pull you can figure out their scheme and just construct the url
from scratch.

when you finish filling in the form, look at the url they construct. do it a
few times
and you can just emulate that. I've done that in the past without problems.
depends on the site.


On Tue, Oct 12, 2010 at 2:32 AM, Santosh Srinivas 
santosh.srini...@gmail.com wrote:

 Something similar to this was discussed recently, but I'm unable to find
 the
 thread.



 I want to read from a site where I need to enter the date into a form
 before
 I am presented with the CSV link. E.g. like reading ticker data from yahoo
 (but assuming you HAVE to enter the dates and click on request).



 How do I simulate this from R?



 Thanks for the help.




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


  1   2   >