[R] What am I doing wrong with sapply ?

2011-05-26 Thread eric
Statement 9 using sapply does not seem to give the correct answer (or at
least to me). Yet I do what I think is the same thing with statement 11 and
I get the answer I'm looking for. 

9 : s -sapply(unlist(v[c(1:length(v))]), max)
11: for(i in 1 :length(v)) v1[i] - max(unlist(v[i]))

Shouldn't I get the same answer ? 


library(XML)
rm(list=ls())
url -
http://webapp.montcopa.org/sherreal/salelist.asp?saledate=05/25/2011;
tbl -data.frame(readHTMLTable(url))[2:404, c(3,5,6,8,9)]
names(tbl) - c(Address, Township, Parcel, SaleDate, Costs);
rownames(tbl) - c(1:length(tbl[,1]))
x -tbl
v - gregexpr(( aka )|( AKA ),x$Address)
s -sapply(unlist(v[c(1:length(v))]), max)
v1 -numeric(length(v))
for(i in 1 :length(v)) v1[i] - max(unlist(v[i]))

--
View this message in context: 
http://r.789695.n4.nabble.com/What-am-I-doing-wrong-with-sapply-tp3551598p3551598.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] all possible regression

2011-05-26 Thread Mufira Fitria
hi, I want to know how about r package  Robust CP in all possible regression  
method...can you help me??

thanks before...

[[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] likelihood ratio test

2011-05-26 Thread karuna m
Dear R-help,
Can anybody tell me which R package has Lo-Mendell Rubin LR test and Bootstrap 
LR test to compare the model fit between k class and k+1 class model for Latent 
class analysis?
Thanks in advance,
 warn regards,Ms.Karunambigai M
PhD Scholar
Dept. of Biostatistics
NIMHANS
Bangalore
India 
[[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] What am I doing wrong with sapply ?

2011-05-26 Thread Steve Lianoglou
Hi,

On Thu, May 26, 2011 at 12:49 AM, eric ericst...@aol.com wrote:
 Statement 9 using sapply does not seem to give the correct answer (or at
 least to me). Yet I do what I think is the same thing with statement 11 and
 I get the answer I'm looking for.

 9 : s -sapply(unlist(v[c(1:length(v))]), max)
 11: for(i in 1 :length(v)) v1[i] - max(unlist(v[i]))

 Shouldn't I get the same answer ?


 library(XML)
 rm(list=ls())
 url -
 http://webapp.montcopa.org/sherreal/salelist.asp?saledate=05/25/2011;
 tbl -data.frame(readHTMLTable(url))[2:404, c(3,5,6,8,9)]
 names(tbl) - c(Address, Township, Parcel, SaleDate, Costs);
 rownames(tbl) - c(1:length(tbl[,1]))
 x -tbl
 v - gregexpr(( aka )|( AKA ),x$Address)
 s -sapply(unlist(v[c(1:length(v))]), max)
 v1 -numeric(length(v))
 for(i in 1 :length(v)) v1[i] - max(unlist(v[i]))

There is an element in your list v that is of length 2, which is hosing you:

R table(sapply(v, length))

  1   2
401   2

and as a result, the unlist(v) is turning into a vector that's longer
than your list, so `s` is longer than `v1`

Another way you might have stumbled on the problem is when you compare s and v1:

R all(s == v1)
[1] FALSE
Warning message:
In s == v1 :
  longer object length is not a multiple of shorter object length

To fix the problem, you could use regexpr instead of gregexpr, which
only finds the first element of a match, and not all of them.

If you do that substitution, all(s == v1) will evaluate to TRUE.

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

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


Re: [R] What am I doing wrong with sapply ?

2011-05-26 Thread Joshua Wiley
Hi Eric,

Hopefully the following addresses your question:

library(XML)
## please do not include rm(list=ls()) in code other's might copy and paste
## it could remove things precious to them
url -
http://webapp.montcopa.org/sherreal/salelist.asp?saledate=05/25/2011;
tbl -data.frame(readHTMLTable(url))[2:404, c(3,5,6,8,9)]
## the ; you had was unnecessary since the code is on one line
names(tbl) - c(Address, Township, Parcel, SaleDate, Costs)
## a better way to reset row names
rownames(tbl) - NULL
## not sure why you made x, I did not
v - gregexpr(( aka )|( AKA ), tbl$Address)
## having simplified how v is referenced
## it is easy to see that you are doing something fundamentally different
## with sapply(), you are operating on unlist()ed v
## with the for loop, you are unlisting each element of v
## Note the slight differences between s, s2, v1,  v2
s - sapply(unlist(v), max)
s2 - sapply(v, function(x) max(unlist(x)))
v1 - numeric(length(v))
for(i in 1 :length(v)) v1[i] - max(unlist(v[i]))
v2 - numeric(length(unlist(v)))
for(i in 1:length(unlist(v))) v2[i] - max(unlist(v)[i])

all.equal(s, v1)
all.equal(s, v2)
all.equal(s2, v1)

## For your edification note the following
all.equal(c(1:length(tbl[,1])), 1:length(tbl[,1]))
all.equal(v[c(1:length(v))], v)
## given that both are the same, it is generally best
## to choose the simpler of the two, so
## 1:length(tbl[, 1]) and v, NOT
## c(1:length(tbl[, 1])) and v[c(1:length(v))]

HTH,

Josh


On Wed, May 25, 2011 at 9:49 PM, eric ericst...@aol.com wrote:
 Statement 9 using sapply does not seem to give the correct answer (or at
 least to me). Yet I do what I think is the same thing with statement 11 and
 I get the answer I'm looking for.

 9 : s -sapply(unlist(v[c(1:length(v))]), max)
 11: for(i in 1 :length(v)) v1[i] - max(unlist(v[i]))

 Shouldn't I get the same answer ?


 library(XML)
 rm(list=ls())
 url -
 http://webapp.montcopa.org/sherreal/salelist.asp?saledate=05/25/2011;
 tbl -data.frame(readHTMLTable(url))[2:404, c(3,5,6,8,9)]
 names(tbl) - c(Address, Township, Parcel, SaleDate, Costs);
 rownames(tbl) - c(1:length(tbl[,1]))
 x -tbl
 v - gregexpr(( aka )|( AKA ),x$Address)
 s -sapply(unlist(v[c(1:length(v))]), max)
 v1 -numeric(length(v))
 for(i in 1 :length(v)) v1[i] - max(unlist(v[i]))

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/What-am-I-doing-wrong-with-sapply-tp3551598p3551598.html
 Sent from the R help mailing list archive at Nabble.com.

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




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
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.


Re: [R] ordiellipse

2011-05-26 Thread Mark Difford
On May 26, 2011 Andrew Halford wrote:

 I am using ordiellipse to plot the ellipses and it works fine except one
 of my groups 
 contains only 2 sites and I cannot get an ellipse around them. I'm
 assuming 
 that 2 points is not enough to perform the relevant calculations here, 
 however I would like to plot one if I could, if only for the sake of 
 pictorial consistency.

Ouch! for the rod that is likely to come. Advice? Collect more data, for the
sake of pictorial consistency. And if you can't then you can't. What you
have are the (available) facts.

Regards, Mark.

-
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
--
View this message in context: 
http://r.789695.n4.nabble.com/ordiellipse-tp3551694p3551760.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] dataframe - column value calculation in R

2011-05-26 Thread Vijayan Padmanabhan
Dear RGroup
I have a requirement for which I am seeking help.
I am looking at automating the last column calculation through R when 
having the data of the other columns as a dataframe, In excel I can do 
using the formula function as given below, however, hereagain for the 
number of observations that come under control, I need to write the 
formula seperately for each cell and then I can block copy and paste to 
the rest of the data cells, however this can get tedious if there is too 
many observations.


Treatment
Candidate
Rep
L
a
b
Delta EcalculatedovercorrespondingcandidateandreplicateofControl
Control
1
1
23
3
2
=SQRT((D2-$D$2)*(D2-$D$2)+(E2-$E$2)*(E2-$E$2)+(F2-$F$2)*(F2-$F$2))
Control
1
2
25
2
1
=SQRT((D3-$D$3)*(D3-$D$3)+(E3-$E$3)*(E3-$E$3)+(F3-$F$3)*(F3-$F$3))
Control
2
1
27
1
3
=SQRT((D4-$D$4)*(D4-$D$4)+(E4-$E$4)*(E4-$E$4)+(F4-$F$4)*(F4-$F$4))
Control
2
2
29
3
1
=SQRT((D5-$D$5)*(D5-$D$5)+(E5-$E$5)*(E5-$E$5)+(F5-$F$5)*(F5-$F$5))
Treatment
1
1
25
2
2
=SQRT((D6-$D$2)*(D6-$D$2)+(E6-$E$2)*(E6-$E$2)+(F6-$F$2)*(F6-$F$2))
Treatment
1
2
27
3
5
=SQRT((D7-$D$3)*(D7-$D$3)+(E7-$E$3)*(E7-$E$3)+(F7-$F$3)*(F7-$F$3))
Treatment
2
1
29
2
2
=SQRT((D8-$D$4)*(D8-$D$4)+(E8-$E$4)*(E8-$E$4)+(F8-$F$4)*(F8-$F$4))
Treatment
2
2
30
3
2
=SQRT((D9-$D$5)*(D9-$D$5)+(E9-$E$5)*(E9-$E$5)+(F9-$F$5)*(F9-$F$5))
Treatment2
1
1
32
2
3
=SQRT((D10-$D$2)*(D10-$D$2)+(E10-$E$2)*(E10-$E$2)+(F10-$F$2)*(F10-$F$2))
Treatment2
1
2
35
1
3
=SQRT((D11-$D$3)*(D11-$D$3)+(E11-$E$3)*(E11-$E$3)+(F11-$F$3)*(F11-$F$3))
Treatment2
2
1
34
2
3
=SQRT((D12-$D$4)*(D12-$D$4)+(E12-$E$4)*(E12-$E$4)+(F12-$F$4)*(F12-$F$4))
Treatment2
2
2
28
2
1
=SQRT((D13-$D$5)*(D13-$D$5)+(E13-$E$5)*(E13-$E$5)+(F13-$F$5)*(F13-$F$5))


The result of the above formula call will give results in excel as below:


Treatment
Candidate
Rep
L
a
b
Delta EcalculatedovercorrespondingcandidateandreplicateofControl
Control
1
1
23
3
2
0
Control
1
2
25
2
1
0
Control
2
1
27
1
3
0
Control
2
2
29
3
1
0
Treatment
1
1
25
2
2
2.236067977
Treatment
1
2
27
3
5
4.582575695
Treatment
2
1
29
2
2
2.449489743
Treatment
2
2
30
3
2
1.414213562
Treatment2
1
1
32
2
3
9.110433579
Treatment2
1
2
35
1
3
10.24695077
Treatment2
2
1
34
2
3
7.071067812
Treatment2
2
2
28
2
1
1.414213562


Can someone help me figure out a way of acheiving this in R using a 
function call for the last column?
 Hope this example helps.


Regards
Vijayan Padmanabhan

Please visit us at www.itcportal.com
**
This Communication is for the exclusive use of the intended recipient (s) and 
shall
not attach any liability on the originator or ITC Ltd./its Subsidiaries/its 
Group 
Companies. If you are the addressee, the contents of this email are intended 
for your use only and it shall not be forwarded to any third party, without 
first obtaining written authorisation from the originator or ITC Ltd./its 
Subsidiaries/its Group Companies. It may contain information which is 
confidential and legally privileged and the same shall not be used or dealt 
with by any third party in any manner whatsoever without the specific consent 
of ITC Ltd./its Subsidiaries/its Group Companies.
[[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] dataframe - column value calculation in R

2011-05-26 Thread Timothy Bates

On 26 May 2011, at 08:02, Vijayan Padmanabhan wrote:
 I have a requirement for which I am seeking help.

Best to just ask, compactly. This is a very straightforward question: best to 
read on how to use R: You are just set 1 column of a dataframe to a value based 
on the others, applying this to all rows: This is just what R does by default

So you can solve your problem by extension from 

df$E = sqrt(df$A) + (df$B * df$D)


A B C D
1 2   3  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] Subtracting rows by id

2011-05-26 Thread Kenn Konstabel
Or without plyr:

# Dennis's sample data but with shortened names
ds - data.frame(id = rep(1:3, each = 10),
  value1 = sample(seq_len(100), 30, replace = TRUE))
k - data.frame(id = 1:3, sv = c(1, 3, 5))

do.call(rbind,
  mapply( function(a,b) subset(ds, id==a)[-1:-b,], k$id, k$sv,
SIMPLIFY=FALSE)
  )


On Wed, May 25, 2011 at 10:58 PM, Dennis Murphy djmu...@gmail.com wrote:
 Hi:

 Interesting problem. Here's one approach:

 library(plyr)
 # Read in your datasets as data frames rather than matrices
 dataset1 - data.frame(id1 = rep(1:3, each = 10),
                       value1 = sample(seq_len(100), 30, replace = TRUE))
 dataset2 - data.frame(id2 = 1:3, subtract.value = c(1, 3, 5))

 # The idea is to use the rows of dataset2 as parameters for
 # subsetting and removing the first n_i rows. The tail() function
 # serves the purpose:
 foo - function(id2, subtract.value) tail(subset(dataset1, id1 ==
 id2), -subtract.value)

 # Use the mdply function in the plyr package:
 mdply(dataset2, foo)[, -(1:2)]
   id1 value1
 1    1      2
 2    1     55
 3    1     18
 4    1      4
 5    1      3
 6    1     76
 7    1     74
 8    1     21
 9    1     97
 10   2     19
 11   2     49
 12   2     20
 13   2     73
 14   2     79
 15   2     95
 16   2     52
 17   3     60
 18   3     58
 19   3     68
 20   3     59
 21   3     13


 HTH,
 Dennis

 On Wed, May 25, 2011 at 9:55 AM, Sara Maxwell smaxw...@ucsc.edu wrote:
 Dear R users,

 I have two datasets:

 id1 - c(rep(1,10), rep(2,10), rep(3,10))
 value1 - sample(1:100, 30, replace=TRUE)
 dataset1 - cbind(id1,value1)

 id2 - c(1,2,3)
 subtract.value - c(1,3,5)
 dataset2 - cbind(id2, subtract.value)

 I want to subtract the number of rows in the subtract.value that
 corresponds to the id value in dataset1.  So for the 1 in id1, I want
 to remove the first row, for 2 in id1 I want to remove the first 3
 rows, for 3 in id1 I want to remove the first 5 rows, finally creating
 a new dataframe with the remaining values.

 I am having trouble structuring a loop that can do this by the unique
 ids in the first dataset while matching the ids in the datasets.

 Any thoughts would be greatly appreciated.

 Thank you,
 Sara


        [[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] R proxy settings for Mac

2011-05-26 Thread Marvin Mellem
Hi, 
 
I've read through the FAQs and in the R FAQ for Windows I found a
valuable section on how to configure R to work with a proxy server. A
colleague tested and confirms the solution works but now I have other
colleagues connecting via the same proxy server (requiring
authentication) using Apple Macs but in the Mac FAQ I don't see any
section on Mac proxy settings. Is there any support for this or has it
not been tested?
 
Regards, 
Marvin
 


 

###
UNIVERSITY OF CAPE TOWN 

This e-mail is subject to the UCT ICT policies and e-mai...{{dropped:16}}

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


Re: [R] [Fwd: Re: the mgcv package can not be loaded]

2011-05-26 Thread Simon Wood
the current version of nlme depends on R=2.13, according to CRAN. I 
would guess that this is the problem. So I think you'll either need to 
re-install an older R 2.12.2 compatible version of nlme, or upgrade R.



On 25/05/11 17:18, gbre...@ssc.wisc.edu wrote:

Sorry, I forgot to be more specific.

I am using Windows XP.

I am using R.12.2


I installed both packages from the install packages menu.

I always write library(name.of.library), and it is enough.

But when I write library(nlme), R does not find nlme right away

I load nlme first and it says package was downloaded succesfully.

However, when I try to do this again in another day, R cannot find nlme,
so I try to load mgcv with library(mgcv), then I get this message:

Error: package 'nlme' could not be loaded
In addition: Warning message:
In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc =
lib.loc) :
   there is no package called 'nlme'



Is there any problem with nlme that I need to install it every time I open R?


Gilbert




We really need some more information to be able to help you (as
requested in the posting guide):

What OS?
What version of R?

How did you install nlme? Were there any messages?

What happens when you type library(nlme) at the R prompt?

How did you install mgcv? Were there any messages?


On Wed, May 25, 2011 at 11:13 AM,gbre...@ssc.wisc.edu  wrote:

Hi.

I have been trying to load the mgcv package but I always get the error
message:

  there is no package called 'nlme'
Error: package/namespace load failed for 'mgcv'


I load the package nlme and still I get the same message.  I have
noticed
that there are some problems in using nlme in recent versions of R.  Is
there any suggestion or any special issue that I should know about nlme
or
mgcv?

Thanks


Gilbert



--
Sarah Goslee
http://www.functionaldiversity.org



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




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

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


Re: [R] problems getting the splm package installed

2011-05-26 Thread Uwe Ligges



On 26.05.2011 05:51, David Winsemius wrote:


On May 25, 2011, at 10:21 PM, Rafael Terra wrote:


Dear R-project members,


I'm a newbie in R and I'm trying to install the splm package to
analyze spatial panel data. I have the R x64 2.12.0 beta version
installed in my computer. When I try to install the package from
within R typing install.packages(splm,
repos=http://R-Forge.R-project.org;), I get the error message

Warning: unable to access index for repository
http://R-Forge.R-project.org/bin/windows/contrib/2.12


It's unable to find it because it's not there. Your version of R is out
of date and the only versions supported by packages at r-forge at the
moment are 2.13 and 2.14.





I don't know what to do to get this package installed. Sorry bothering
you with this, but I would appreciate very much a little help.


--##

PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html

--##


Right.

For older versions of R it is possible for the user to install the 
package from sources.


install.packages(splm, repos=http://R-Forge.R-project.org;, 
type=source)


should work (and the use may need the Rtools installed) . This is all 
documented in the manual R Installation and Administration.


Uwe Ligges




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


Re: [R] [Fwd: Re: the mgcv package can not be loaded]

2011-05-26 Thread Uwe Ligges



On 26.05.2011 10:57, Simon Wood wrote:

the current version of nlme depends on R=2.13, according to CRAN. I
would guess that this is the problem. So I think you'll either need to
re-install an older R 2.12.2 compatible version of nlme, or upgrade R.



Although upgrading is never a bad idea, this should not matter in this 
case: R-2.12.x for Windows will look into the 2.12 binary repository for 
Windows with the right version of nlme.


I suspect a broken installation of nlme in R's main library and that the 
re-installations go into another library or so.


But since we do not have any output of the install processes nor the 
currently available libraries on the search path etc. it is hard to know 
what is going on.


Uwe










On 25/05/11 17:18, gbre...@ssc.wisc.edu wrote:

Sorry, I forgot to be more specific.

I am using Windows XP.

I am using R.12.2


I installed both packages from the install packages menu.

I always write library(name.of.library), and it is enough.

But when I write library(nlme), R does not find nlme right away

I load nlme first and it says package was downloaded succesfully.

However, when I try to do this again in another day, R cannot find nlme,
so I try to load mgcv with library(mgcv), then I get this message:

Error: package 'nlme' could not be loaded
In addition: Warning message:
In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc =
lib.loc) :
there is no package called 'nlme'



Is there any problem with nlme that I need to install it every time I
open R?


Gilbert




We really need some more information to be able to help you (as
requested in the posting guide):

What OS?
What version of R?

How did you install nlme? Were there any messages?

What happens when you type library(nlme) at the R prompt?

How did you install mgcv? Were there any messages?


On Wed, May 25, 2011 at 11:13 AM,gbre...@ssc.wisc.edu wrote:

Hi.

I have been trying to load the mgcv package but I always get the error
message:

there is no package called 'nlme'
Error: package/namespace load failed for 'mgcv'


I load the package nlme and still I get the same message. I have
noticed
that there are some problems in using nlme in recent versions of R. Is
there any suggestion or any special issue that I should know about nlme
or
mgcv?

Thanks


Gilbert



--
Sarah Goslee
http://www.functionaldiversity.org



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






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


[R] Plot binomial regression line

2011-05-26 Thread Jörgen Svan
Dear all,

I am quite new with R and I have a problem with plotting a binomial
regression line in a plot.

This is what I type in:
 model-glm(Para~Size,binomial)
 par(mfrow=c(1,1))
 xv-seq(3.2,4.5,0.01)
 yv-predict(model,list(area=xv),type=response)
 plot(Size,Para)
 lines(xv,yv)

The error message that I get is:

 Error in xy.coords(x, y) : 'x' and 'y' lengths differ

My txt-file is attached. Could someone please help me to find out what I did
wrong.

Thank you on beforehand,
Jörgen
ParaSize
1   4.464285714
1   4.196428571
1   4.151785714
1   4.151785714
1   3.973214286
1   4.285714286
1   4.0625
1   4.241071429
1   4.0625
1   4.017857143
1   4.0625
1   4.017857143
1   4.241071429
1   4.151785714
1   4.0625
1   4.285714286
1   4.196428571
1   4.107142857
1   4.0625
1   4.330357143
1   4.375
1   4.196428571
1   4.196428571
1   3.928571429
1   4.0625
1   4.0625
1   4.107142857
1   4.196428571
1   3.928571429
1   4.151785714
1   3.705357143
1   3.75
1   4.107142857
1   3.839285714
1   3.616071429
1   4.0625
1   3.75
1   4.017857143
1   3.571428571
1   4.151785714
1   3.883928571
1   3.705357143
1   4.017857143
1   4.0625
1   4.0625
1   4.196428571
1   3.839285714
1   4.107142857
1   4.017857143
1   3.839285714
1   3.526785714
1   4.196428571
1   4.017857143
1   3.883928571
1   4.0625
1   4.107142857
1   4.285714286
1   3.928571429
1   3.794642857
1   4.107142857
1   4.107142857
1   3.839285714
1   4.241071429
1   4.285714286
1   4.375
0   4.115044248
0   3.495575221
0   4.203539823
0   3.982300885
0   4.026548673
0   4.07079646
0   3.805309735
0   4.07079646
0   3.982300885
0   4.247787611
0   4.203539823
0   3.982300885
0   3.849557522
0   4.115044248
0   3.849557522
0   4.07079646
0   4.203539823
0   3.849557522
0   4.247787611
0   4.026548673
0   4.07079646
0   4.203539823
0   4.026548673
0   3.982300885
0   4.026548673
0   3.584070796
0   4.026548673
0   3.982300885
0   3.761061947
0   3.230088496
0   3.495575221
0   3.982300885
0   3.938053097
0   3.849557522
0   3.982300885
0   3.849557522
0   4.026548673
0   3.938053097
0   4.159292035
0   3.849557522
0   4.026548673
0   3.672566372
0   4.159292035
0   3.761061947
0   4.247787611
0   4.115044248
0   3.539823009
0   3.89380531
0   4.115044248
0   3.849557522
0   4.115044248
0   4.115044248
0   4.07079646
0   3.584070796
0   3.407079646
0   4.203539823
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] document

2011-05-26 Thread rgui


Hi ,
 
that's what I did:
I am connected to internet
I selected the option choisir le site miroir de CRAN...a list of choices
comes I chose France (Toulouse), since it is the nearest to my country, but
an error message comes:

 Notification Message:
In open.connection (con, r):
   connection to 'cran.r-​​project.org impossible to port 80.

again, I have a problem in the download package ttda.zip for text mining in
R I do know that working with this package but it seems that this packge of
ttda.zip no longer used now with the new version s Rgui. is it possible to
find a solution how to download ttda.zip with R version 2.13.0.

well thanks for any suggestions
Rgui.

--
View this message in context: 
http://r.789695.n4.nabble.com/document-tp3546719p3551961.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] Strings from different locale

2011-05-26 Thread sunny

Phil Spector wrote:
 
 Steven -
 Does typing
 
 Sys.setlocale('LC_ALL','C')
 
 before the offending command suppress the message?
 
   - Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spec...@stat.berkeley.edu
 
 
 On Mon, 1 Nov 2010, steven mosher wrote:
 
 I'm doing some test processing of a cvs file that appears to use a
 different
 locale
 from my machine.

 I get the following warning:

 input string 1 is invalid in this locale

 My locale is US. Is this simply a matter of changing my locale to 'all;
 locales?

 I don't know what locale the string is in, is there a way to detect this
 or
 translate

 
Thanks! I was having a similar problem with some non-English characters
(such as the e-acute) causing memory corruption ('glibc detected' error)
upon using grep. Your solution makes it work fine.

-Sunny.

--
View this message in context: 
http://r.789695.n4.nabble.com/Strings-from-different-locale-tp3023176p3551974.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] document

2011-05-26 Thread Uwe Ligges



On 26.05.2011 10:42, rgui wrote:



Hi ,

that's what I did:
I am connected to internet
I selected the option choisir le site miroir de CRAN...a list of choices
comes I chose France (Toulouse), since it is the nearest to my country, but
an error message comes:


Notification Message:

In open.connection (con, r):
connection to 'cran.r-​​project.org impossible to port 80.



You are probably behind a proxy and failed to tell R about it - or the 
connection to CRAN master failed due to another problem.





again, I have a problem in the download package ttda.zip for text mining in
R I do know that working with this package but it seems that this packge of
ttda.zip no longer used now with the new version s Rgui. is it possible to
find a solution how to download ttda.zip with R version 2.13.0.


ttda is deprecated according to a quick Google search.

Uwe Ligges



well thanks for any suggestions
Rgui.

--
View this message in context: 
http://r.789695.n4.nabble.com/document-tp3546719p3551961.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] split data frame and manipulate

2011-05-26 Thread Mathew Brown

Hello,

I would like to split the attached data frame based on the DATE 
variable. I'm having a real problem doing this. I am able to split


iso-read.table(datuh.dat, header=TRUE, sep=, dec=.) #load
mylist=split(iso,iso$DATE) #split
str(mylist) #result seems a bit odd


However, after splitting I'm not able to call up certain variables of 
the two lists. For instance, this does not work

mylist$2011-05-25

Could anyone point suggest a way to do this. I want to be able to fully 
manipulate and plot variables from each of the resulting data frames.


Thanks,


DATE  TIME  FRAC_DAYS_SINCE_JAN1  
FRAC_HRS_SINCE_JAN1   EPOCH_TIMEALARM_STATUS  
CavityPressureCavityTempWarmBoxTemp   
DasTemp   EtalonTempMPVPosition   
OutletValve   ValveMask h2o_ppmv  
delta_18_16   delta_18_16_30s   delta_18_16_2min  
delta_18_16_5min  delta_D_H delta_D_H_30sec   
delta_D_H_2mindelta_D_H_5minorganic_82
organic_MeOHampl  organic_base  organic_c2h6conc  
organic_ch4conc   organic_res   organic_shift 
organic_slope organic_splinemax organic_squish
organic_y standard_base standard_residuals
n2_flag   
2011-05-1704:34:38.478  136.19072313  
3268.577355   1305578078.4790 
3.4988197140E+001 7.9992855518E+001 4.5000930239E+001 
4.287500E+001 4.4899361751E+001 0.00E+000 
3.4622264077E+004 0.00E+000 2.8088560421E+004 
-1.9467533827E+001-2.7893076931E+001-2.7743936767E+001
-2.7753529823E+001-1.2377256723E+0020.00E+000 
-9.5744106980E+001-9.5568392994E+001-4.4796408335E+001
6.3655609575E-003 1.1421008841E+003 0.00E+000 
6.4427827420E-003 1.4967341225E+001 -5.4285889258E-005
1.2185491102E+002 3.7705963994E+003 1.9097284875E-002 
1.0909446897E+000 1.1583693575E+003 5.1403883393E+000 
1.00E+000 
2011-05-1704:34:40.656  136.19074834  
3268.577960   1305578080.6570 
3.5005070265E+001 7.9991783142E+001 4.5000907898E+001 
4.287500E+001 4.4899406433E+001 0.00E+000 
3.4629223659E+004 0.00E+000 2.8092153488E+004 
-1.9244932987E+001-2.7902076424E+001-2.7748467245E+001
-2.7753748377E+001-1.2377134463E+0020.00E+000 
-9.5733066602E+001-9.5597052107E+001-4.6333695381E+001
6.0838715982E-003 1.1444241331E+003 0.00E+000 
6.9345887992E-003 1.4506769500E+001 -6.6888225576E-005
1.2425494753E+002 3.7718270556E+003 1.7754238929E-002 
1.0909413434E+000 1.1590081910E+003 5.2925204692E+000 
1.00E+000 
2011-05-1704:34:42.789  136.19077303  
3268.578553   1305578082.7900 
3.5011287214E+001 7.9991783142E+001 4.5000907898E+001 
4.287500E+001 4.4899406433E+001 0.00E+000 
3.4639727167E+004 0.00E+000 2.8092141828E+004 
-1.9135178021E+001-2.7910810452E+001-2.7754150771E+001
-2.7753942994E+001-1.2460876390E+0020.00E+000 
-9.5756653790E+001-9.5589107952E+001-4.5145515060E+001
5.7674651737E-003 1.1440425640E+003 0.00E+000 
6.8179220240E-003 1.6203128394E+001 -6.6248484141E-005
1.2677702864E+002 3.7737261955E+003 1.4980330424E-002 
1.0906977446E+000 1.1586517066E+003 5.1631797704E+000 
1.00E+000 
2011-05-1704:34:44.856  136.19079695  
3268.579127   1305578084.8570 
3.4991743440E+001 7.9992732066E+001 4.5000789282E+001 
4.287500E+001 4.4899453879E+001 0.00E+000 
3.4631112205E+004 0.00E+000 2.8078270782E+004 
-1.9441261828E+001-2.7912261440E+001-2.7768060260E+001
-2.7754924380E+001-1.2207858039E+002

Re: [R] Plot binomial regression line

2011-05-26 Thread Achim Zeileis

On Thu, 26 May 2011, Jörgen Svan wrote:


Dear all,

I am quite new with R and I have a problem with plotting a binomial
regression line in a plot.

This is what I type in:

model-glm(Para~Size,binomial)
par(mfrow=c(1,1))
xv-seq(3.2,4.5,0.01)
yv-predict(model,list(area=xv),type=response)
plot(Size,Para)
lines(xv,yv)


The error message that I get is:


Error in xy.coords(x, y) : 'x' and 'y' lengths differ


I assume that setting area is not correct.

My txt-file is attached. Could someone please help me to find out what I 
did wrong.


For a plain scatterplot you could do this:

## read data (and code Para as factor)
d - read.table(PerBinom.txt, header = TRUE)
d$Para - factor(d$Para)

## model fit and predicted probabilies
m - glm(Para ~ Size, data = d, family = binomial)
s - seq(3.2, 4.5, by = 0.1)
p - predict(m, data.frame(Size = s), type = response)

## scatterplot
plot(as.numeric(Para) - 1 ~ Size, data = d)
lines(p ~ s, col = 4)

A similar display can be obtained easily with the effects package:

library(effects)
plot(allEffects(m), ask = FALSE, rescale = FALSE)

which also works if there is more than one regressor. See 
http://www.jstatsoft.org/v08/i15/ and http://www.jstatsoft.org/v32/i01/ 
for more details about the effects package.


Finally, you could also use exploratory displays, e.g., a spinogram or a a 
conditional density plot:


cdplot(Para ~ Size, data = d, ylevels = 2:1)
plot(Para ~ Size, data = d, ylevels = 2:1)
plot(Para ~ Size, data = d, ylevels = 2:1, breaks = quantile(Size))

Adding a regression line to the latter is not completely straightforward 
due to the rescaled x axis. You could do something like this:


lines(sapply(s, function(x) mean(d$Size = x)), p, col = 4)

hth,
Z



Thank you on beforehand,
Jörgen
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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-2.10.1 to R-2.13.0

2011-05-26 Thread ogbos okike
Dear List,
I am currently running R-2.10.1. I wish to install R-2.13.0 or update my
R-2.10.1 to the R-2.13.0.

I have downloaded R-2.13.0 but wish to seek your advice before installing
that.

Please is there a better way of updating to the newer version other than
downloading and installing the version?
Thanks for your suggestions.
Ogbos

[[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] Plot binomial regression line

2011-05-26 Thread Uwe Ligges



On 26.05.2011 10:45, Jörgen Svan wrote:

Dear all,

I am quite new with R and I have a problem with plotting a binomial
regression line in a plot.

This is what I type in:

model-glm(Para~Size,binomial)
par(mfrow=c(1,1))
xv-seq(3.2,4.5,0.01)
yv-predict(model,list(area=xv),type=response)
plot(Size,Para)
lines(xv,yv)


Several things I'd improve, hence the whole code:

dat - read.table(clipboard, header=TRUE)
dat$Para - factor(dat$Para)
model - glm(Para ~ Size, data=dat, family=binomial)
xv - seq(3.2,4.5,0.01)
yv - predict(model, newdata=data.frame(Size=xv), type=response)
with(dat, plot(Size, as.integer(Para)-1))
lines(xv, yv)

Best,
Uwe Ligges




The error message that I get is:


Error in xy.coords(x, y) : 'x' and 'y' lengths differ


My txt-file is attached. Could someone please help me to find out what I did
wrong.

Thank you on beforehand,
Jörgen


PerBinom.txt


ParaSize
1   4.464285714
1   4.196428571
1   4.151785714
1   4.151785714
1   3.973214286
1   4.285714286
1   4.0625
1   4.241071429
1   4.0625
1   4.017857143
1   4.0625
1   4.017857143
1   4.241071429
1   4.151785714
1   4.0625
1   4.285714286
1   4.196428571
1   4.107142857
1   4.0625
1   4.330357143
1   4.375
1   4.196428571
1   4.196428571
1   3.928571429
1   4.0625
1   4.0625
1   4.107142857
1   4.196428571
1   3.928571429
1   4.151785714
1   3.705357143
1   3.75
1   4.107142857
1   3.839285714
1   3.616071429
1   4.0625
1   3.75
1   4.017857143
1   3.571428571
1   4.151785714
1   3.883928571
1   3.705357143
1   4.017857143
1   4.0625
1   4.0625
1   4.196428571
1   3.839285714
1   4.107142857
1   4.017857143
1   3.839285714
1   3.526785714
1   4.196428571
1   4.017857143
1   3.883928571
1   4.0625
1   4.107142857
1   4.285714286
1   3.928571429
1   3.794642857
1   4.107142857
1   4.107142857
1   3.839285714
1   4.241071429
1   4.285714286
1   4.375
0   4.115044248
0   3.495575221
0   4.203539823
0   3.982300885
0   4.026548673
0   4.07079646
0   3.805309735
0   4.07079646
0   3.982300885
0   4.247787611
0   4.203539823
0   3.982300885
0   3.849557522
0   4.115044248
0   3.849557522
0   4.07079646
0   4.203539823
0   3.849557522
0   4.247787611
0   4.026548673
0   4.07079646
0   4.203539823
0   4.026548673
0   3.982300885
0   4.026548673
0   3.584070796
0   4.026548673
0   3.982300885
0   3.761061947
0   3.230088496
0   3.495575221
0   3.982300885
0   3.938053097
0   3.849557522
0   3.982300885
0   3.849557522
0   4.026548673
0   3.938053097
0   4.159292035
0   3.849557522
0   4.026548673
0   3.672566372
0   4.159292035
0   3.761061947
0   4.247787611
0   4.115044248
0   3.539823009
0   3.89380531
0   4.115044248
0   3.849557522
0   4.115044248
0   4.115044248
0   4.07079646
0   3.584070796
0   3.407079646
0   4.203539823



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


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


Re: [R] R-2.10.1 to R-2.13.0

2011-05-26 Thread Duncan Murdoch

On 26/05/2011 6:02 AM, ogbos okike wrote:

Dear List,
I am currently running R-2.10.1. I wish to install R-2.13.0 or update my
R-2.10.1 to the R-2.13.0.

I have downloaded R-2.13.0 but wish to seek your advice before installing
that.

Please is there a better way of updating to the newer version other than
downloading and installing the version?
Thanks for your suggestions.


There is some advice on this in the Windows FAQ.  You can see the 
current version online at


http://cran.r-project.org/bin/windows/base/rw-FAQ.html#What_0027s-the-best-way-to-upgrade_003f

If you're not using Windows, most of the advice in that FAQ item is 
still good (though the paths  filenames will be different).


Duncan Murdoch

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


Re: [R] split data frame and manipulate

2011-05-26 Thread Uwe Ligges



On 26.05.2011 12:01, Mathew Brown wrote:

Hello,

I would like to split the attached data frame based on the DATE
variable. I'm having a real problem doing this. I am able to split

iso-read.table(datuh.dat, header=TRUE, sep=, dec=.) #load
mylist=split(iso,iso$DATE) #split
str(mylist) #result seems a bit odd


However, after splitting I'm not able to call up certain variables of
the two lists. For instance, this does not work
mylist$2011-05-25


2011-05-25 is not a regular name, hence quote it or use the safe

mylist[[2011-05-25]]

approach right away.

Uwe Ligges



Could anyone point suggest a way to do this. I want to be able to fully
manipulate and plot variables from each of the resulting data frames.

Thanks,



datuh.dat


DATE  TIME  FRAC_DAYS_SINCE_JAN1  
FRAC_HRS_SINCE_JAN1   EPOCH_TIMEALARM_STATUS  
CavityPressureCavityTempWarmBoxTemp   
DasTemp   EtalonTempMPVPosition   
OutletValve   ValveMask h2o_ppmv  
delta_18_16   delta_18_16_30s   delta_18_16_2min  
delta_18_16_5min  delta_D_H delta_D_H_30sec   
delta_D_H_2mindelta_D_H_5minorganic_82
organic_MeOHampl  organic_base  organic_c2h6conc  
organic_ch4conc   organic_res   organic_shift 
organic_slope organic_splinemax organic_squish
organic_y standard_base standard_residuals
n2_flag
2011-05-1704:34:38.478  136.19072313  
3268.577355   1305578078.4790 
3.4988197140E+001 7.9992855518E+001 4.5000930239E+001 
4.287500E+001 4.4899361751E+001 0.00E+000 
3.4622264077E+004 0.00E+000 2.8088560421E+004 
-1.9467533827E+001-2.7893076931E+001-2.7743936767E+001
-2.7753529823E+001-1.2377256723E+0020.00E+000 
-9.5744106980E+001-9.5568392994E+001-4.4796408335E+001
6.3655609575E-003 1.1421008841E+003 0.00E+000 
6.4427827420E-003 1.4967341225E+001 -5.4285889258E-005
1.2185491102E+002 3.7705963994E+003 1.9097284875E-002 
1.0909446897E+000 1.1583693575E+003 5.1403883393E+000 
1.00E+000
2011-05-1704:34:40.656  136.19074834  
3268.577960   1305578080.6570 
3.5005070265E+001 7.9991783142E+001 4.5000907898E+001 
4.287500E+001 4.4899406433E+001 0.00E+000 
3.4629223659E+004 0.00E+000 2.8092153488E+004 
-1.9244932987E+001-2.7902076424E+001-2.7748467245E+001
-2.7753748377E+001-1.2377134463E+0020.00E+000 
-9.5733066602E+001-9.5597052107E+001-4.6333695381E+001
6.0838715982E-003 1.1444241331E+003 0.00E+000 
6.9345887992E-003 1.4506769500E+001 -6.6888225576E-005
1.2425494753E+002 3.7718270556E+003 1.7754238929E-002 
1.0909413434E+000 1.1590081910E+003 5.2925204692E+000 
1.00E+000
2011-05-1704:34:42.789  136.19077303  
3268.578553   1305578082.7900 
3.5011287214E+001 7.9991783142E+001 4.5000907898E+001 
4.287500E+001 4.4899406433E+001 0.00E+000 
3.4639727167E+004 0.00E+000 2.8092141828E+004 
-1.9135178021E+001-2.7910810452E+001-2.7754150771E+001
-2.7753942994E+001-1.2460876390E+0020.00E+000 
-9.5756653790E+001-9.5589107952E+001-4.5145515060E+001
5.7674651737E-003 1.1440425640E+003 0.00E+000 
6.8179220240E-003 1.6203128394E+001 -6.6248484141E-005
1.2677702864E+002 3.7737261955E+003 1.4980330424E-002 
1.0906977446E+000 1.1586517066E+003 5.1631797704E+000 
1.00E+000
2011-05-1704:34:44.856  136.19079695  
3268.579127   1305578084.8570 
3.4991743440E+001 7.9992732066E+001 4.5000789282E+001 
4.287500E+001 4.4899453879E+001 0.00E+000 
3.4631112205E+004 0.00E+000 2.8078270782E+004 

[R] Using read.xls

2011-05-26 Thread vioravis
I am using read.xls command from the gdata package. I get the following error
when I try to read a work sheet from an excel sheet. 

Error in xls2sep(xls, sheet, verbose = verbose, ..., method = method,  : 
  Intermediate file 'C:\Tmp\RtmpYvLnAu\file7f06650f.csv' missing!
In addition: Warning message:
running command 'C:\Apps\Perl\bin\perl.exe C:/Program
Files/R/R-2.13.0/library/gdata/perl/xls2csv.pl excelFileName.xls
C:\Tmp\RtmpYvLnAu\file7f06650f.csv Test Sheet' had status 5 
Error in file.exists(tfn) : invalid 'file' argument

However, the same command works fine with another excel file stored in the
same directory. 

Could you please let me know what is causing this problem??

Thank you.

--
View this message in context: 
http://r.789695.n4.nabble.com/Using-read-xls-tp3552122p3552122.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] text mining

2011-05-26 Thread rgui
Hi,

how can I import a document whose type is. txt using the package tm?
it is the command to know that my document is not placed in the library
package tm.

thanks.

--
View this message in context: 
http://r.789695.n4.nabble.com/text-mining-tp3552221p3552221.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] Thiel's Uncertainty Coefficient

2011-05-26 Thread Marc Schwartz

On May 25, 2011, at 10:31 PM, Sparks, John James wrote:

 Dear R Helpers,
 
 I was looking at the email help threads in trying to find a calculation in
 R of Thiel's uncertainty coefficient.  One of the writers offered to send
 the function in custom code to the inquirer.  Can I get a copy of that
 code, or does anyone know if the calculation is now available in an R
 package?
 
 Please advise.  Many thanks.
 --John J. Sparks, Ph.D.


John,

The code file in question has been sent offlist to you.

Regards,

Marc Schwartz

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


[R] predictive accuracy

2011-05-26 Thread El-Tahtawy, Ahmed
I am trying to develop a prognostic model using logistic regression.   I
built a full , approximate models with the use of penalization - design
package. Also, I tried Chi-square criteria, step-down techniques. Used
BS for model validation. 

 

The main purpose is to develop a predictive model for future patient
population.   One of the strong predictor pertains to the study design
and would not mean much for a clinician/investigator in real clinical
situation and have been asked to remove it.

 

Can I propose a model and nomogram without that strong -irrelevant
predictor?? If yes, do I need to redo model calibration, discrimination,
validation, etc...?? or just have 5 predictors instead of 6 in the
prognostic model??

 

Thanks for your help

Al

.

 


[[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] Divide matrix into multiple smaller matrices

2011-05-26 Thread mdvaan
Hi list,

Using the script below, I have generated two lists (c and h) containing
yearly matrices. Now I would like to divide the matrices in c into multiple
matrices based on h. The number of matrices should be equal to:
length(unique(DF1$B))*length(h). So each unique value in DF1$B get's a
yearly matrix. Each matrix should contain all values from c where element
cij is 1. An example for DF1$B = 8025 in 1999:

   8025   8026  8027
8025 0. 0.27547644 0.06905066
8026 0.27547644 0. 0.10499739
8027 0.06905066 0.10499739 0.

Any ideas on how to tackle this problem? Thanks a lot!

library(zoo)

DF1 = data.frame(read.table(textConnection(B  C  D  E  F  G
8025  1995  0  4  1  2
8025  1997  1  1  3  4
8026  1995  0  7  0  0
8026  1996  1  2  3  0
8026  1997  1  2  3  1
8026  1998  6  0  0  4
8026  1999  3  7  0  3
8027  1997  1  2  3  9
8027  1998  1  2  3  1
8027  1999  6  0  0  2
8028  1999  3  7  0  0
8029  1995  0  2  3  3
8029  1998  1  2  3  2
8029  1999  6  0  0  1),head=TRUE,stringsAsFactors=FALSE)) # Where Column B
represents the cases, C is the year and D-G are the types of knowledge units
covered

a - read.zoo(DF1, split = 1, index = 2, FUN = identity)
sum.na - function(x) if (any(!is.na(x))) sum(x, na.rm = TRUE) else NA
b - rollapply(a, 3,  sum.na, align = right, partial = TRUE)
newDF - lapply(1:nrow(b), function(i)
   prop.table(na.omit(matrix(b[i,], nc = 4, byrow = TRUE,
   dimnames = list(unique(DF1$B), names(DF1)[-1:-2]))), 1))
names(newDF) - time(a)
c-lapply(newDF, function(mat) tcrossprod(mat / sqrt(rowSums(mat^2
c-lapply(c, function (x) 1-x)
c-lapply(c, function (x) ifelse(x0.00111, 0, x))# These are the yearly
distance matrices for a 4 year moving window

DF2 = data.frame(read.table(textConnection(  A  B  C
80  8025  1995
80  8026  1995
80  8029  1995
81  8026  1996
82  8025  1997
82  8026  1997
83  8025  1997
83  8027  1997
90  8026  1998
90  8027  1998
90  8029  1998
84  8026  1999
84  8027  1999
85  8028  1999
85  8029  1999),head=TRUE,stringsAsFactors=FALSE))

e - function(y) crossprod(table(DF2[DF2$C %in% y, 1:2])) 
years - sort(unique(DF2$C)) 
f - as.data.frame(embed(years, 3)) 
g-lapply(split(f, f[, 1]), e)
h-lapply(g, function (x) ifelse(x0,1,0))# These are the adjacency matrices
per year


--
View this message in context: 
http://r.789695.n4.nabble.com/Divide-matrix-into-multiple-smaller-matrices-tp3552399p3552399.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] R proxy settings for Mac

2011-05-26 Thread Marc Schwartz
On May 26, 2011, at 2:26 AM, Marvin Mellem wrote:

 Hi, 
 
 I've read through the FAQs and in the R FAQ for Windows I found a
 valuable section on how to configure R to work with a proxy server. A
 colleague tested and confirms the solution works but now I have other
 colleagues connecting via the same proxy server (requiring
 authentication) using Apple Macs but in the Mac FAQ I don't see any
 section on Mac proxy settings. Is there any support for this or has it
 not been tested?
 
 Regards, 
 Marvin

See this post by Prof. Ripley:

 http://tolstoy.newcastle.edu.au/R/e2/help/07/06/18009.html

HTH,

Marc Schwartz

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


Re: [R] likelihood ratio test

2011-05-26 Thread Ben Bolker
karuna m m_karuna2002 at yahoo.com writes:

 Can anybody tell me which R package has Lo-Mendell Rubin LR test and 
 Bootstrap 
 LR test to compare the model fit between k class and k+1 class model 
 for Latent class analysis?

  I don't know, but

library(sos)
findFn(Lo-Mendell)
findFn({latent class analysis})

  might help you track down the answers.

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


Re: [R] Time and db precision

2011-05-26 Thread Marc Schwartz

On May 25, 2011, at 6:25 PM, Mikkel Grum wrote:

 I have a loop that regularly checks for new data to analyse in my database. 
 In order to facilitate this, the database table has a timestamp column with 
 the time that the data was inserted into the database. Something like this:
 
 while () {
load(timetoken.Rdata)
df - sqlQuery(con, paste(SELECT * FROM tabledf WHERE timestamp  , 
 timetoken, sep = ))
analyse(df)
timetoken - max(df$timestamp)
save(timetoken, file = timetoken.Rdata)
Sys.sleep(60)
 }
 
 Now this used to work fairly well with R and PostgreSQL on Windows, but on 
 Ubuntu, I'm getting a lot of data being pulled up again and again. I suspect 
 what is happening is that R is rounding off to the nearest second, while 
 PostgreSQL is using a much higher level of precision, so that if no new data 
 has come in in the meantime, chances are fairly high (50% ??) that the 
 PostgreSQL timestamp is higher than the version that has been rounded off by 
 R.
 
 Is there any way of recording the timestamp in R exactly as it is in 
 PostgreSQL? Or is there another way of dealing with this??
 
 sessionInfo()
 R version 2.11.1 (2010-05-31)
 x86_64-pc-linux-gnu
 
 locale:
 [1] C
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base
 
 other attached packages:
 [1] RODBC_1.3-1
 
 All assistance greatly appreciated.
 
 Mikkel


This query is better suited for R-SIG-DB:

  https://stat.ethz.ch/mailman/listinfo/r-sig-db

That being said:

See ?POSIXct

Check the actual output of paste(SELECT * FROM tabledf WHERE timestamp  , 
timetoken, sep = ) to see what value 'timetoken' is actually taking as it is 
used in the query construct. As is noted in the above help file, be sure that 
options(digits.secs) is properly set, since the default will be to round 
printed output to the nearest second:

# A clean R session on OSX
 options(digits.secs)
$digits.secs
NULL

# return current date/time as POSIXct

 Sys.time()
[1] 2011-05-26 08:11:37 CDT

options(digits.secs = 6)

 Sys.time()
[1] 2011-05-26 08:12:07.080329 CDT


options(digits.secs = 0)

 paste(SELECT * FROM tabledf WHERE timestamp  , Sys.time(), sep = )
[1] SELECT * FROM tabledf WHERE timestamp  2011-05-26 08:15:02
 
options(digits.secs = 6)

 paste(SELECT * FROM tabledf WHERE timestamp  , Sys.time(), sep = )
[1] SELECT * FROM tabledf WHERE timestamp  2011-05-26 08:15:12.005103


HTH,

Marc Schwartz

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


Re: [R] predictive accuracy

2011-05-26 Thread Claudia Beleites

Al,

I'd redo everything and report in the paper that your peculiar predictor 
was contributing strongly to models that were built without excluding 
this predictor. This is an important information: your models get 
confused by the predictor (I'd consider this a lack of a certain kind 
of robustness, but I'm not a statistician).


HTH

Claudia

Am 26.05.2011 14:42, schrieb El-Tahtawy, Ahmed:

I am trying to develop a prognostic model using logistic regression.   I
built a full , approximate models with the use of penalization - design
package. Also, I tried Chi-square criteria, step-down techniques. Used
BS for model validation.



The main purpose is to develop a predictive model for future patient
population.   One of the strong predictor pertains to the study design
and would not mean much for a clinician/investigator in real clinical
situation and have been asked to remove it.



Can I propose a model and nomogram without that strong -irrelevant
predictor?? If yes, do I need to redo model calibration, discrimination,
validation, etc...?? or just have 5 predictors instead of 6 in the
prognostic model??



Thanks for your help

Al

.




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



--
Claudia Beleites
Spectroscopy/Imaging
Institute of Photonic Technology
Albert-Einstein-Str. 9
07745 Jena
Germany

email: claudia.belei...@ipht-jena.de
phone: +49 3641 206-133
fax:   +49 2641 206-399

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


Re: [R] Thiessen Method

2011-05-26 Thread Sarah Goslee
Federico,

You've asked this a couple times. Did you try to find the answer yourself?

If you search at rseek.org for Thiessen or Voronoi several functions
appear that should do what you need.

You didn't tell us anything about your data, so there's no possible
way we can provide more specific advice.

Sarah

On Wed, May 25, 2011 at 6:04 PM, federico eccel
federico.ec...@gmail.com wrote:
 Dear Users,

 I would like to know if any of you know some R packages for appling the
 Thiessen method; in my case I would like to interpolete with this method
 some rain gauges.

 Tanks a lot

-- 
Sarah Goslee
http://www.functionaldiversity.org

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


Re: [R] R-2.10.1 to R-2.13.0

2011-05-26 Thread ogbos okike
Hi Duncan,
Thanks for your time.
Using ./configure as specified in the installation manual, I attempted to
install R-2.13.0 but it reported an error message:

checking for IceConnectionNumber in -lICE... no
checking X11/Intrinsic.h usability... no
checking X11/Intrinsic.h presence... no
checking for X11/Intrinsic.h... no
configure: error: --with-x=yes (default) and X11 headers/libs are not
available

Could you please advise further. I am attempting this for the first time on
my laptop (ubuntu os).
Regards
Ogbos


On 26 May 2011 12:45, Duncan Murdoch murdoch.dun...@gmail.com wrote:

 On 26/05/2011 6:02 AM, ogbos okike wrote:

 Dear List,
 I am currently running R-2.10.1. I wish to install R-2.13.0 or update my
 R-2.10.1 to the R-2.13.0.

 I have downloaded R-2.13.0 but wish to seek your advice before installing
 that.

 Please is there a better way of updating to the newer version other than
 downloading and installing the version?
 Thanks for your suggestions.


 There is some advice on this in the Windows FAQ.  You can see the current
 version online at


 http://cran.r-project.org/bin/windows/base/rw-FAQ.html#What_0027s-the-best-way-to-upgrade_003f

 If you're not using Windows, most of the advice in that FAQ item is still
 good (though the paths  filenames will be different).

 Duncan Murdoch



[[alternative HTML version deleted]]

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


Re: [R] R-2.10.1 to R-2.13.0

2011-05-26 Thread Steve Lianoglou
Hi,

On Thu, May 26, 2011 at 10:05 AM, ogbos okike ogbos.ok...@gmail.com wrote:
 Hi Duncan,
 Thanks for your time.
 Using ./configure as specified in the installation manual, I attempted to
 install R-2.13.0 but it reported an error message:

 checking for IceConnectionNumber in -lICE... no
 checking X11/Intrinsic.h usability... no
 checking X11/Intrinsic.h presence... no
 checking for X11/Intrinsic.h... no
 configure: error: --with-x=yes (default) and X11 headers/libs are not
 available

 Could you please advise further. I am attempting this for the first time on
 my laptop (ubuntu os).

Can you just follow the instructions here:

http://cran.cnr.berkeley.edu/bin/linux/ubuntu/

And use the apt-get mechanism to install R instead of compiling it yourself?

I'm guessing it'd make your life a bit easier.

-steve

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

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


Re: [R] R-2.10.1 to R-2.13.0

2011-05-26 Thread Duncan Murdoch

On 26/05/2011 10:05 AM, ogbos okike wrote:

Hi Duncan,
Thanks for your time.
Using ./configure as specified in the installation manual, I attempted to
install R-2.13.0 but it reported an error message:

checking for IceConnectionNumber in -lICE... no
checking X11/Intrinsic.h usability... no
checking X11/Intrinsic.h presence... no
checking for X11/Intrinsic.h... no
configure: error: --with-x=yes (default) and X11 headers/libs are not
available

Could you please advise further. I am attempting this for the first time on
my laptop (ubuntu os).


I don't use Ubuntu, but that looks as though you don't have the 
development headers for X11 available.


The usual advice I've seen on this is to install an Ubuntu binary rather 
than building yourself, but I don't remember the details of where to get 
it (and I don't remember how to get the X11 headers you need).


Duncan Murdoch


Regards
Ogbos


On 26 May 2011 12:45, Duncan Murdochmurdoch.dun...@gmail.com  wrote:

  On 26/05/2011 6:02 AM, ogbos okike wrote:

  Dear List,
  I am currently running R-2.10.1. I wish to install R-2.13.0 or update my
  R-2.10.1 to the R-2.13.0.

  I have downloaded R-2.13.0 but wish to seek your advice before installing
  that.

  Please is there a better way of updating to the newer version other than
  downloading and installing the version?
  Thanks for your suggestions.


  There is some advice on this in the Windows FAQ.  You can see the current
  version online at


  
http://cran.r-project.org/bin/windows/base/rw-FAQ.html#What_0027s-the-best-way-to-upgrade_003f

  If you're not using Windows, most of the advice in that FAQ item is still
  good (though the paths  filenames will be different).

  Duncan Murdoch





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


Re: [R] stepwise selection cox model

2011-05-26 Thread linda Porz
Sorry, my question was: Are these two functions (Stata and fastbw
(rule=p)  R function) should give the same results to the same data? Maybe
I need to run these two functions on more than one datasets to answer
myself.

Many thanks,
Linda

2011/5/25 David Winsemius dwinsem...@comcast.net


 On May 25, 2011, at 12:11 PM, linda Porz wrote:

  Many thanks for your reply. I have run a stepwise selection in Stata and R
 using the function fastbw (rule=p) from Design package. Both functions
 give the same results. Is this because both functions do the same job or can
 it be that for different data one will have different results?


 I don't understand your question. Why would giving the same results be a
 concern? And why would one expect that with different data one would _not_
 get different results? The point of the critique against stepwise procedures
 is that they assume too much determinism (i.e. that all of the internal
 structure of the small sample of data will be present in the wider universe)
 and that they generate too much confidence on the part of the unwary and
 insufficiently educated user.

 --
 David.



 Many thanks,
 Linda



 2011/5/25 Bert Gunter gunter.ber...@gene.com
 See the Vignette in the glmnet package for one alternative approach to
 variable selection. Of course, you need to gain some background to
 know what you're doing here.

 -- Bert

 On Wed, May 25, 2011 at 8:38 AM, Marc Schwartz marc_schwa...@me.com
 wrote:
  Hi,
 
  You are unlikely to find one, as fundamentally, stepwise procedures are
 a bad way to engage in covariate selection. Search the list archives at
 rseek.org using 'stepwise' as the keyword to see a plethora of discussion
 on this point.
 
  This is not a new issue BTW, as I happened to stumble upon this 1998
 Stata FAQ recently during a related search:
 
   http://www.stata.com/support/faqs/stat/stepwise.html
 
  and there are more recent literature citations and books that reinforce
 those points.
 
  HTH,
 
  Marc Schwartz
 
  On May 25, 2011, at 4:28 AM, linda Porz wrote:
 
  Sorry, I have wrote a wrong subject in the first email!
 
  Regards,
  Linda
 
  -- Forwarded message --
  From: linda Porz linda.p...@gmail.com
  Date: 2011/5/25
  Subject: combined odds ratio
  To: r-help@r-project.org
  Cc: r-help-requ...@stat.math.ethz.ch
 
 
  Dear all,
 
  I am looking for an R function which does stepwise selection cox model
 in r
  (delta chisq likelihood ratio test) similar to the stepwise, pe (0.05)
 lr:
  stcox in STATA.
 
  I am very thankful for any reply.
 
  Regards,
  Linda
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 



 --
 Men by nature long to get on to the ultimate truths, and will often
 be impatient with elementary studies or fight shy of them. If it were
 possible to reach the ultimate truths without the elementary studies
 usually prefixed to them, these would not be preparatory studies but
 superfluous diversions.

 -- Maimonides (1135-1204)

 Bert Gunter
 Genentech Nonclinical Biostatistics


 David Winsemius, MD
 West Hartford, CT



[[alternative HTML version deleted]]

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


Re: [R] About Tinn-R

2011-05-26 Thread PereiraGA
Hello JCFaria,

I have the same problem Tinn-R (Marcos' problem), and your comments help me. 

tanks

PereiraGA

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

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


Re: [R] R-2.10.1 to R-2.13.0

2011-05-26 Thread ogbos okike
Hi Steve,
Many thanks.

I added :deb http://cran.at.r-project.org/bin/linux/ubuntu lucid/ in my
source.list and then tried sudo apt-get update. The last lines of the result
says:
Reading package lists... Done
W: GPG error: http://cran.at.r-project.org lucid/ Release: The following
signatures couldn't be verified because the public key is not available:
NO_PUBKEY 51716619E084DAB9

I am in south africa. I looked at the cran mirrors, there is no south
africa. I chose Australia.
Thanks for more help.
Regards
Ogbos

On 26 May 2011 16:13, Steve Lianoglou mailinglist.honey...@gmail.comwrote:

 Hi,

 On Thu, May 26, 2011 at 10:05 AM, ogbos okike ogbos.ok...@gmail.com
 wrote:
  Hi Duncan,
  Thanks for your time.
  Using ./configure as specified in the installation manual, I attempted to
  install R-2.13.0 but it reported an error message:
 
  checking for IceConnectionNumber in -lICE... no
  checking X11/Intrinsic.h usability... no
  checking X11/Intrinsic.h presence... no
  checking for X11/Intrinsic.h... no
  configure: error: --with-x=yes (default) and X11 headers/libs are not
  available
 
  Could you please advise further. I am attempting this for the first time
 on
  my laptop (ubuntu os).

 Can you just follow the instructions here:

 http://cran.cnr.berkeley.edu/bin/linux/ubuntu/

 And use the apt-get mechanism to install R instead of compiling it
 yourself?

 I'm guessing it'd make your life a bit easier.

 -steve

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


[[alternative HTML version deleted]]

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


Re: [R] R-2.10.1 to R-2.13.0

2011-05-26 Thread Hugo Mildenberger
Ogbos,

I don't use Ubunto too, but X-11 headers should be installable running 

   apt-get xorg-dev

and/or (possibly)  

   apt-get  libx11-dev xlibs-dev

Best


On Thursday 26 May 2011 16:13:36 Duncan Murdoch wrote:
 On 26/05/2011 10:05 AM, ogbos okike wrote:
  Hi Duncan,
  Thanks for your time.
  Using ./configure as specified in the installation manual, I attempted to
  install R-2.13.0 but it reported an error message:
 
  checking for IceConnectionNumber in -lICE... no
  checking X11/Intrinsic.h usability... no
  checking X11/Intrinsic.h presence... no
  checking for X11/Intrinsic.h... no
  configure: error: --with-x=yes (default) and X11 headers/libs are not
  available
 
  Could you please advise further. I am attempting this for the first time on
  my laptop (ubuntu os).
 
 I don't use Ubuntu, but that looks as though you don't have the 
 development headers for X11 available.
 
 The usual advice I've seen on this is to install an Ubuntu binary rather 
 than building yourself, but I don't remember the details of where to get 
 it (and I don't remember how to get the X11 headers you need).
 
 Duncan Murdoch
 
  Regards
  Ogbos
 
 
  On 26 May 2011 12:45, Duncan Murdochmurdoch.dun...@gmail.com  wrote:
 
On 26/05/2011 6:02 AM, ogbos okike wrote:
  
Dear List,
I am currently running R-2.10.1. I wish to install R-2.13.0 or update my
R-2.10.1 to the R-2.13.0.
  
I have downloaded R-2.13.0 but wish to seek your advice before 
   installing
that.
  
Please is there a better way of updating to the newer version other than
downloading and installing the version?
Thanks for your suggestions.
  
  
There is some advice on this in the Windows FAQ.  You can see the current
version online at
  
  

   http://cran.r-project.org/bin/windows/base/rw-FAQ.html#What_0027s-the-best-way-to-upgrade_003f
  
If you're not using Windows, most of the advice in that FAQ item is still
good (though the paths  filenames will be different).
  
Duncan Murdoch
  
  
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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

2011-05-26 Thread Nordlund, Dan (DSHS/RDA)
 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of ogbos okike
 Sent: Thursday, May 26, 2011 7:42 AM
 To: Steve Lianoglou
 Cc: r-help@r-project.org
 Subject: Re: [R] R-2.10.1 to R-2.13.0
 
 Hi Steve,
 Many thanks.
 
 I added :deb http://cran.at.r-project.org/bin/linux/ubuntu lucid/ in my
 source.list and then tried sudo apt-get update. The last lines of the
 result
 says:
 Reading package lists... Done
 W: GPG error: http://cran.at.r-project.org lucid/ Release: The
 following
 signatures couldn't be verified because the public key is not
 available:
 NO_PUBKEY 51716619E084DAB9
 
 I am in south africa. I looked at the cran mirrors, there is no south
 africa. I chose Australia.
 Thanks for more help.
 Regards
 Ogbos
 
 On 26 May 2011 16:13, Steve Lianoglou
 mailinglist.honey...@gmail.comwrote:
 
  Hi,
 
  On Thu, May 26, 2011 at 10:05 AM, ogbos okike ogbos.ok...@gmail.com
  wrote:
   Hi Duncan,
   Thanks for your time.
   Using ./configure as specified in the installation manual, I
 attempted to
   install R-2.13.0 but it reported an error message:
  
   checking for IceConnectionNumber in -lICE... no
   checking X11/Intrinsic.h usability... no
   checking X11/Intrinsic.h presence... no
   checking for X11/Intrinsic.h... no
   configure: error: --with-x=yes (default) and X11 headers/libs are
 not
   available
  
   Could you please advise further. I am attempting this for the first
 time
  on
   my laptop (ubuntu os).
 
  Can you just follow the instructions here:
 
  http://cran.cnr.berkeley.edu/bin/linux/ubuntu/
 
  And use the apt-get mechanism to install R instead of compiling it
  yourself?
 
  I'm guessing it'd make your life a bit easier.
 
  -steve
 
  --
  Steve Lianoglou
  Graduate Student: Computational Systems Biology
   | Memorial Sloan-Kettering Cancer Center
   | Weill Medical College of Cornell University
  Contact Info: http://cbio.mskcc.org/~lianos/contact
 
 
   [[alternative HTML version deleted]]
 

Well, it looks like you didn't read far enough in the instructions that you 
were pointed towards.  Read the section on Secure APT.

Hope this is helpful,

Dan

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


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


Re: [R] R-2.10.1 to R-2.13.0

2011-05-26 Thread Steve Lianoglou
Hi,

On Thu, May 26, 2011 at 10:42 AM, ogbos okike ogbos.ok...@gmail.com wrote:
 Hi Steve,
 Many thanks.

 I added :deb http://cran.at.r-project.org/bin/linux/ubuntu lucid/ in my
 source.list and then tried sudo apt-get update. The last lines of the result
 says:
 Reading package lists... Done
 W: GPG error: http://cran.at.r-project.org lucid/ Release: The following
 signatures couldn't be verified because the public key is not available:
 NO_PUBKEY 51716619E084DAB9

 I am in south africa. I looked at the cran mirrors, there is no south
 africa. I chose Australia.

In that cran/ubuntu page, there is a section entitled SECURE APT
which talks about doing some gpg key juggling .. did you do that part?

Also -- you might consider posting to the r-sig-debian list:
https://stat.ethz.ch/mailman/listinfo/r-sig-debian

if things start getting *really* out of control, though I suspect
you're quite close to a solution now ... :-)

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

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


Re: [R] predictive accuracy

2011-05-26 Thread Marc Schwartz

On May 26, 2011, at 7:42 AM, El-Tahtawy, Ahmed wrote:

 I am trying to develop a prognostic model using logistic regression.   I
 built a full , approximate models with the use of penalization - design
 package. Also, I tried Chi-square criteria, step-down techniques. Used
 BS for model validation. 
 
 
 
 The main purpose is to develop a predictive model for future patient
 population.   One of the strong predictor pertains to the study design
 and would not mean much for a clinician/investigator in real clinical
 situation and have been asked to remove it.
 
 
 
 Can I propose a model and nomogram without that strong -irrelevant
 predictor?? If yes, do I need to redo model calibration, discrimination,
 validation, etc...?? or just have 5 predictors instead of 6 in the
 prognostic model??
 
 
 
 Thanks for your help
 
 Al


Is it that the study design characteristic would not make sense to a clinician 
but is relevant to future samples, or that the study design characteristic is 
unique to the sample upon which the model was developed and is not relevant to 
future samples because they will not be in the same or a similar study?

Is the study design characteristic a surrogate for other factors that would be 
relevant to future samples? If so, you might engage in a conversation with the 
clinicians to gain some insights into other variables to consider for inclusion 
in the model, that might in turn, help to explain the effect of the study 
design variable.

Either way, if the covariate is removed, you of course need to engage in fully 
re-evaluating the model. You cannot just drop the covariate and continue to use 
model fit assessments made on the full model.

HTH,

Marc Schwartz

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


[R] table of Design regressions?

2011-05-26 Thread David Hugh-Jones
Hi all

Just a quick question which I can't find an answer for in the usual places:
I would like to create a table of regression output, with one or more
regressions in the columns, a la xtable. But I am using models from the
Design package. Is there anything out there that will play nicely with that?
xtable doesn't seem to do the trick.

Cheers,
David Hugh-Jones
Research Associate
CAGE, Department of Economics
University of Warwick
http://davidhughjones.googlepages.com

[[alternative HTML version deleted]]

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


Re: [R] Time and db precision

2011-05-26 Thread Mikkel Grum
Thanks Marc,

I had just come up with another, slightly more convoluted solution. Add as.is = 
TRUE to the query and then get the timetoken with
  timetoken - df$timestamp[df$timestamp == max(as.POSIX(df$timestamp))]

While it looks like options(digits.secs = 6) works, I worry that theoretically 
it just pushes the problem down to another level of decimal points. With the 
solution above, I apparently get the exact same value that was in the database.

Interestingly, 
  timetoken - max(as.POSIX(df$timestamp))
does not appear to give me the same result.

Demo:
 a - 2011-05-25 22:15:11.027116000
 b - 2011-05-25 22:15:11.027117000
 c - 2011-05-25 22:15:11.027118000
 d - c(a, b, c)
 d
[1] 2011-05-25 22:15:11.027116000 2011-05-25 22:15:11.027117000 2011-05-25 
22:15:11.027118000
 d[d == max(as.POSIXct(d))]
[1] 2011-05-25 22:15:11.027118000
 max(as.POSIXct(d))
[1] 2011-05-25 22:15:11 COT


--- On Thu, 5/26/11, Marc Schwartz marc_schwa...@me.com wrote:

 From: Marc Schwartz marc_schwa...@me.com
 Subject: Re: [R] Time and db precision
 To: Mikkel Grum mi2kelg...@yahoo.com
 Cc: R Help r-help@r-project.org
 Date: Thursday, May 26, 2011, 8:22 AM
 
 On May 25, 2011, at 6:25 PM, Mikkel Grum wrote:
 
  I have a loop that regularly checks for new data to
 analyse in my database. In order to facilitate this, the
 database table has a timestamp column with the time that the
 data was inserted into the database. Something like this:
  
  while () {
     load(timetoken.Rdata)
     df - sqlQuery(con, paste(SELECT *
 FROM tabledf WHERE timestamp  , timetoken, sep = ))
     analyse(df)
     timetoken - max(df$timestamp)
     save(timetoken, file =
 timetoken.Rdata)
     Sys.sleep(60)
  }
  
  Now this used to work fairly well with R and
 PostgreSQL on Windows, but on Ubuntu, I'm getting a lot of
 data being pulled up again and again. I suspect what is
 happening is that R is rounding off to the nearest second,
 while PostgreSQL is using a much higher level of precision,
 so that if no new data has come in in the meantime, chances
 are fairly high (50% ??) that the PostgreSQL timestamp is
 higher than the version that has been rounded off by R.
  
  Is there any way of recording the timestamp in R
 exactly as it is in PostgreSQL? Or is there another way of
 dealing with this??
  
  sessionInfo()
  R version 2.11.1 (2010-05-31)
  x86_64-pc-linux-gnu
  
  locale:
  [1] C
  
  attached base packages:
  [1] stats     graphics 
 grDevices utils     datasets 
 methods   base
  
  other attached packages:
  [1] RODBC_1.3-1
  
  All assistance greatly appreciated.
  
  Mikkel
 
 
 This query is better suited for R-SIG-DB:
 
   https://stat.ethz.ch/mailman/listinfo/r-sig-db
 
 That being said:
 
 See ?POSIXct
 
 Check the actual output of paste(SELECT * FROM tabledf
 WHERE timestamp  , timetoken, sep = ) to see what
 value 'timetoken' is actually taking as it is used in the
 query construct. As is noted in the above help file, be sure
 that options(digits.secs) is properly set, since the
 default will be to round printed output to the nearest
 second:
 
 # A clean R session on OSX
  options(digits.secs)
 $digits.secs
 NULL
 
 # return current date/time as POSIXct
 
  Sys.time()
 [1] 2011-05-26 08:11:37 CDT
 
 options(digits.secs = 6)
 
  Sys.time()
 [1] 2011-05-26 08:12:07.080329 CDT
 
 
 options(digits.secs = 0)
 
  paste(SELECT * FROM tabledf WHERE timestamp  ,
 Sys.time(), sep = )
 [1] SELECT * FROM tabledf WHERE timestamp  2011-05-26
 08:15:02
  
 options(digits.secs = 6)
 
  paste(SELECT * FROM tabledf WHERE timestamp  ,
 Sys.time(), sep = )
 [1] SELECT * FROM tabledf WHERE timestamp  2011-05-26
 08:15:12.005103
 
 
 HTH,
 
 Marc Schwartz
 


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


[R] JGR/Deducer Installation

2011-05-26 Thread Vikas Garud
Hi,

Sorry if this is to wrong mailing list.  In that case, please point me
to correct mailing list.

Please also excuse rather long mail - I am not sure what piece of
information would be useful for anybody who could help me.

Couple of days back I had put a query about box-plots using GUI.  I
got some excellent suggestions.  One of them was to use JGR/Deducer.
It worked quite well for my needs.
Couple of days back there was a large on-line update in the system (I
use SuSE 11.4)  and JGR stopped working.  I tried uninstall/reinstall
of R, R-Devel, Java, from the SuSE repositories.  The versions are:

R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)

Java: (All softwares, and their versions, installed from Java group)
ant  | 1.8.2-21.1
ant-antlr  | 1.8.2-21.1
ant-apache-bcel  | 1.8.2-21.1
ant-apache-bsf  | 1.8.2-21.1
ant-apache-log4j  | 1.8.2-21.1
ant-apache-oro  | 1.8.2-21.1
ant-apache-regexp  | 1.8.2-21.1
ant-apache-resolver  | 1.8.2-21.1
ant-commons-logging  | 1.8.2-21.1
ant-javadoc  | 1.8.2-21.1
ant-javamail  | 1.8.2-21.1
ant-jdepend  | 1.8.2-21.1
ant-jmf  | 1.8.2-21.1
ant-junit  | 1.8.2-21.1
ant-manual  | 1.8.2-21.1
ant-scripts  | 1.8.2-21.1
ant-swing  | 1.8.2-21.1
geronimo-j2ee-1_4-apis  | 1.2-11.5
jakarta-commons-logging  | 1.0.4-637.1
java-1_5_0-gcj-compat-devel  | 1.5.0.0-128.4
java-1_6_0-openjdk  | 1.6.0.0_b20.1.9.7-1.2.1
java-1_6_0-openjdk-devel  | 1.6.0.0_b20.1.9.7-1.2.1
java-1_6_0-openjdk-plugin  | 1.6.0.0_b20.1.9.7-1.2.1
javacc  | 4.0-226.1
jdepend  | 2.9.1-153.1
log4j  | 1.2.15-217.6
patterns-openSUSE-devel_java  | 11.4-6.9.1
xalan-j2  | 2.7.0-250.2
xerces-j2  | 2.8.1-247.3
xerces-j2-xml-apis  | 2.8.1-247.3
xerces-j2-xml-resolver  | 2.8.1-459.1
xml-commons-jaxp-1.1-apis  | 1.3.04-285.1
xml-commons-jaxp-1.3-apis  | 1.3.04-285.1
xml-commons-which10  | 1.3.04-285.1

Is anything missing?  Anything that should not be installed? Perhaps a
different version?

The messages while installing JGR are as follows

 install.packages (pkgs=c (JGR), 
 lib=/home/vikas/R/i686-pc-linux-gnu-library/2.13, dependencies=TRUE)

also installing the dependencies ‘rJava’, ‘JavaGD’, ‘iplots’
* installing *source* package ‘rJava’ ...
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver: '/usr/bin/jar'
compiler: '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags   : '-I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0/jre/../include
-I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0/jre/../include/linux'
java libs   : '-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0/jre/lib/i386/server
-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0/jre/lib/i386
-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0/jre/../lib/i386
-L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -ljvm'
checking whether JNI programs can be compiled... yes
checking JNI data types...
configure: error: One or more JNI types differ from the corresponding
native type. You may need to use non-standard compiler flags or a
different compiler in order to fix this.

ERROR: configuration failed for package ‘rJava’

* removing ‘/home/vikas/R/i686-pc-linux-gnu-library/2.13/rJava’

* installing *source* package ‘JavaGD’ ...
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C 

Re: [R] Compiling Rgraphiz on Windows 7 64bit with R-2.13.0

2011-05-26 Thread jirivoller
Hello,
This tread helped me to finally move somewhere with rgraphviz installation. 
But it seems there is a problem with vignette creation.   I have the same
configuration as Ben (Win7 -64bit,R-2.13.0, Rtools version
2.13.0.1901,graphviz from goodies) and did the changes suggested by Martin.
The package version is Rgraphviz_1.30.1.tar.gz.
Is there some solution? Thank you.

* checking for file '.\Rgraphviz/DESCRIPTION' ... OK
* preparing 'Rgraphviz':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to re-build vignettes
* creating vignettes ... ERROR
Loading required package: graph
Loading required package: grid
Warning in sub(object$syntax$docexpr, val, chunk[pos[1L]]) :
  argument 'replacement' has length  1 and only the first element will be
used
Error in texi2dvi(file = bft, pdf = TRUE, clean = FALSE, quiet = quiet) : 
  pdflatex is not available
Calls: Anonymous - texi2dvi
Execution halted


R version 2.13.0 (2011-04-13)
Platform: x86_64-pc-mingw32/x64 (64-bit)





--
View this message in context: 
http://r.789695.n4.nabble.com/Compiling-Rgraphiz-on-Windows-7-64bit-with-R-2-13-0-tp3493750p3552698.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] Using read.xls

2011-05-26 Thread Marc Schwartz

On May 26, 2011, at 5:09 AM, vioravis wrote:

 I am using read.xls command from the gdata package. I get the following error
 when I try to read a work sheet from an excel sheet. 
 
 Error in xls2sep(xls, sheet, verbose = verbose, ..., method = method,  : 
  Intermediate file 'C:\Tmp\RtmpYvLnAu\file7f06650f.csv' missing!
 In addition: Warning message:
 running command 'C:\Apps\Perl\bin\perl.exe C:/Program
 Files/R/R-2.13.0/library/gdata/perl/xls2csv.pl excelFileName.xls
 C:\Tmp\RtmpYvLnAu\file7f06650f.csv Test Sheet' had status 5 
 Error in file.exists(tfn) : invalid 'file' argument
 
 However, the same command works fine with another excel file stored in the
 same directory. 
 
 Could you please let me know what is causing this problem??
 
 Thank you.


It looks like the intermediate CSV file is not being created. read.xls() works 
by extracting the data from the Excel file worksheet, using a Perl script to 
dump it to a CSV file and then using read.csv() to get the data into R. It is 
essentially a reversal of the process that I use in WriteXLS() in the CRAN 
package of the same name.

For some reason, that intermediate CSV file is not being created, possibly 
because the worksheet you are referencing does not exist, is corrupted or there 
is some other conflict. Presumably, it is not a permissions issue, if you can 
use read.xls() on a different XLS file.

Check the XLS file that you are attempting to use and be sure that you can open 
it properly and that you are passing the correct worksheet identifier.  Also, 
as I am thinking about it, I believe that read.xls() is not set up to handle 
XLSX files, so be sure that this is not the case. If so, you will need to 
re-save the file to an XLS format file.

HTH,

Marc Schwartz

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


[R] Plotting device does not show all graphs

2011-05-26 Thread John S
Dear All,

I am creating 4 plots (files) but I could see only 3. Here is a simple code

 d=data.frame(age=rnorm(100,40,8),ht=rnorm(100,170,15))

tiff(file=paste(test,%03d,.tif,sep=))

hist.data.frame(d)

datadensity(d)

par(mfrow=c(1,2),mar=c(3,3,3,3))

boxplot(d$age)

hist(age)

dev.off()



PDF works fine but png and tiff seems to miss the second graph. I must be
missing something
Thanks!!!

[[alternative HTML version deleted]]

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


Re: [R] table of Design regressions?

2011-05-26 Thread Marc Schwartz
On May 26, 2011, at 10:01 AM, David Hugh-Jones wrote:

 Hi all
 
 Just a quick question which I can't find an answer for in the usual places:
 I would like to create a table of regression output, with one or more
 regressions in the columns, a la xtable. But I am using models from the
 Design package. Is there anything out there that will play nicely with that?
 xtable doesn't seem to do the trick.


Frank has the latex() function in Hmisc, which has methods for many of the 
objects that Design may create.

Also, note that Design has been supplanted by 'rms', so be sure to update your 
local installation accordingly.

If your output is the result of consolidating multiple such outputs, xtable() 
has a matrix method and a data frame method, whereby you could create the 
appropriate object as needed and then use xtable() on that.

HTH,

Marc Schwartz

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


Re: [R] Using read.xls

2011-05-26 Thread Jonathan Daily
Another workaround if you don't need to batch the process up is to
highlight the cells of the excel file in question, copy it to the
clipboard, and use read.table(clipboard).

I also use this often when people pass me huge, unwieldy excel files
that have multiple sets of data, summaries, formula, (usually) bad
plots, etc. all on the same page.

HTH,
Jon

On Thu, May 26, 2011 at 11:09 AM, Marc Schwartz marc_schwa...@me.com wrote:

 On May 26, 2011, at 5:09 AM, vioravis wrote:

 I am using read.xls command from the gdata package. I get the following error
 when I try to read a work sheet from an excel sheet.

 Error in xls2sep(xls, sheet, verbose = verbose, ..., method = method,  :
  Intermediate file 'C:\Tmp\RtmpYvLnAu\file7f06650f.csv' missing!
 In addition: Warning message:
 running command 'C:\Apps\Perl\bin\perl.exe C:/Program
 Files/R/R-2.13.0/library/gdata/perl/xls2csv.pl excelFileName.xls
 C:\Tmp\RtmpYvLnAu\file7f06650f.csv Test Sheet' had status 5
 Error in file.exists(tfn) : invalid 'file' argument

 However, the same command works fine with another excel file stored in the
 same directory.

 Could you please let me know what is causing this problem??

 Thank you.


 It looks like the intermediate CSV file is not being created. read.xls() 
 works by extracting the data from the Excel file worksheet, using a Perl 
 script to dump it to a CSV file and then using read.csv() to get the data 
 into R. It is essentially a reversal of the process that I use in WriteXLS() 
 in the CRAN package of the same name.

 For some reason, that intermediate CSV file is not being created, possibly 
 because the worksheet you are referencing does not exist, is corrupted or 
 there is some other conflict. Presumably, it is not a permissions issue, if 
 you can use read.xls() on a different XLS file.

 Check the XLS file that you are attempting to use and be sure that you can 
 open it properly and that you are passing the correct worksheet identifier.  
 Also, as I am thinking about it, I believe that read.xls() is not set up to 
 handle XLSX files, so be sure that this is not the case. If so, you will need 
 to re-save the file to an XLS format file.

 HTH,

 Marc Schwartz

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




-- 
===
Jon Daily
Technician
===
#!/usr/bin/env outside
# It's great, trust me.

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


Re: [R] Compiling Rgraphiz on Windows 7 64bit with R-2.13.0

2011-05-26 Thread Duncan Murdoch

On 26/05/2011 10:25 AM, jirivoller wrote:

Hello,
This tread helped me to finally move somewhere with rgraphviz installation.
But it seems there is a problem with vignette creation.   I have the same
configuration as Ben (Win7 -64bit,R-2.13.0, Rtools version
2.13.0.1901,graphviz from goodies) and did the changes suggested by Martin.
The package version is Rgraphviz_1.30.1.tar.gz.
Is there some solution? Thank you.

* checking for file '.\Rgraphviz/DESCRIPTION' ... OK
* preparing 'Rgraphviz':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to re-build vignettes
* creating vignettes ... ERROR
Loading required package: graph
Loading required package: grid
Warning in sub(object$syntax$docexpr, val, chunk[pos[1L]]) :
   argument 'replacement' has length  1 and only the first element will be
used
Error in texi2dvi(file = bft, pdf = TRUE, clean = FALSE, quiet = quiet) :
   pdflatex is not available
Calls:Anonymous  -  texi2dvi
Execution halted


From the error message, it looks as though this isn't really anything 
to do with Rgraphviz, it's your tex installation that isn't working.  
However, that might be misleading:  there was a bug in 2.13.0 that made 
system() sometimes fail.  The current R-patched should fix that.


So I'd check that pdflatex works as a command with the path you're 
using.  If not, install MikTeX or some other tex version.  If so, then 
it's probably a problem in R:  so install R-patched.


If neither of those suggestions work, then I guess you'll have to do 
some debugging on your own...


Duncan Murdoch

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


[R] 3 Y axis possible?

2011-05-26 Thread Jun Shen
Dear list,

We have three time course profiles with very different scales, and we want
to show them in one plot. Is it possible to have three y axis? I guess not,
then what would be other options? something like two 2-y axis plots on a
three dimensional view? Appreciate any comment.

Jun Shen

[[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] Using read.xls

2011-05-26 Thread Gabor Grothendieck
On Thu, May 26, 2011 at 11:09 AM, Marc Schwartz marc_schwa...@me.com wrote:

 On May 26, 2011, at 5:09 AM, vioravis wrote:

 I am using read.xls command from the gdata package. I get the following error
 when I try to read a work sheet from an excel sheet.

 Error in xls2sep(xls, sheet, verbose = verbose, ..., method = method,  :
  Intermediate file 'C:\Tmp\RtmpYvLnAu\file7f06650f.csv' missing!
 In addition: Warning message:
 running command 'C:\Apps\Perl\bin\perl.exe C:/Program
 Files/R/R-2.13.0/library/gdata/perl/xls2csv.pl excelFileName.xls
 C:\Tmp\RtmpYvLnAu\file7f06650f.csv Test Sheet' had status 5
 Error in file.exists(tfn) : invalid 'file' argument

 However, the same command works fine with another excel file stored in the
 same directory.

 Could you please let me know what is causing this problem??

 Thank you.


 It looks like the intermediate CSV file is not being created. read.xls() 
 works by extracting the data from the Excel file worksheet, using a Perl 
 script to dump it to a CSV file and then using read.csv() to get the data 
 into R. It is essentially a reversal of the process that I use in WriteXLS() 
 in the CRAN package of the same name.

 For some reason, that intermediate CSV file is not being created, possibly 
 because the worksheet you are referencing does not exist, is corrupted or 
 there is some other conflict. Presumably, it is not a permissions issue, if 
 you can use read.xls() on a different XLS file.

 Check the XLS file that you are attempting to use and be sure that you can 
 open it properly and that you are passing the correct worksheet identifier.  
 Also, as I am thinking about it, I believe that read.xls() is not set up to 
 handle XLSX files, so be sure that this is not the case. If so, you will need 
 to re-save the file to an XLS format file.


read.xls in gdata does handle both xls and xlsx files in the current
CRAN version.


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

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


Re: [R] Plotting device does not show all graphs

2011-05-26 Thread Sarah Goslee
Well, when I try to run your sample code, I get one figure and a bunch
of error messages.

How about an actual executable example and the requested basic
information on your OS, version of R, etc? That would make it a lot
easier to offer useful suggestions (by which I mean possible).

 d=data.frame(age=rnorm(100,40,8),ht=rnorm(100,170,15))

 tiff(file=paste(test,%03d,.tif,sep=))

 hist.data.frame(d)
Error: could not find function hist.data.frame

 datadensity(d)
Error: could not find function datadensity

 par(mfrow=c(1,2),mar=c(3,3,3,3))

 boxplot(d$age)

 hist(age)
Error in hist(age) : object 'age' not found

 dev.off()
null device
  1

I get a boxplot only.

Can you actually run this code without error messages? Even if you
have loaded whatever library the missing plot functions came from,
hist(age) is not going to create a plot, thus you would only ever get
three files.

Sarah

On Thu, May 26, 2011 at 11:23 AM, John S john.smith...@gmail.com wrote:
 Dear All,

 I am creating 4 plots (files) but I could see only 3. Here is a simple code

  d=data.frame(age=rnorm(100,40,8),ht=rnorm(100,170,15))

 tiff(file=paste(test,%03d,.tif,sep=))

 hist.data.frame(d)

 datadensity(d)

 par(mfrow=c(1,2),mar=c(3,3,3,3))

 boxplot(d$age)

 hist(age)

 dev.off()



 PDF works fine but png and tiff seems to miss the second graph. I must be
 missing something
 Thanks!!!


-- 
Sarah Goslee
http://www.functionaldiversity.org

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


Re: [R] 3 Y axis possible?

2011-05-26 Thread jim holtman
There is nothing to prevent you from putting 3 y-axis on your plot;
might be confusing, but it can be done.  What have you tried and why
do you say guess not?  With the use of par(new=TRUE) or by doing
your own scaling, you can use 'axis' to put as many axises as you want
on your graph.

On Thu, May 26, 2011 at 11:35 AM, Jun Shen jun.shen...@gmail.com wrote:
 Dear list,

 We have three time course profiles with very different scales, and we want
 to show them in one plot. Is it possible to have three y axis? I guess not,
 then what would be other options? something like two 2-y axis plots on a
 three dimensional view? Appreciate any comment.

 Jun Shen

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




-- 
Jim Holtman
Data Munger Guru

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] Using read.xls

2011-05-26 Thread Marc Schwartz
On May 26, 2011, at 10:16 AM, Gabor Grothendieck wrote:

 On Thu, May 26, 2011 at 11:09 AM, Marc Schwartz marc_schwa...@me.com wrote:
 
 On May 26, 2011, at 5:09 AM, vioravis wrote:
 
 I am using read.xls command from the gdata package. I get the following 
 error
 when I try to read a work sheet from an excel sheet.
 
 Error in xls2sep(xls, sheet, verbose = verbose, ..., method = method,  :
  Intermediate file 'C:\Tmp\RtmpYvLnAu\file7f06650f.csv' missing!
 In addition: Warning message:
 running command 'C:\Apps\Perl\bin\perl.exe C:/Program
 Files/R/R-2.13.0/library/gdata/perl/xls2csv.pl excelFileName.xls
 C:\Tmp\RtmpYvLnAu\file7f06650f.csv Test Sheet' had status 5
 Error in file.exists(tfn) : invalid 'file' argument
 
 However, the same command works fine with another excel file stored in the
 same directory.
 
 Could you please let me know what is causing this problem??
 
 Thank you.
 
 
 It looks like the intermediate CSV file is not being created. read.xls() 
 works by extracting the data from the Excel file worksheet, using a Perl 
 script to dump it to a CSV file and then using read.csv() to get the data 
 into R. It is essentially a reversal of the process that I use in WriteXLS() 
 in the CRAN package of the same name.
 
 For some reason, that intermediate CSV file is not being created, possibly 
 because the worksheet you are referencing does not exist, is corrupted or 
 there is some other conflict. Presumably, it is not a permissions issue, if 
 you can use read.xls() on a different XLS file.
 
 Check the XLS file that you are attempting to use and be sure that you can 
 open it properly and that you are passing the correct worksheet identifier.  
 Also, as I am thinking about it, I believe that read.xls() is not set up to 
 handle XLSX files, so be sure that this is not the case. If so, you will 
 need to re-save the file to an XLS format file.
 
 
 read.xls in gdata does handle both xls and xlsx files in the current
 CRAN version.


Thanks for the clarification Gabor. Upon further review, it appears that one 
might have to run installXLSXsupport() in the gdata package in order to support 
that capability, if the user's Perl installation does not already provide that 
support by default.

The gdata helper function xlsFormats() can be used to test that.

This issue may or may not be germane to the OP.

Cheers,

Marc

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


Re: [R] 3 Y axis possible?

2011-05-26 Thread Jun Shen
Hi, Jim,

Thanks for the information. But I am still not clear how to show the 3
separated Y axis. If I just call par(new=TRUE), the three axes are
overlapped.

attached some test data. Thanks.

Jun
=

structure(list(Time = 1:10, y1 = c(1000, 900, 810, 729, 656.1,
590.49, 531.441, 478.2969, 430.46721, 387.420489), y2 = c(10,
8, 6.4, 5.12, 4.096, 3.2768, 2.62144, 2.097152, 1.6777216, 1.34217728
), y3 = c(0.1, 0.075, 0.05625, 0.0421875, 0.031640625, 0.02373046875,
0.0177978515625, 0.013348388671875, 0.0100112915039063, 0.00750846862792969
)), .Names = c(Time, y1, y2, y3), class = data.frame, row.names =
c(NA,
-10L))

On Thu, May 26, 2011 at 10:49 AM, jim holtman jholt...@gmail.com wrote:

 There is nothing to prevent you from putting 3 y-axis on your plot;
 might be confusing, but it can be done.  What have you tried and why
 do you say guess not?  With the use of par(new=TRUE) or by doing
 your own scaling, you can use 'axis' to put as many axises as you want
 on your graph.

 On Thu, May 26, 2011 at 11:35 AM, Jun Shen jun.shen...@gmail.com wrote:
  Dear list,
 
  We have three time course profiles with very different scales, and we
 want
  to show them in one plot. Is it possible to have three y axis? I guess
 not,
  then what would be other options? something like two 2-y axis plots on a
  three dimensional view? Appreciate any comment.
 
  Jun Shen
 
 [[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.
 



 --
 Jim Holtman
 Data Munger Guru

 What is the problem that you are trying to solve?


[[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] 3 Y axis possible?

2011-05-26 Thread jim holtman
Try this:

plot(x$Time, x$y1, type='l', bty = 'c', col = 'red')
par(new = TRUE)
plot(x$Time, x$y2, type = 'l', axes = FALSE, xlab = '', ylab = '', col
= 'green')
axis(4, col='green')
par(new = TRUE)
plot(x$Time, x$y3, type = 'l', axes = FALSE, xlab = '', ylab = '', col = 'blue')
axis(4, col='blue', line = -3)


You have to not plot the axises on the secondary plots.

On Thu, May 26, 2011 at 12:11 PM, Jun Shen jun.shen...@gmail.com wrote:
 Hi, Jim,

 Thanks for the information. But I am still not clear how to show the 3
 separated Y axis. If I just call par(new=TRUE), the three axes are
 overlapped.

 attached some test data. Thanks.

 Jun
 =

 structure(list(Time = 1:10, y1 = c(1000, 900, 810, 729, 656.1,
 590.49, 531.441, 478.2969, 430.46721, 387.420489), y2 = c(10,
 8, 6.4, 5.12, 4.096, 3.2768, 2.62144, 2.097152, 1.6777216, 1.34217728
 ), y3 = c(0.1, 0.075, 0.05625, 0.0421875, 0.031640625, 0.02373046875,
 0.0177978515625, 0.013348388671875, 0.0100112915039063, 0.00750846862792969
 )), .Names = c(Time, y1, y2, y3), class = data.frame, row.names =
 c(NA,
 -10L))

 On Thu, May 26, 2011 at 10:49 AM, jim holtman jholt...@gmail.com wrote:

 There is nothing to prevent you from putting 3 y-axis on your plot;
 might be confusing, but it can be done.  What have you tried and why
 do you say guess not?  With the use of par(new=TRUE) or by doing
 your own scaling, you can use 'axis' to put as many axises as you want
 on your graph.

 On Thu, May 26, 2011 at 11:35 AM, Jun Shen jun.shen...@gmail.com wrote:
  Dear list,
 
  We have three time course profiles with very different scales, and we
  want
  to show them in one plot. Is it possible to have three y axis? I guess
  not,
  then what would be other options? something like two 2-y axis plots on a
  three dimensional view? Appreciate any comment.
 
  Jun Shen
 
         [[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.
 



 --
 Jim Holtman
 Data Munger Guru

 What is the problem that you are trying to solve?





-- 
Jim Holtman
Data Munger Guru

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] matrix not working

2011-05-26 Thread Dat Mai
Hello All,

I'm trying to create a matrix from a dataframe (let's call it df):
..a..b.c.d
a   inputs  output
b   inputs  output
c   inputs  output
d   inputs  output
e   inputs  output

The inputs are represented by columns a and b
The outputs are represented by columns c and d, but the only outputs are
those from column d
- some values from column d are NA
- column d was created with the code:

df$d=rank(df$c, na.last=keep)

#--R Code-#
item=unique(df$a)
n=length(list)

r=matrix(data=NA,nrow=n, ncol=n, dimnames=list(PRR1=item, PRR2=item))

for(j in 2:ln)
{
  for(i in 1:(j-1))
  {
input1=rownames(r)[i]
input2=colnames(r)[j]

q=df[(df$a==input1  df$b==input2), d]

if(length(q)==0)
{
  q=df[(df$a==input2  df$b==input1), d]
}

if(length(q)==0)
{
  q=NA
}

r[j,i]=q
r[i,j]=q
r[j,j]=q
  }
}

The result is a matrix with the appropriate dimensions, but everything is
filled with NA instead of the rankings of the various combinations. I'd like
for the matrix to be filled with the ranking values--what have I done wrong?
-- 
Best,
Dat Mai
PhD Rotation Student
Albert Einstein College of Medicine

[[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] 3 Y axis possible?

2011-05-26 Thread Jun Shen
Hi, jim

That's exactly what I wanted. One more trivial thing. How do I get rid the
border line on the top? Thanks again.

Jun

On Thu, May 26, 2011 at 11:20 AM, jim holtman jholt...@gmail.com wrote:

 Try this:

 plot(x$Time, x$y1, type='l', bty = 'c', col = 'red')
 par(new = TRUE)
 plot(x$Time, x$y2, type = 'l', axes = FALSE, xlab = '', ylab = '', col
 = 'green')
 axis(4, col='green')
 par(new = TRUE)
 plot(x$Time, x$y3, type = 'l', axes = FALSE, xlab = '', ylab = '', col =
 'blue')
 axis(4, col='blue', line = -3)


 You have to not plot the axises on the secondary plots.

 On Thu, May 26, 2011 at 12:11 PM, Jun Shen jun.shen...@gmail.com wrote:
  Hi, Jim,
 
  Thanks for the information. But I am still not clear how to show the 3
  separated Y axis. If I just call par(new=TRUE), the three axes are
  overlapped.
 
  attached some test data. Thanks.
 
  Jun
  =
 
  structure(list(Time = 1:10, y1 = c(1000, 900, 810, 729, 656.1,
  590.49, 531.441, 478.2969, 430.46721, 387.420489), y2 = c(10,
  8, 6.4, 5.12, 4.096, 3.2768, 2.62144, 2.097152, 1.6777216, 1.34217728
  ), y3 = c(0.1, 0.075, 0.05625, 0.0421875, 0.031640625, 0.02373046875,
  0.0177978515625, 0.013348388671875, 0.0100112915039063,
 0.00750846862792969
  )), .Names = c(Time, y1, y2, y3), class = data.frame, row.names
 =
  c(NA,
  -10L))
 
  On Thu, May 26, 2011 at 10:49 AM, jim holtman jholt...@gmail.com
 wrote:
 
  There is nothing to prevent you from putting 3 y-axis on your plot;
  might be confusing, but it can be done.  What have you tried and why
  do you say guess not?  With the use of par(new=TRUE) or by doing
  your own scaling, you can use 'axis' to put as many axises as you want
  on your graph.
 
  On Thu, May 26, 2011 at 11:35 AM, Jun Shen jun.shen...@gmail.com
 wrote:
   Dear list,
  
   We have three time course profiles with very different scales, and we
   want
   to show them in one plot. Is it possible to have three y axis? I guess
   not,
   then what would be other options? something like two 2-y axis plots on
 a
   three dimensional view? Appreciate any comment.
  
   Jun Shen
  
  [[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.
  
 
 
 
  --
  Jim Holtman
  Data Munger Guru
 
  What is the problem that you are trying to solve?
 
 



 --
 Jim Holtman
 Data Munger Guru

 What is the problem that you are trying to solve?


[[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] Time and db precision

2011-05-26 Thread Marc Schwartz
On May 26, 2011, at 10:04 AM, Mikkel Grum wrote:

 Thanks Marc,
 
 I had just come up with another, slightly more convoluted solution. Add as.is 
 = TRUE to the query and then get the timetoken with
  timetoken - df$timestamp[df$timestamp == max(as.POSIX(df$timestamp))]
 
 While it looks like options(digits.secs = 6) works, I worry that 
 theoretically it just pushes the problem down to another level of decimal 
 points. With the solution above, I apparently get the exact same value that 
 was in the database.
 
 Interestingly, 
  timetoken - max(as.POSIX(df$timestamp))
 does not appear to give me the same result.
 
 Demo:
 a - 2011-05-25 22:15:11.027116000
 b - 2011-05-25 22:15:11.027117000
 c - 2011-05-25 22:15:11.027118000
 d - c(a, b, c)
 d
 [1] 2011-05-25 22:15:11.027116000 2011-05-25 22:15:11.027117000 
 2011-05-25 22:15:11.027118000
 d[d == max(as.POSIXct(d))]
 [1] 2011-05-25 22:15:11.027118000
 max(as.POSIXct(d))
 [1] 2011-05-25 22:15:11 COT


Hi Mikkel,

From what I can tell, PostgreSQL stores timestamp data with millisecond 
precision:

  http://wiki.postgresql.org/wiki/Working_with_Dates_and_Times_in_PostgreSQL

So 6 decimal place precision in R should be more than sufficient.


You have a similar problem in your last example here:

# This is returning the indexed value in the original character vector 'd'
# not the coerced POSIXct object. So you get the original quoted string, 
# including the irrelevant trailing 0's

 d[d == max(as.POSIXct(d))]
[1] 2011-05-25 22:15:11.027118000


# Now you are printing POSIXct objects, which have the same limitation as I 
raised earlier:

 max(as.POSIXct(d))
[1] 2011-05-25 22:15:11 CDT

options(digits.secs = 6)

 max(as.POSIXct(d))
[1] 2011-05-25 22:15:11.027118 CDT


This is the classic problem of differentiating between how R is storing the 
data internally and how R *prints* the data to the console via various default 
formatting options.

Regards,

Marc

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


Re: [R] 3 Y axis possible?

2011-05-26 Thread Jun Shen
I just found out by setting bty='l' to get rid of the border line on the
top.

On Thu, May 26, 2011 at 11:41 AM, Jun Shen jun.shen...@gmail.com wrote:

 Hi, jim

 That's exactly what I wanted. One more trivial thing. How do I get rid the
 border line on the top? Thanks again.

 Jun


 On Thu, May 26, 2011 at 11:20 AM, jim holtman jholt...@gmail.com wrote:

 Try this:

 plot(x$Time, x$y1, type='l', bty = 'c', col = 'red')
 par(new = TRUE)
 plot(x$Time, x$y2, type = 'l', axes = FALSE, xlab = '', ylab = '', col
 = 'green')
 axis(4, col='green')
 par(new = TRUE)
 plot(x$Time, x$y3, type = 'l', axes = FALSE, xlab = '', ylab = '', col =
 'blue')
 axis(4, col='blue', line = -3)


 You have to not plot the axises on the secondary plots.

 On Thu, May 26, 2011 at 12:11 PM, Jun Shen jun.shen...@gmail.com wrote:
  Hi, Jim,
 
  Thanks for the information. But I am still not clear how to show the 3
  separated Y axis. If I just call par(new=TRUE), the three axes are
  overlapped.
 
  attached some test data. Thanks.
 
  Jun
 
 =
 
  structure(list(Time = 1:10, y1 = c(1000, 900, 810, 729, 656.1,
  590.49, 531.441, 478.2969, 430.46721, 387.420489), y2 = c(10,
  8, 6.4, 5.12, 4.096, 3.2768, 2.62144, 2.097152, 1.6777216, 1.34217728
  ), y3 = c(0.1, 0.075, 0.05625, 0.0421875, 0.031640625, 0.02373046875,
  0.0177978515625, 0.013348388671875, 0.0100112915039063,
 0.00750846862792969
  )), .Names = c(Time, y1, y2, y3), class = data.frame,
 row.names =
  c(NA,
  -10L))
 
  On Thu, May 26, 2011 at 10:49 AM, jim holtman jholt...@gmail.com
 wrote:
 
  There is nothing to prevent you from putting 3 y-axis on your plot;
  might be confusing, but it can be done.  What have you tried and why
  do you say guess not?  With the use of par(new=TRUE) or by doing
  your own scaling, you can use 'axis' to put as many axises as you want
  on your graph.
 
  On Thu, May 26, 2011 at 11:35 AM, Jun Shen jun.shen...@gmail.com
 wrote:
   Dear list,
  
   We have three time course profiles with very different scales, and we
   want
   to show them in one plot. Is it possible to have three y axis? I
 guess
   not,
   then what would be other options? something like two 2-y axis plots
 on a
   three dimensional view? Appreciate any comment.
  
   Jun Shen
  
  [[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.
  
 
 
 
  --
  Jim Holtman
  Data Munger Guru
 
  What is the problem that you are trying to solve?
 
 



 --
 Jim Holtman
 Data Munger Guru

 What is the problem that you are trying to solve?




[[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] 3 Y axis possible?

2011-05-26 Thread Jun Shen
Jim,

One more question, how do I put a label on the axes I added? Thanks. I don't
see any argument in axis() for that? Thanks

Jun

On Thu, May 26, 2011 at 11:20 AM, jim holtman jholt...@gmail.com wrote:

 Try this:

 plot(x$Time, x$y1, type='l', bty = 'c', col = 'red')
 par(new = TRUE)
 plot(x$Time, x$y2, type = 'l', axes = FALSE, xlab = '', ylab = '', col
 = 'green')
 axis(4, col='green')
 par(new = TRUE)
 plot(x$Time, x$y3, type = 'l', axes = FALSE, xlab = '', ylab = '', col =
 'blue')
 axis(4, col='blue', line = -3)


 You have to not plot the axises on the secondary plots.

 On Thu, May 26, 2011 at 12:11 PM, Jun Shen jun.shen...@gmail.com wrote:
  Hi, Jim,
 
  Thanks for the information. But I am still not clear how to show the 3
  separated Y axis. If I just call par(new=TRUE), the three axes are
  overlapped.
 
  attached some test data. Thanks.
 
  Jun
  =
 
  structure(list(Time = 1:10, y1 = c(1000, 900, 810, 729, 656.1,
  590.49, 531.441, 478.2969, 430.46721, 387.420489), y2 = c(10,
  8, 6.4, 5.12, 4.096, 3.2768, 2.62144, 2.097152, 1.6777216, 1.34217728
  ), y3 = c(0.1, 0.075, 0.05625, 0.0421875, 0.031640625, 0.02373046875,
  0.0177978515625, 0.013348388671875, 0.0100112915039063,
 0.00750846862792969
  )), .Names = c(Time, y1, y2, y3), class = data.frame, row.names
 =
  c(NA,
  -10L))
 
  On Thu, May 26, 2011 at 10:49 AM, jim holtman jholt...@gmail.com
 wrote:
 
  There is nothing to prevent you from putting 3 y-axis on your plot;
  might be confusing, but it can be done.  What have you tried and why
  do you say guess not?  With the use of par(new=TRUE) or by doing
  your own scaling, you can use 'axis' to put as many axises as you want
  on your graph.
 
  On Thu, May 26, 2011 at 11:35 AM, Jun Shen jun.shen...@gmail.com
 wrote:
   Dear list,
  
   We have three time course profiles with very different scales, and we
   want
   to show them in one plot. Is it possible to have three y axis? I guess
   not,
   then what would be other options? something like two 2-y axis plots on
 a
   three dimensional view? Appreciate any comment.
  
   Jun Shen
  
  [[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.
  
 
 
 
  --
  Jim Holtman
  Data Munger Guru
 
  What is the problem that you are trying to solve?
 
 



 --
 Jim Holtman
 Data Munger Guru

 What is the problem that you are trying to solve?


[[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] 3 Y axis possible?

2011-05-26 Thread David Winsemius


On May 26, 2011, at 1:25 PM, Jun Shen wrote:


Jim,

One more question, how do I put a label on the axes I added? Thanks.  
I don't

see any argument in axis() for that? Thanks


You don't see the `labels` argument in the help page for `axis`?



Jun



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 import glitch missing data

2011-05-26 Thread StatBat2
Hello!

I am trying import data into R and im running into a snag.

GOAL:
Import a 4 column, 8,000 row table into R including headers.

WHAT I'VE ATTEMPTED:
Original data was in Excel format.
Converted data to both a .txt and .csv (to see which worked better) 
Imported data into R via commands as object demand (see below)

Please excuse the long file path.
demand=read.delim(C:\\Documents and Settings\\E066582\\My
Documents\\R\\R-2.13.0\\bin\\demand.txt)   

demand=read.csv((C:\\Documents and Settings\\E066582\\My
Documents\\R\\R-2.13.0\\bin\\demand.csv, header=True) 

In both cases, about half to three fourths of my data shows up as object
demand. My headers also fail to appear. I get about 4000 lines of my table
as well as missing headers. I've tried different variations on the synatx of
how i go about importing, with or without headers designated, with or
without .csv ',' designation, but nothing changes. I'm at a loss as to what
is incorrect. 

--
View this message in context: 
http://r.789695.n4.nabble.com/R-import-glitch-missing-data-tp3553079p3553079.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] bringing worldclim data into R

2011-05-26 Thread Lori12
Hi,
I'm going to try to do some species distribution modeling in R using
Mahalanobis distance. I have presence point locations for the species
and I have ASCII files for each of the WorldClim variables for North
America. My question is how do I bring these into R?
If this is too complex, I have done an extract multi values to points
function in ArcInfo and have the values for each climate variable for
each point location (many columns/fields of data). Would it be better
to work with just the single shapefile that contains point lat/long as
well as all the climate values? I'm just learning R so apologies if
this is a stupid question.
Thanks,
Lori

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

2011-05-26 Thread 1Rnwb
Hello R gurus, I have a data set from which i have to extract the gender and
age matched rows from controls and disease group
disease-paste(rep(c('y','n'),11))
gender-paste(rep(c('m','f'),11))
mcp-rnorm(700,1400)
age-rnorm(32,34)

dat-data.frame(disease=disease,sex=gender,Dr_age=age[1:22],MCP=mcp[1:22])

I have other categorical variables also to add to the matching. all the
posts I came across are matching for a single column from two
matrix/dataframe. How can i match for multiple variables when all the data
is in one single dataframe





--
View this message in context: 
http://r.789695.n4.nabble.com/matching-by-gender-and-age-tp3552825p3552825.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] Thiessen Method

2011-05-26 Thread federico.eccel
Dear Sarah,

I have a grid in which 8 raingauges are locted, in my case the dataset is
composed by 8 hourly timeseries, one for each raingauge. I would like to
obtain from these timeseries using the Thiessen method the values of the
precipitation in all the grid. In particular I would like to create the
thiessen polygons around the raingauges that have to be limited on my grid. 

Thanks a lot

Federico

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

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


[R] interpolation and extremum location of a surface

2011-05-26 Thread Clement LAUZIN

Hello,
I have a x,y,z file.
Z is not corresponding to a simple analytical function of x and y. 
I am trying to find the minimum value of z by a spline interpolation or from a 
polynomial fit.
I tried the akima package but as the location of the point I am looking for 
(the minimum) is outside of the convex hull it's not working.
If someone has any idea or any suggestion?
Thank you in advance

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

2011-05-26 Thread Peter Langfelder
On Thu, May 26, 2011 at 10:03 AM, StatBat2
nstruckme...@harryanddavid.com wrote:
 Hello!

 I am trying import data into R and im running into a snag.

 GOAL:
 Import a 4 column, 8,000 row table into R including headers.

 WHAT I'VE ATTEMPTED:
 Original data was in Excel format.
 Converted data to both a .txt and .csv (to see which worked better)
 Imported data into R via commands as object demand (see below)

 Please excuse the long file path.
 demand=read.delim(C:\\Documents and Settings\\E066582\\My
 Documents\\R\\R-2.13.0\\bin\\demand.txt)

 demand=read.csv((C:\\Documents and Settings\\E066582\\My
 Documents\\R\\R-2.13.0\\bin\\demand.csv, header=True)

 In both cases, about half to three fourths of my data shows up as object
 demand. My headers also fail to appear. I get about 4000 lines of my table
 as well as missing headers. I've tried different variations on the synatx of
 how i go about importing, with or without headers designated, with or
 without .csv ',' designation, but nothing changes. I'm at a loss as to what
 is incorrect.

Do you  get any error or warning messages?

Are there any apostrophes (') in your data? These can cause mayhem. If
you have any, use the argument
quote = \.

HTH,

Peter

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


Re: [R] matching by gender and age

2011-05-26 Thread David Winsemius


On May 26, 2011, at 11:19 AM, 1Rnwb wrote:

Hello R gurus, I have a data set from which i have to extract the  
gender and

age matched rows from controls and disease group


You need to define what you mean by age-matched. Your example  
creates a very narrow age range which further adds questions about  
what you are doing. You probably need to look at defining an age- 
category variable with cut() and proceeding from there.




disease-paste(rep(c('y','n'),11))
gender-paste(rep(c('m','f'),11))
mcp-rnorm(700,1400)
age-rnorm(32,34)

dat- 
data.frame(disease=disease,sex=gender,Dr_age=age[1:22],MCP=mcp[1:22])


Use set.seed to generate a reproducible input and then tell us what  
your expected output should be.




I have other categorical variables also to add to the matching. all  
the

posts I came across are matching for a single column from two
matrix/dataframe. How can i match for multiple variables when all  
the data

is in one single dataframe




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 import glitch missing data

2011-05-26 Thread David Winsemius


On May 26, 2011, at 1:59 PM, Peter Langfelder wrote:


On Thu, May 26, 2011 at 10:03 AM, StatBat2
nstruckme...@harryanddavid.com wrote:

Hello!

I am trying import data into R and im running into a snag.

GOAL:
Import a 4 column, 8,000 row table into R including headers.

WHAT I'VE ATTEMPTED:
Original data was in Excel format.
Converted data to both a .txt and .csv (to see which worked better)
Imported data into R via commands as object demand (see below)

Please excuse the long file path.
demand=read.delim(C:\\Documents and Settings\\E066582\\My
Documents\\R\\R-2.13.0\\bin\\demand.txt)

demand=read.csv((C:\\Documents and Settings\\E066582\\My
Documents\\R\\R-2.13.0\\bin\\demand.csv, header=True)




In both cases, about half to three fourths of my data shows up as  
object

demand. My headers also fail to appear.


True != TRUE and  the default for read.csv is header =TRUE



I get about 4000 lines of my table
as well as missing headers. I've tried different variations on the  
synatx of

how i go about importing, with or without headers designated, with or
without .csv ',' designation, but nothing changes. I'm at a loss as  
to what

is incorrect.


Do you  get any error or warning messages?

Are there any apostrophes (') in your data? These can cause mayhem. If
you have any, use the argument
quote = \.


Any # characters may mess things up, too.


HTH,

Peter



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 import glitch missing data

2011-05-26 Thread Struckmeier, Nathanael
That is the strange thing... I DON'T get a warning message. R behaves as
if all data is being imported successfully. I don't receive a memory
warning, or warning of any kind. I've scanned my data for potential
problems and I do not have any ('). However...

The .txt version of my file does use () around some of my dollar
values...here are all ways in which values on my .txt file are
expressed. 
900
-900
$900
900
(900)

The .csv version of my file uses:
900
-900
$900




StatBat2

-Original Message-
From: Peter Langfelder [mailto:peter.langfel...@gmail.com] 
Sent: Thursday, May 26, 2011 10:59 AM
To: Struckmeier, Nathanael
Cc: r-help@r-project.org
Subject: Re: [R] R import glitch missing data

On Thu, May 26, 2011 at 10:03 AM, StatBat2
nstruckme...@harryanddavid.com wrote:
 Hello!

 I am trying import data into R and im running into a snag.

 GOAL:
 Import a 4 column, 8,000 row table into R including headers.

 WHAT I'VE ATTEMPTED:
 Original data was in Excel format.
 Converted data to both a .txt and .csv (to see which worked better)
 Imported data into R via commands as object demand (see below)

 Please excuse the long file path.
 demand=read.delim(C:\\Documents and Settings\\E066582\\My
 Documents\\R\\R-2.13.0\\bin\\demand.txt)

 demand=read.csv((C:\\Documents and Settings\\E066582\\My
 Documents\\R\\R-2.13.0\\bin\\demand.csv, header=True)

 In both cases, about half to three fourths of my data shows up as
object
 demand. My headers also fail to appear. I get about 4000 lines of my
table
 as well as missing headers. I've tried different variations on the
synatx of
 how i go about importing, with or without headers designated, with or
 without .csv ',' designation, but nothing changes. I'm at a loss as to
what
 is incorrect.

Do you  get any error or warning messages?

Are there any apostrophes (') in your data? These can cause mayhem. If
you have any, use the argument
quote = \.

HTH,

Peter

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

2011-05-26 Thread StatBat2
That is the strange thing... I DON’T get a warning message. R behaves as if
all data is being imported successfully. I don't receive a memory warning,
or warning of any kind. I've scanned my data for potential problems and I do
not have any ('). However...

The .txt version of my file does use () around some of my dollar
values...here are all ways in which values on my .txt file are expressed. 
900
-900
$900
900
(900)

The .csv version of my file uses:
900
-900
$900

I am still new to practically everything about command syntax (just FYI)

Thank you for your response

StatBat2

--
View this message in context: 
http://r.789695.n4.nabble.com/R-import-glitch-missing-data-tp3553079p3553231.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] 'constrained' negative.binomial model estimates

2011-05-26 Thread Carson Farmer
Hello list,

I am not sure if the terminology that I am using here is widely used,
however, I provide an example in the hopes that my problem will become
clear. My basic problem is that I am unsure of how to 'constrain' my
model estimates to reproduce the aggregate (by factor levels) observed
dependent variable for a negative.binomial model. I realize this
sounds rather vague, so I provide an example to illustrate:

When working with migration data, it is possible to model migration
flows via a simple Poisson GLM like the following:

 model1 - glm(flows ~ destination.pop+distance+origin-0, data=migration, 
 family=poisson())
 model2 - glm(flows ~ destination.pop+distance+origin-0, data=migration, 
 family=quasipoisson())

where origin is a factor of origins (1 - n). This has the effect of
'constraining' the predicted flows to reproduce the observed outgoing
flows from each origin:

 sums - aggregate(migration$flows, by=list(migration$origin), sum)
 sums1 - aggregate(predict(model1, type='response'), 
 by=list(migration$origin), sum)
 sums2 - aggregate(predict(model2, type='response'), 
 by=list(migration$origin), sum)

which works fine for both poisson and quasipoisson models. However, I
would also like to fit a negative.binomial model to this data to
(again) account for over-dispersion (which may still exist even after
the constraint is imposed), however, the effect of the 'constraint'
factor does not seem to work, due likely to the additional theta
parameter.

 model3 - glm.nb(flows ~ destination.pop+distance+origin-0, data=migration)
 sums3 - aggregate(predict(model3,type='response'), 
 by=list(migration$origin), sum)

 data.frame(origin=unique(migration$origin), observed=sums$x, 
 poisson=sums1$x,quasi=sums2$x,negbin=sums3$x)
  origin observed poisson   quasinegbin
1  1   676308  676308  676308  651113.7
2  2  1155811 1155811 1155811 1141729.4
3  3  1789112 1789112 1789112 1845908.1
4  4   942162  942162  942162  978599.6
5  5  2484387 2484387 2484387 2486435.1
6  6   819222  819222  819222  747022.1
7  7  1237079 1237079 1237079 1405065.0
8  8  1067069 1067069 1067069  963339.5
9  9  2143172 2143172 2143172 2139171.5

Can anyone tell me how I might go about doing this for the
negative.binomial model? Or perhaps better still, an alternative way
of enforcing this 'constraint'?

The following dataset is what I used for the above example (this data
comes from Fotheringham and O’Kelly, 1989. Spatial interaction models:
Formulations and applications. Dordrecht: Kluwer Academic Publishers):

 dput(migration)
structure(list(flows = c(283049L, 87267L, 29877L, 130830L, 21434L,
30287L, 21450L, 72114L, 180048L, 237229L, 60681L, 382565L, 53772L,
64645L, 43749L, 133122L, 79223L, 300345L, 286580L, 346407L, 287340L,
161645L, 97808L, 229764L, 26887L, 67280L, 281791L, 92308L, 49828L,
144980L, 113683L, 165405L, 198144L, 718673L, 551483L, 143860L,
316650L, 199466L, 89806L, 266305L, 17995L, 55094L, 230788L, 49892L,
252189L, 121366L, 25574L, 66324L, 35563L, 93434L, 178517L, 185618L,
192223L, 141679L, 158006L, 252039L, 30528L, 87987L, 172711L,
181868L, 89389L, 27409L, 134229L, 342948L, 110792L, 268458L,
394481L, 274629L, 279739L, 87938L, 289880L, 437255L), distance = c(219L,
1009L, 1514L, 974L, 1268L, 1795L, 2420L, 3174L, 219L, 831L, 1336L,
755L, 1049L, 1576L, 2242L, 2996L, 1009L, 831L, 505L, 1019L, 662L,
933L, 1451L, 2205L, 1514L, 1336L, 505L, 1370L, 888L, 654L, 946L,
1700L, 974L, 755L, 1019L, 1370L, 482L, 1144L, 2278L, 2862L, 1268L,
1049L, 662L, 888L, 484L, 662L, 1795L, 2380L, 1795L, 1576L, 933L,
654L, 1144L, 662L, 1278L, 1779L, 2420L, 2242L, 1451L, 946L, 2278L,
1795L, 1278L, 754L, 3174L, 2996L, 2205L, 1700L, 2862L, 2380L,
1779L, 754L), origin.pop = c(16.2876696349298, 16.2876696349298,
16.2876696349298, 16.2876696349298, 16.2876696349298, 16.2876696349298,
16.2876696349298, 16.2876696349298, 17.4279408399148, 17.4279408399148,
17.4279408399148, 17.4279408399148, 17.4279408399148, 17.4279408399148,
17.4279408399148, 17.4279408399148, 17.5110179983684, 17.5110179983684,
17.5110179983684, 17.5110179983684, 17.5110179983684, 17.5110179983684,
17.5110179983684, 17.5110179983684, 16.6083307371083, 16.6083307371083,
16.6083307371083, 16.6083307371083, 16.6083307371083, 16.6083307371083,
16.6083307371083, 16.6083307371083, 17.2140377110705, 17.2140377110705,
17.2140377110705, 17.2140377110705, 17.2140377110705, 17.2140377110705,
17.2140377110705, 17.2140377110705, 16.3878173980331, 16.3878173980331,
16.3878173980331, 16.3878173980331, 16.3878173980331, 16.3878173980331,
16.3878173980331, 16.3878173980331, 16.761264461712, 16.761264461712,
16.761264461712, 16.761264461712, 16.761264461712, 16.761264461712,
16.761264461712, 16.761264461712, 15.9304398925737, 15.9304398925737,
15.9304398925737, 15.9304398925737, 15.9304398925737, 15.9304398925737,
15.9304398925737, 15.9304398925737, 17.0532473904734, 17.0532473904734,
17.0532473904734, 17.0532473904734, 17.0532473904734, 17.0532473904734,

Re: [R] Thiessen Method

2011-05-26 Thread Sarah Goslee
Federico,

That's an improvement, but a long way from the reproducible example
requested by the posting guide. I and others who might help are more
interested in the way the data and coordinates are organized and a
detailed explanation of what you expect the results to look like, etc,
than in a verbal description of the problem. From your description, I
can come up with many ways in which your data might be specified, and
results that you might want.

The posting guide provides valuable tips on how to provide a
well-formed question.

Did you try looking at the packages and functions I suggested in my
previous reply?

Sarah

On Thu, May 26, 2011 at 11:35 AM, federico.eccel
federico.ec...@gmail.com wrote:
 Dear Sarah,

 I have a grid in which 8 raingauges are locted, in my case the dataset is
 composed by 8 hourly timeseries, one for each raingauge. I would like to
 obtain from these timeseries using the Thiessen method the values of the
 precipitation in all the grid. In particular I would like to create the
 thiessen polygons around the raingauges that have to be limited on my grid.

 Thanks a lot

 Federico


-- 
Sarah Goslee
http://www.functionaldiversity.org

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


Re: [R] 3 Y axis possible?

2011-05-26 Thread Jun Shen
David,

I surely tried the labels argument. But it seems for tick marks not for a
text label. Did you see a different outcome? Thanks.

Jun

On Thu, May 26, 2011 at 12:38 PM, David Winsemius dwinsem...@comcast.netwrote:


 On May 26, 2011, at 1:25 PM, Jun Shen wrote:

  Jim,

 One more question, how do I put a label on the axes I added? Thanks. I
 don't
 see any argument in axis() for that? Thanks


 You don't see the `labels` argument in the help page for `axis`?


 Jun


 David Winsemius, MD
 West Hartford, CT



[[alternative HTML version deleted]]

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


Re: [R] 3 Y axis possible?

2011-05-26 Thread Walmes Zeviani
You can use mtext()

par(mar=c(5.1,4.1,4.1,5.1))
plot(x$Time, x$y1, type='l', bty = 'c', col = 'red')
par(new = TRUE)
plot(x$Time, x$y2, type = 'l', axes = FALSE, xlab = '', ylab = '', col=
'green')
axis(4, col='green')
mtext(side=4, text=label green, line=2)
par(new = TRUE)
plot(x$Time, x$y3, type = 'l', axes = FALSE, xlab = '', ylab = '', col =
'blue')
axis(4, col='blue', line = -4)
mtext(side=4, text=label green, line=-2)

Walmes.

==
Walmes Marques Zeviani
LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W)
Departamento de Estatística - Universidade Federal do Paraná
fone: (+55) 41 3361 3573
VoIP: (3361 3600) 1053 1173
e-mail: wal...@ufpr.br
twitter: @walmeszeviani
homepage: http://www.leg.ufpr.br/~walmes
linux user number: 531218
==

[[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] 3 Y axis possible?

2011-05-26 Thread David Winsemius

On May 26, 2011, at 2:18 PM, Jun Shen wrote:

 David,

 I surely tried the labels argument. But it seems for tick marks not  
 for a text label. Did you see a different outcome? Thanks.


`labels` is for labels, `at` is for tick (and label) locations. They  
should be the same length. One label for each tick location. As  
described on the help page. Unless you have a different understanding  
of `labels`. I was confused for a long time because `ylab` and `xlab`  
are not really for labels but rather for axis names.

 Jun

 On Thu, May 26, 2011 at 12:38 PM, David Winsemius dwinsem...@comcast.net 
  wrote:

 On May 26, 2011, at 1:25 PM, Jun Shen wrote:

 Jim,

 One more question, how do I put a label on the axes I added? Thanks.  
 I don't
 see any argument in axis() for that? Thanks

 You don't see the `labels` argument in the help page for `axis`?


 Jun


 David Winsemius, MD
 West Hartford, CT



David Winsemius, MD
West Hartford, CT


[[alternative HTML version deleted]]

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


Re: [R] Thiessen Method

2011-05-26 Thread Thomas Adams



Federico,

I understand what you are after — you want time-series estimates based on the 
Thiessen polygon estimates
taken from the station time-series data. My recommendation is that the process 
of doing this would be far
easier using something like GRASS GIS, possibly in conjunction with R (since 
they play together very well).

Unfortunately, lots of coding/scripting is needed — I can not see that there 
are a few R commands you can
make to pull this off.

The process would look something like:

(1) import all station data for time step 1 (all data could be imported at one 
time, but this complicates the process)
(2) make Thiessen polygons based on (1)
(3) write-out results from (2)
(4) repeat (1)-(3) for each time step
(5) concatenate individual Thiessen polygon time-series results sequentially

This kind of thing is pretty straight-forward and keeps computers happy!

Regards,
Tom



Federico,

That's an improvement, but a long way from the reproducible example
requested by the posting guide. I and others who might help are more
interested in the way the data and coordinates are organized and a
detailed explanation of what you expect the results to look like, etc,
than in a verbal description of the problem. From your description, I
can come up with many ways in which your data might be specified, and
results that you might want.

The posting guide provides valuable tips on how to provide a
well-formed question.

Did you try looking at the packages and functions I suggested in my
previous reply?

Sarah

On Thu, May 26, 2011 at 11:35 AM, federico.eccel
federico.ec...@gmail.com  wrote:

Dear Sarah,

I have a grid in which 8 raingauges are locted, in my case the dataset is
composed by 8 hourly timeseries, one for each raingauge. I would like to
obtain from these timeseries using the Thiessen method the values of the
precipitation in all the grid. In particular I would like to create the
thiessen polygons around the raingauges that have to be limited on my grid.

Thanks a lot

Federico




--
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL:  thomas.ad...@noaa.gov

VOICE:  937-383-0528
FAX:937-383-0033

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


Re: [R] matrix not working

2011-05-26 Thread Andy Zhu
Dat:

1. you can use as.matrix to convert data.frame to matrix;
2. it is likely that the internal representation of your data.frame may not be 
numerical value; matrix can only take on numeric.



--- On Thu, 5/26/11, Dat Mai dat.d@gmail.com wrote:

From: Dat Mai dat.d@gmail.com
Subject: [R]  matrix not working
To: r-help@r-project.org
Date: Thursday, May 26, 2011, 12:24 PM

Hello All,

I'm trying to create a matrix from a dataframe (let's call it df):
..a..b.c.d
a   inputs      output
b   inputs      output
c   inputs      output
d   inputs      output
e   inputs      output

The inputs are represented by columns a and b
The outputs are represented by columns c and d, but the only outputs are
those from column d
- some values from column d are NA
- column d was created with the code:

df$d=rank(df$c, na.last=keep)

#--R Code-#
item=unique(df$a)
n=length(list)

r=matrix(data=NA,nrow=n, ncol=n, dimnames=list(PRR1=item, PRR2=item))

for(j in 2:ln)
{
  for(i in 1:(j-1))
  {
    input1=rownames(r)[i]
    input2=colnames(r)[j]

    q=df[(df$a==input1  df$b==input2), d]

    if(length(q)==0)
    {
      q=df[(df$a==input2  df$b==input1), d]
    }

    if(length(q)==0)
    {
      q=NA
    }

    r[j,i]=q
    r[i,j]=q
    r[j,j]=q
  }
}

The result is a matrix with the appropriate dimensions, but everything is
filled with NA instead of the rankings of the various combinations. I'd like
for the matrix to be filled with the ranking values--what have I done wrong?
-- 
Best,
Dat Mai
PhD Rotation Student
Albert Einstein College of Medicine

    [[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] Survival: pyears and ratetable: expected events

2011-05-26 Thread Jim Trabas
Dear all,

I am having a (really) hard time getting pyears to work together with a
ratetable to give me the number of expected events (deaths).

I have the following data:

dos, date of surgery, as.Date
dof, date of last follow-up, as.Date
dos, date of surgery, as.Date
sex, gender, as.factor (female,male)
ev, event(death), 0= censored at time point dof, 1=death at time point dof

Could someone please help. I am searching the web 5 days now and I cannot
find any simple example that I can reproduce or fit to my needs.

I have managed to get the patient years the conventional way: I use pyears
to tcut the follow up time by  age and year of surgery, and by sex. Then I
do cross multiplication with the life tables I have obtained and customized.

I have seen that the use of a ratetable together with the pyears function
can produce the expected deaths, but I have not been successful applying it
to my data.

Could someone please help me with the syntax?

Many thanks in advance
JT


--
View this message in context: 
http://r.789695.n4.nabble.com/Survival-pyears-and-ratetable-expected-events-tp3553208p3553208.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] Suppress intermediate results on console

2011-05-26 Thread Lisa
Dear all,

I have a question about how to suppress intermediate results in a function
on console. For example, I will use summary() in my own function that looks
like:

myfunction - function(…)
{
  …
  Summary(x)
  …
}

Then myfunction() will print “x” on console that is intermediate result and
doesn’t need showing. 

Does someone have any idea or any suggestion? Thank you in advance.

Lisa


--
View this message in context: 
http://r.789695.n4.nabble.com/Suppress-intermediate-results-on-console-tp3553276p3553276.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] Compiling Rgraphiz on Windows 7 64bit with R-2.13.0

2011-05-26 Thread jirivoller
Duncan,
installing MikTeX solved the problem. thank you.

--
View this message in context: 
http://r.789695.n4.nabble.com/Compiling-Rgraphiz-on-Windows-7-64bit-with-R-2-13-0-tp3493750p3553281.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] Count of rows while looping through data

2011-05-26 Thread Jeanna
Thank you both. These solutions are far more elegant than anything I could
have come up with, and I appreciate the opportunity to learn new commands
within the context of my own data.  

I think I've got it working now.  :)

--
View this message in context: 
http://r.789695.n4.nabble.com/Count-of-rows-while-looping-through-data-tp3547949p3553201.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] matrix not working

2011-05-26 Thread David Winsemius


On May 26, 2011, at 1:53 PM, Andy Zhu wrote:


Dat:

1. you can use as.matrix to convert data.frame to matrix;
2. it is likely that the internal representation of your data.frame  
may not be numerical value; matrix can only take on numeric.




Not true. Can be any single mode, including character, list, and  
logical.


--
david.




--- On Thu, 5/26/11, Dat Mai dat.d@gmail.com wrote:

From: Dat Mai dat.d@gmail.com
Subject: [R]  matrix not working
To: r-help@r-project.org
Date: Thursday, May 26, 2011, 12:24 PM

Hello All,

I'm trying to create a matrix from a dataframe (let's call it df):
..a..b.c.d
a   inputs  output
b   inputs  output
c   inputs  output
d   inputs  output
e   inputs  output

The inputs are represented by columns a and b
The outputs are represented by columns c and d, but the only outputs  
are

those from column d
- some values from column d are NA
- column d was created with the code:

df$d=rank(df$c, na.last=keep)

#--R Code-#
item=unique(df$a)
n=length(list)

r=matrix(data=NA,nrow=n, ncol=n, dimnames=list(PRR1=item, PRR2=item))

for(j in 2:ln)
{
  for(i in 1:(j-1))
  {
input1=rownames(r)[i]
input2=colnames(r)[j]

q=df[(df$a==input1  df$b==input2), d]

if(length(q)==0)
{
  q=df[(df$a==input2  df$b==input1), d]
}

if(length(q)==0)
{
  q=NA
}

r[j,i]=q
r[i,j]=q
r[j,j]=q
  }
}

The result is a matrix with the appropriate dimensions, but  
everything is
filled with NA instead of the rankings of the various combinations.  
I'd like
for the matrix to be filled with the ranking values--what have I  
done wrong?

--
Best,
Dat Mai
PhD Rotation Student
Albert Einstein College of Medicine

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


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] Suppress intermediate results on console

2011-05-26 Thread Jonathan Daily
Well, since we have no idea what x is, that is going to be hard to do.
Are you calling summary because you want the info on the last
iteration of a loop? If so, just put the summary call outside the
loop. Otherwise, why are you calling summary if you don't want a
summary?

Also, the posting guide requests a reproducible example, so please
provide one in the future.

Jon

On Thu, May 26, 2011 at 2:30 PM, Lisa lisa...@gmail.com wrote:
 Dear all,

 I have a question about how to suppress intermediate results in a function
 on console. For example, I will use summary() in my own function that looks
 like:

 myfunction - function(…)
 {
  …
  Summary(x)
  …
 }

 Then myfunction() will print “x” on console that is intermediate result and
 doesn’t need showing.

 Does someone have any idea or any suggestion? Thank you in advance.

 Lisa


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Suppress-intermediate-results-on-console-tp3553276p3553276.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.




-- 
===
Jon Daily
Technician
===
#!/usr/bin/env outside
# It's great, trust me.

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


Re: [R] text mining

2011-05-26 Thread Matevž Pavlič
HI, 

I do it like this :

setwd(C:/Users/mpavlic/Desktop/Temp)
library(tm)

tekst - Corpus(DirSource(.),readerControl = list(language =ansi))  

where *.txt files are stored in a folder Temp in my desktop, 

HTH, m

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of rgui
Sent: Thursday, May 26, 2011 1:02 PM
To: r-help@r-project.org
Subject: [R] text mining

Hi,

how can I import a document whose type is. txt using the package tm?
it is the command to know that my document is not placed in the library package 
tm.

thanks.

--
View this message in context: 
http://r.789695.n4.nabble.com/text-mining-tp3552221p3552221.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] Question about ggplot2

2011-05-26 Thread Julian TszKin Chan
Hi all,

Is there any way for me to to string in the argument of qplot or ggplot? for
example

qplot(x='carat',y='price',data=diamonds,geom=c('point','smooth'))
instead of
qplot(x=carat,y=price,data=diamonds,geom=c('point','smooth'))

 Thanks!!

Regards,
TszKin Julian

[[alternative HTML version deleted]]

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


Re: [R] R import glitch missing data

2011-05-26 Thread StatBat2
Wierd... sorry about the double posting...

--
View this message in context: 
http://r.789695.n4.nabble.com/R-import-glitch-missing-data-tp3553079p3553444.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] matrix not working

2011-05-26 Thread Dat Mai
When I use the as.matrix, the data.frame does turn into a matrix, but I
cannot change the dimensions of the matrix. I'd still want it to have that
pseudo cartesian format (e.g. [a1,b1], [a2,b2])

On Thu, May 26, 2011 at 6:58 PM, David Winsemius dwinsem...@comcast.netwrote:


 On May 26, 2011, at 1:53 PM, Andy Zhu wrote:

  Dat:

 1. you can use as.matrix to convert data.frame to matrix;
 2. it is likely that the internal representation of your data.frame may
 not be numerical value; matrix can only take on numeric.


 Not true. Can be any single mode, including character, list, and
 logical.

 --
 david.




 --- On Thu, 5/26/11, Dat Mai dat.d@gmail.com wrote:

 From: Dat Mai dat.d@gmail.com
 Subject: [R]  matrix not working
 To: r-help@r-project.org
 Date: Thursday, May 26, 2011, 12:24 PM

 Hello All,

 I'm trying to create a matrix from a dataframe (let's call it df):
 ..a..b.c.d
 a   inputs  output
 b   inputs  output
 c   inputs  output
 d   inputs  output
 e   inputs  output

 The inputs are represented by columns a and b
 The outputs are represented by columns c and d, but the only outputs are
 those from column d
 - some values from column d are NA
 - column d was created with the code:

 df$d=rank(df$c, na.last=keep)

 #--R Code-#
 item=unique(df$a)
 n=length(list)

 r=matrix(data=NA,nrow=n, ncol=n, dimnames=list(PRR1=item, PRR2=item))

 for(j in 2:ln)
 {
  for(i in 1:(j-1))
  {
input1=rownames(r)[i]
input2=colnames(r)[j]

q=df[(df$a==input1  df$b==input2), d]

if(length(q)==0)
{
  q=df[(df$a==input2  df$b==input1), d]
}

if(length(q)==0)
{
  q=NA
}

r[j,i]=q
r[i,j]=q
r[j,j]=q
  }
 }

 The result is a matrix with the appropriate dimensions, but everything is
 filled with NA instead of the rankings of the various combinations. I'd
 like
 for the matrix to be filled with the ranking values--what have I done
 wrong?
 --
 Best,
 Dat Mai
 PhD Rotation Student
 Albert Einstein College of Medicine

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


 David Winsemius, MD
 West Hartford, CT




-- 
Best,
Dat Mai
PhD Rotation Student
Albert Einstein College of Medicine

[[alternative HTML version deleted]]

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


Re: [R] matrix not working

2011-05-26 Thread Bert Gunter
Please...

?[

Online tutorial An Introduction to R.

I think you'll find everything you need in these.

-- Bert


On Thu, May 26, 2011 at 12:39 PM, Dat Mai dat.d@gmail.com wrote:
 When I use the as.matrix, the data.frame does turn into a matrix, but I
 cannot change the dimensions of the matrix. I'd still want it to have that
 pseudo cartesian format (e.g. [a1,b1], [a2,b2])

 On Thu, May 26, 2011 at 6:58 PM, David Winsemius 
 dwinsem...@comcast.netwrote:


 On May 26, 2011, at 1:53 PM, Andy Zhu wrote:

  Dat:

 1. you can use as.matrix to convert data.frame to matrix;
 2. it is likely that the internal representation of your data.frame may
 not be numerical value; matrix can only take on numeric.


 Not true. Can be any single mode, including character, list, and
 logical.

 --
 david.




 --- On Thu, 5/26/11, Dat Mai dat.d@gmail.com wrote:

 From: Dat Mai dat.d@gmail.com
 Subject: [R]  matrix not working
 To: r-help@r-project.org
 Date: Thursday, May 26, 2011, 12:24 PM

 Hello All,

 I'm trying to create a matrix from a dataframe (let's call it df):
 ..a..b.c.d
 a   inputs      output
 b   inputs      output
 c   inputs      output
 d   inputs      output
 e   inputs      output

 The inputs are represented by columns a and b
 The outputs are represented by columns c and d, but the only outputs are
 those from column d
 - some values from column d are NA
 - column d was created with the code:

 df$d=rank(df$c, na.last=keep)

 #--R Code-#
 item=unique(df$a)
 n=length(list)

 r=matrix(data=NA,nrow=n, ncol=n, dimnames=list(PRR1=item, PRR2=item))

 for(j in 2:ln)
 {
  for(i in 1:(j-1))
  {
    input1=rownames(r)[i]
    input2=colnames(r)[j]

    q=df[(df$a==input1  df$b==input2), d]

    if(length(q)==0)
    {
      q=df[(df$a==input2  df$b==input1), d]
    }

    if(length(q)==0)
    {
      q=NA
    }

    r[j,i]=q
    r[i,j]=q
    r[j,j]=q
  }
 }

 The result is a matrix with the appropriate dimensions, but everything is
 filled with NA instead of the rankings of the various combinations. I'd
 like
 for the matrix to be filled with the ranking values--what have I done
 wrong?
 --
 Best,
 Dat Mai
 PhD Rotation Student
 Albert Einstein College of Medicine

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


 David Winsemius, MD
 West Hartford, CT




 --
 Best,
 Dat Mai
 PhD Rotation Student
 Albert Einstein College of Medicine

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




-- 
Men by nature long to get on to the ultimate truths, and will often
be impatient with elementary studies or fight shy of them. If it were
possible to reach the ultimate truths without the elementary studies
usually prefixed to them, these would not be preparatory studies but
superfluous diversions.

-- Maimonides (1135-1204)

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] NaN, Inf to NA

2011-05-26 Thread Albert-Jan Roskam
Hi,

I want to recode all Inf and NaN values to NA, but I;m surprised to see the 
result of the following code. Could anybody enlighten me about this? 

 df - data.frame(a=c(NA, NaN, Inf, 1:3))
 df[is.infinite(df) | is.nan(df)] - NA
 df
a
1  NA
2 NaN
3 Inf
4   1
5   2
6   3
 

 
Thanks!

Cheers!!
Albert-Jan


~~
All right, but apart from the sanitation, the medicine, education, wine, public 
order, irrigation, roads, a fresh water system, and public health, what have 
the 
Romans ever done for us?
~~

[[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] What are the common Standard Statistical methods used for the analysis of a dataset

2011-05-26 Thread Greg Snow
I think the IOTT is more a general testing framework rather than a single test 
(like maximum likelihood, least squares, bootstrap, etc.) so a single function 
won't capture the whole IOTT.  There are already many functions available to do 
IOTT for many cases (well the user needs to provide the ocular part), including 
ggplot2 and lattice packages, the vis.test function in the TeachingDemos 
package, and some of the reporting tools in Hmisc and rms packages (and 
probably plenty of others).

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


 -Original Message-
 From: Stephan Kolassa [mailto:stephan.kola...@gmx.de]
 Sent: Wednesday, May 25, 2011 3:49 PM
 To: Greg Snow
 Cc: r-help@r-project.org
 Subject: Re: [R] What are the common Standard Statistical methods used
 for the analysis of a dataset
 
 Dear all,
 
 may I suggest the acronym IOTT for the inter-ocular trauma test?
 
 Now we just need someone to implement iot.test(). I assume it will
 appear on CRAN within the next 24 hours.
 
 Looking forward to yet another base package,
 Stephan
 
 
 
 Am 25.05.2011 23:36, schrieb Greg Snow:
  How can anyone overlook the intra-ocular trauma test (or sometimes
  called the inter-ocular concussion test).  But the i-o trauma test
  needs either a small data set or an appropriate graph of the data (or
  can you look at a dataset of a hundred columns and a million rows and
  do an intra-ocular trauma test?).  We were not told the size of the
  dataset or enough information to know what type of graph to make.
 
  You do make a good point though that with minimal additional
  information the intra-ocular trauma test can be useful (well if it is
  significant, there are many datasets that fail the intra-ocular
  trauma test, but still yield interesting results after careful
  study).  And for any dataset that has a significant intra-ocular
  trauma test result, that should trump the results of
  SnowsCorrectlySizedButOtherwiseUselessTestOfAnything.
 

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


Re: [R] NaN, Inf to NA

2011-05-26 Thread Ian Gow
 df$a[is.infinite(df$a) | is.nan(df$a) ] - NA
 df
   a
1 NA
2 NA
3 NA
4  1
5  2
6  3


On 5/26/11 3:18 PM, Albert-Jan Roskam fo...@yahoo.com wrote:

Hi,

I want to recode all Inf and NaN values to NA, but I;m surprised to see
the 
result of the following code. Could anybody enlighten me about this?

 df - data.frame(a=c(NA, NaN, Inf, 1:3))
 df[is.infinite(df) | is.nan(df)] - NA
 df
a
1  NA
2 NaN
3 Inf
4   1
5   2
6   3
 

 
Thanks!

Cheers!!
Albert-Jan


~~
All right, but apart from the sanitation, the medicine, education, wine,
public 
order, irrigation, roads, a fresh water system, and public health, what
have the 
Romans ever done for us?
~~

   [[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] 3 Y axis possible?

2011-05-26 Thread Jun Shen
Thanks a bunch, Walmes.

One more concern, the new Y axes added do not extend all the way down to
cross with x axis. Is there anyway to make them look like the very first Y
axis on the left?

Jun

On Thu, May 26, 2011 at 1:24 PM, Walmes Zeviani walmeszevi...@gmail.comwrote:

 You can use mtext()

 par(mar=c(5.1,4.1,4.1,5.1))
 plot(x$Time, x$y1, type='l', bty = 'c', col = 'red')
 par(new = TRUE)
 plot(x$Time, x$y2, type = 'l', axes = FALSE, xlab = '', ylab = '', col=
 'green')
 axis(4, col='green')
 mtext(side=4, text=label green, line=2)
 par(new = TRUE)
 plot(x$Time, x$y3, type = 'l', axes = FALSE, xlab = '', ylab = '', col =
 'blue')
 axis(4, col='blue', line = -4)
 mtext(side=4, text=label green, line=-2)

 Walmes.

 ==
 Walmes Marques Zeviani
 LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W)
 Departamento de Estatística - Universidade Federal do Paraná
 fone: (+55) 41 3361 3573
 VoIP: (3361 3600) 1053 1173
 e-mail: wal...@ufpr.br
 twitter: @walmeszeviani
 homepage: http://www.leg.ufpr.br/~walmes
 linux user number: 531218
 ==

[[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] confidence interval on mean in log-regression

2011-05-26 Thread Alice Shelly
Hello-

I am looking for R function that will give me some proper confidence
intervals on un-transformed mean prediction when performing a linear
regression on log-transformed data. I am referring to the UMVU estimate, the
el-shaarawi and viveros (1997) estimate, or the Wu, wong, and Wei (2005)
estimates, for example. Can't find anything, hoping not to have to program
it myself!

 

Thanks-

 

Alice Shelly

Environmental Statistician

TerraStat Consulting Group

5002 Lodge View Lane

Austin, TX 78731

(206) 362-3299

al...@blarg.net

 


[[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] Suppress intermediate results on console

2011-05-26 Thread Lisa
Thanks for your comments and suggestion. I didn’t show all my own function
here because it has many lines. “x” is the results of another function. I am
calling summary because I want to extract some values from the results. 

--
View this message in context: 
http://r.789695.n4.nabble.com/Suppress-intermediate-results-on-console-tp3553276p3553405.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] predictive accuracy

2011-05-26 Thread El-Tahtawy, Ahmed
The strong predictor is the country/region where the study was
conducted. So it is not important/useful for a clinician to use it (as
long he/she is in USA or Europe).   
Excluding that predictor will make another 2 insignificant predictors to
become significant!!  Can the new model have a reliable predictive
accuracy? I thought of excluding all patients from other countries and
develop the model accordingly- is the exclusion of a lot of patients and
compromise of the power is more acceptable??
Thanks for your help...
Al

-Original Message-
From: Marc Schwartz [mailto:marc_schwa...@me.com] 
Sent: Thursday, May 26, 2011 10:54 AM
To: El-Tahtawy, Ahmed
Cc: r-help@r-project.org
Subject: Re: [R] predictive accuracy


On May 26, 2011, at 7:42 AM, El-Tahtawy, Ahmed wrote:

 I am trying to develop a prognostic model using logistic regression.
I
 built a full , approximate models with the use of penalization -
design
 package. Also, I tried Chi-square criteria, step-down techniques. Used
 BS for model validation. 
 
  The main purpose is to develop a predictive model for future patient
 population.   One of the strong predictor pertains to the study design
 and would not mean much for a clinician/investigator in real clinical
 situation and have been asked to remove it.
  Can I propose a model and nomogram without that strong -irrelevant
 predictor?? If yes, do I need to redo model calibration,
discrimination,
 validation, etc...?? or just have 5 predictors instead of 6 in the
 prognostic model??
 
 
 
 Thanks for your help
 
 Al


Is it that the study design characteristic would not make sense to a
clinician but is relevant to future samples, or that the study design
characteristic is unique to the sample upon which the model was
developed and is not relevant to future samples because they will not be
in the same or a similar study?

Is the study design characteristic a surrogate for other factors that
would be relevant to future samples? If so, you might engage in a
conversation with the clinicians to gain some insights into other
variables to consider for inclusion in the model, that might in turn,
help to explain the effect of the study design variable.

Either way, if the covariate is removed, you of course need to engage in
fully re-evaluating the model. You cannot just drop the covariate and
continue to use model fit assessments made on the full model.

HTH,

Marc Schwartz

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


  1   2   >