Re: [R] \ escape sequence and windows path

2014-05-22 Thread Knut Krueger

Am 20.05.2014 19:03, schrieb Duncan Murdoch:


I have no idea what you mean by a callback from utils.


clipboard {utils}
  readClipboard
function (format = 1L, raw = FALSE)
.Call(C_readClipboard, format, raw)
bytecode: 0x080d6c20
environment: namespace:utils

I do not know whether it is an real callback or a normal call to an C 
subroutine

https://en.wikipedia.org/wiki/Callback_%28computer_programming%29Knut

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


Re: [R] \ escape sequence and windows path

2014-05-22 Thread Knut Krueger

Sorry
https://en.wikipedia.org/wiki/Callback_%28computer_programming%29
Knut

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

2014-05-22 Thread Martina Marbà
Hi,

I would like to unsubscribe from the mailing list.
Thanks

-- 
--
Martina Marbà

[[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] select randomly from a list

2014-05-22 Thread Ragia Ibrahim
Hi,
kindly I want to select randomly and item from list of items. the list 
generated in a looping process. 
I used sample(mylist,1) it works fine. BUTsome times the list have only one 
item. that should be chosen in this case since there is no other one.
I found that sample return different item not included in the list
thanks in advance
RAE
  
[[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] Combine factorial column intp a new column

2014-05-22 Thread Beatriz R. Gonzalez Dominguez

Dear R-users,

I'd be very greatful if you could help me with the following as after a 
few tests I haven't still been able to get the right outcome.


I've got this data:
dd_1 - data.frame(ID = c(1,2, 3, 4, 5),
 Class_a = c(a,NA, a, NA, NA),
 Class_b = c(NA, b, b, b, b))

And I'd like to produce a new column 'CLASS':
dd_2 - data.frame(ID = c(1,2, 3, 4, 5),
 Class_a = c(a,NA, a, NA, NA),
 Class_b = c(NA, b, b, b, b),
 CLASS = c(a, b, a-b, b, b))

Thanks a lot!

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


Re: [R] Unsubscribe mailing list

2014-05-22 Thread arun


Hi,
Please use the link (https://stat.ethz.ch/mailman/listinfo/r-help) to 
unsubscribe.

A.K.


On Thursday, May 22, 2014 3:39 AM, Martina Marbà frees...@gmail.com wrote:
Hi,

I would like to unsubscribe from the mailing list.
Thanks

-- 
--
Martina Marbà

    [[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] Combine factorial column intp a new column

2014-05-22 Thread arun


Hi,
May be this helps:
 ddNew -  transform(dd_1, CLASS= gsub(NA-|-NA,,paste(Class_a, Class_b, 
sep=-)))
 identical(ddNew, dd_2)
#[1] TRUE
A.K.


On Thursday, May 22, 2014 4:07 AM, Beatriz R. Gonzalez Dominguez 
aguitatie...@hotmail.com wrote:
Dear R-users,

I'd be very greatful if you could help me with the following as after a 
few tests I haven't still been able to get the right outcome.

I've got this data:
dd_1 - data.frame(ID = c(1,2, 3, 4, 5),
                  Class_a = c(a,NA, a, NA, NA),
                  Class_b = c(NA, b, b, b, b))

And I'd like to produce a new column 'CLASS':
dd_2 - data.frame(ID = c(1,2, 3, 4, 5),
                  Class_a = c(a,NA, a, NA, NA),
                  Class_b = c(NA, b, b, b, b),
                  CLASS = c(a, b, a-b, b, b))

Thanks a lot!

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

2014-05-22 Thread arun


Hi,

I am not sure I understand the problem.  Please provide a reproducible example 
using ?dput().

mylist - list(1:3, LETTERS[1:2], rnorm(4))
sample(mylist,1)
sample(mylist,1)

 mylist1 - list(1:2)
sample(mylist1,1)
#[[1]]
#[1] 1 2

 sample(mylist1,1)
#[[1]]
#[1] 1 2
A.K.




On Thursday, May 22, 2014 3:55 AM, Ragia Ibrahim ragi...@hotmail.com wrote:
Hi,
kindly I want to select randomly and item from list of items. the list 
generated in a looping process. 
I used sample(mylist,1) it works fine. BUTsome times the list have only one 
item. that should be chosen in this case since there is no other one.
I found that sample return different item not included in the list
thanks in advance
RAE
                          
    [[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] select randomly from a list

2014-05-22 Thread Jim Lemon
On Thu, 22 May 2014 09:54:13 AM Ragia Ibrahim wrote:
 Hi,
 kindly I want to select randomly and item from list of items. the list
 generated in a looping process. I used sample(mylist,1) it works fine.
 BUTsome times the list have only one item. that should be chosen in 
this
 case since there is no other one. I found that sample return different 
item
 not included in the list thanks in advance
 RAE
 
Hi RAE,
This doesn't happen in an example like this:

for(i in 1:5) {
 testlist-list()
 for(j in 1:i) testlist[[j]]-sample(LETTERS[1:26],1)
 cat(list is\n)
 print(testlist)
 cat(sample is\n)
 print(sample(testlist,1))
}

How are you generating your lists?

Jim

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


Re: [R] Mean of colMeans

2014-05-22 Thread arun


 Also, the ?colMeans() route seems to be slightly faster (in cases with no 
missing values).
set.seed(398)
x - matrix(rnorm(1e4*2e4), ncol=2e4)

 system.time(res1 - mean(colMeans(x)))
 # user  system elapsed 
 #0.227   0.000   0.227 



 system.time(res2 - mean(x))
# user  system elapsed 
# 0.46    0.00    0.46 

all.equal(res1,res2)
#[1] TRUE

A.K.



On Wednesday, May 21, 2014 4:53 PM, Boris Steipe boris.ste...@utoronto.ca 
wrote:
Not necessarily. Missing values may base the means on unequal numbers of 
observation:

x - c(1,1,1,2,NA,2)
dim(x) - c(3,2)
cM - colMeans(x, na.rm = TRUE, dims = 1)
mean(cM)
mean(x, na.rm = TRUE)

B.

On 2014-05-21, at 3:38 PM, Frede Aakmann Tøgersen wrote:

 Hhhhmmhhhm, but is that not the same as
 
 mean(as.matrix(x))
 
 ?
 
 Yours sincerely / Med venlig hilsen
 
 
 Frede Aakmann Tøgersen
 Specialist, M.Sc., Ph.D.
 Plant Performance  Modeling
 
 Technology  Service Solutions
 T +45 9730 5135
 M +45 2547 6050
 fr...@vestas.com
 http://www.vestas.com
 
 Company reg. name: Vestas Wind Systems A/S
 This e-mail is subject to our e-mail disclaimer statement.
 Please refer to www.vestas.com/legal/notice
 If you have received this e-mail in error please contact the sender. 
 
 
 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Sarah Goslee
 Sent: 21. maj 2014 21:11
 To: Kate Ignatius; r-help
 Subject: Re: [R] Mean of colMeans
 
 That would be because col is a function in base R, and thus a poor
 choice of names for user objects. Nonetheless, it worked when I ran
 it, but you didn't provide reproducible example so who knows.
 
 R set.seed(1)
 R x - data.frame(matrix(runif(150), ncol=10))
 R # col is a function, so not a good name
 R col - colMeans(x)
 R mean(col)
 [1] 0.5119
 
 It's polite to include the list on your reply.
 
 Sarah
 
 On Wed, May 21, 2014 at 2:50 PM, Kate Ignatius kate.ignat...@gmail.com
 wrote:
 That didn't work: gave me the error =
 
 [1] NA
 Warning message:
 In mean.default(col) : argument is not numeric or logical: returning NA
 
 But writing it like: mean(colMeans(x, na.rm = TRUE, dims = 1)), worked
 
 Thanks!
 
 On Wed, May 21, 2014 at 2:31 PM, Sarah Goslee
 sarah.gos...@gmail.com wrote:
 Is
 
 mean(col)
 
 not what you're looking for?
 
 Sarah
 
 On Wed, May 21, 2014 at 2:26 PM, Kate Ignatius
 kate.ignat...@gmail.com wrote:
 Hi All,
 
 I've successfully gotten out the colMeans for 60 columns using:
 
 col - colMeans(x, na.rm = TRUE, dims = 1)
 
 My next question is: is there a way of getting a mean of all the
 column means (ie a mean of a mean)?
 
 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.

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

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

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


Re: [R] Unsubscribe mailing list

2014-05-22 Thread Kuldeep Singh
Please do that by going to:

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

and fill in the required information.

Regards,
Kuldeep




Thanks and Regards,
Kuldeep Singh


On Wed, May 21, 2014 at 4:47 PM, Martina Marbà frees...@gmail.com wrote:

 Hi,

 I would like to unsubscribe from the mailing list.
 Thanks

 --
 --
 Martina Marbà

 [[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] HMM states simulation

2014-05-22 Thread Baba Bukar
Dear all,

I have 100 observations sampled from poisson and negative binomial
distributions and i want set a hidden states for the observations, class
with zero and one {0,1}. Larger observations to be one and smaller
observations to be zero using R.

Can someone please help?

Kind regards
Zakir

[[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] select randomly from a list

2014-05-22 Thread peter dalgaard
It's a well known quirk of sample that it changes behavior when the x argument 
has length 1:

 replicate(10,sample(4:5, 1))
 [1] 5 4 5 4 5 4 5 4 4 4
 replicate(10,sample(5:5, 1))
 [1] 5 3 1 1 1 2 5 3 2 2

One workaround is to zap the offending branch inside sample:

 Sample - function (x, size, replace = FALSE, prob = NULL) 
   x[sample.int(length(x), size, replace, prob)]
 replicate(10,Sample(5:5, 1))
 [1] 5 5 5 5 5 5 5 5 5 5

(It's one of the cases of misguided user-friendliness that is probably long 
regretted by its authors, but has been around for so long that it is painful to 
change because code relies on the current behavior. A similar case is diag().)

-pd

On 22 May 2014, at 11:05 , Jim Lemon j...@bitwrit.com.au wrote:

 On Thu, 22 May 2014 09:54:13 AM Ragia Ibrahim wrote:
 Hi,
 kindly I want to select randomly and item from list of items. the list
 generated in a looping process. I used sample(mylist,1) it works fine.
 BUTsome times the list have only one item. that should be chosen in 
 this
 case since there is no other one. I found that sample return different 
 item
 not included in the list thanks in advance
 RAE
 
 Hi RAE,
 This doesn't happen in an example like this:
 
 for(i in 1:5) {
 testlist-list()
 for(j in 1:i) testlist[[j]]-sample(LETTERS[1:26],1)
 cat(list is\n)
 print(testlist)
 cat(sample is\n)
 print(sample(testlist,1))
 }
 
 How are you generating your lists?
 
 Jim
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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

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


[R] Boxplot colors

2014-05-22 Thread Shane Carey
Hi

Im producing boxplots based on factors and rearranging them by median (This
is for a Geochemistry element). Im giving each boxplot a unique color based
on its level (factor) name.

Im trying to produce a look up list to produce these colors as the order of
the boxplots will change from element to element.

Here is by color lool up and boxplot code:

colors_list-list(Dalradian Appin Group quartzite=#00,Sperrins
Dalradian (position uncertain)=#D7D79E,
  Namurian sandstone, shale=#C7D79E,Lr-Mid Ordovocian
acid volcanics=#FFD37F,
  Tertiary granite, felsite=#FF5500,Caledonian
appinite suite=#946379,
  Dalradian Argyll Gp quartzite=#00,Slishwood
Division =#FFEDCC,
  Dalradian S Highland Gp volcanics=#00E6A9,LEITRIM
GP; Visean mudstone, sandstone=#E6,
  Dalradian Argyll Group=#FFD9C7,Metadolerite or
amphibolite=#4C7300,
  Caledonian granite=#FF7F7F,Dalradian Appin
Group=#9EAAD7,
  Lr-Mid Ordovician basic volcanics=#448970,Ordovician
Granite=#E6,
  Tertiary basic intrusion=#8400A8,Dalradian Argyll Gp
volcanics=#00E6A9,
  VISEAN \\basal clastics\\=#73A6A6,Carboniferous
volcs  minor intrus=#AAFF00,
  Metagabbro, metadiorite (Tyrone Plu=#00A885,TYRONE
GP; Visean mudstone, sandstone=#CC,
  Late Visean-Westphalian 'ORS'=#F5A27A,Dalradian S
Highland Group=#FFD9C7,
  Mid Devonian ORS=#FFD37F,Mid-Up Ordovician
slate=#C2753D,
  Interbasaltic formation laterite, b=#00,Visean
shelf limestone, shale=#FF00C5,
  Tertiary rhyolite (volcintru)=#FFEABE,COURCEYAN
\\basal clastics\\=#4D8099,
  Up Dev-Lr Carb ORS=#CDAA66,Tyrone CI
(Corvanaghan=?Slishwood=#C9FFC9,
  Visean basinal limestone \\Calp\\=#CFD6EB,Mid-Up
Ordovician g'wacke, sndst, shale=#C29ED7,
  Up Silurian - Lr Devonian ORS=#CD8966,Westphalian
shale, sandstone=#B2B2B2,
  Upper Basalt Formation=#FAC2E0,Causeway Tholeiite
Mbr=#C29ED7,
  Courceyan limestone=#73B2FF,Tertiary minor
volcanics=#E600A9,
  Silurian sandstone, g'wacke, shale=#ADE6D1,Up
Cretaceous limestone=#73FFDF,
  Lower Basalt Formation=#E0A8C7,Ballycastle
succession=#CCB3B3,
  Navan Group=#408CBF,Devonian basic volcs, minor
intrus=#A5F57A,
  Up. Ord-Sil \\Moffat shale\\
etc.=#DB,Oligocene clay, sand=#704489,
  Lr Jurassic mudstone=#704489,Lr Jurassic
mudstone=#267300,
  Mid-Up Ordovician acid volcanics=#448970,Armagh
Gp=#8073B3,
  Rathkenny Formation=#704489,Triassic
sandstone=#F7DB5E,
  Waulsortian Limestones=#B2B2B2,Permian
sandstone=#F5CA7A,
  Mid-Up Ordovician basic volcanics=#448970)


boxplot(na.omit(C_pH$DATA.pH)~bymedian,axes=FALSE,horizontal=TRUE,col=unlist(colors_list),outwex=one,whisklty
= solid,whisklwd=lwth,outcol= black, outpch=dtsym,  outcex=dtsize)

However it is not reading the colors based on the color_list given here.
Anyone know how to solve this?

Thanks for your help

-- 
Shane

[[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] K-mean Clustering URL's and ranking them according to there recent visit .

2014-05-22 Thread Ashis Deb
Hi  all   ,


   I   am  having   some  URL's   of   facebook ,youtube ,
etc .   I  would like  to   applyk-mean  clustering  algorithm on
those  URL's   which   gives   me  the  most  recomended   URL's   which
are   visited   frequently  ,   I  had  seen   some  papers   related   to
Web   crawling   using  clustering   ,but could  not   find  outhow
to  proceed   in  R  .  is there   any  package  to  do  so  .

Any  idea  would   be  much  helpful   .


Thank  You

ASHIS  DEB

[[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] solve scalar linear equation

2014-05-22 Thread message

On 2014-05-20 10:00, r-help-requ...@r-project.org wrote:

--

Message: 32
Date: Mon, 19 May 2014 23:04:27 +0100
From: Rui Barradas ruipbarra...@sapo.pt
To: message let...@openmailbox.org, r-help@r-project.org

uniroot(function(x) 5*x - 55, c(0, 20))



Why does this instruction fail if the interval is changed?


uniroot(function(x) 5*x - 55, c(0, 10))

Error in uniroot(function(x) 5 * x - 55, c(0, 10)) :
  f() values at end points not of opposite sign

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


Re: [R] Second axis on bottom of graph

2014-05-22 Thread Hurr
Sorry, I don't know enough about R to understand what you said. 
But I don't think I need to understand it.
And secondly, my reason for my stupid recent post about not finding a 
recent post was that I didn't notice that there was a little 1  2 in 
the lower right hand corner meaning that I had to select a second page.
I think it is better to start a new thread when 
that happens so others will see my post too.
Hurr



--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691042.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] solve scalar linear equation

2014-05-22 Thread Berend Hasselman

On 22-05-2014, at 12:28, message let...@openmailbox.org wrote:

 On 2014-05-20 10:00, r-help-requ...@r-project.org wrote:
 --
 Message: 32
 Date: Mon, 19 May 2014 23:04:27 +0100
 From: Rui Barradas ruipbarra...@sapo.pt
 To: message let...@openmailbox.org, r-help@r-project.org
 uniroot(function(x) 5*x - 55, c(0, 20))
 
 Why does this instruction fail if the interval is changed?
 
 uniroot(function(x) 5*x - 55, c(0, 10))
 Error in uniroot(function(x) 5 * x - 55, c(0, 10)) :
  f() values at end points not of opposite sign
 

I don’t believe this.
The error message says it all.

5*0-55 == -55
5*10-55 == -5

See the Details section of the uniroot documentation.

Berend

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

2014-05-22 Thread Rui Barradas

Hello,

Because there is no root of that function in the interval c(0, 10). Just 
like the error message says.


Rui Barradas

Em 22-05-2014 11:28, message escreveu:

On 2014-05-20 10:00, r-help-requ...@r-project.org wrote:

--

Message: 32
Date: Mon, 19 May 2014 23:04:27 +0100
From: Rui Barradas ruipbarra...@sapo.pt
To: message let...@openmailbox.org, r-help@r-project.org

uniroot(function(x) 5*x - 55, c(0, 20))



Why does this instruction fail if the interval is changed?


uniroot(function(x) 5*x - 55, c(0, 10))

Error in uniroot(function(x) 5 * x - 55, c(0, 10)) :
   f() values at end points not of opposite sign



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


Re: [R] select randomly from a list

2014-05-22 Thread Boris Steipe
You are probably encountering an annoying behaviour of sample(): when it is 
given exactly one integer as an argument, it takes this as the upper limit of a 
range.

a - c(3,5)
sample(a,10, replace=TRUE)
#[1] 5 5 3 3 3 3 3 3 3 5


a - c(5)
sample(a,10, replace=TRUE)
#[1] 2 1 3 1 1 3 4 5 1 4

#i.e. this is the same as 
sample(1:5,10, replace=TRUE)

#An easy way to catch this is:

if (length(a)  1) sample(a,1) else a 



Boris



On 2014-05-22, at 5:05 AM, Jim Lemon wrote:

 On Thu, 22 May 2014 09:54:13 AM Ragia Ibrahim wrote:
 Hi,
 kindly I want to select randomly and item from list of items. the list
 generated in a looping process. I used sample(mylist,1) it works fine.
 BUTsome times the list have only one item. that should be chosen in 
 this
 case since there is no other one. I found that sample return different 
 item
 not included in the list thanks in advance
 RAE
 
 Hi RAE,
 This doesn't happen in an example like this:
 
 for(i in 1:5) {
 testlist-list()
 for(j in 1:i) testlist[[j]]-sample(LETTERS[1:26],1)
 cat(list is\n)
 print(testlist)
 cat(sample is\n)
 print(sample(testlist,1))
 }
 
 How are you generating your lists?
 
 Jim
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Metafor: How to integrate effectsizes?

2014-05-22 Thread Verena Weinbir
Hello,

thank you very much for your replies. I am almost done :-) but theres one
study left, where I only have sample size (not group size),  mean values
and standarddeviations. Is there a way to compute cohens d from this data?

I thought it was correct to use measure=SMDH in the escalc () function to
compute cohens d? In your illustration, Wolfgang, you use SMD as measure -
now I am confused ;-)

Thank you very much in advance!

Best,
Verena


On Tue, May 6, 2014 at 7:14 PM, Michael Dewey i...@aghmed.fsnet.co.ukwrote:

 At 14:23 06/05/2014, Viechtbauer Wolfgang (STAT) wrote:

 Without the sample size of a study (i.e., either the group sizes or the
 total sample size), you cannot convert the p-value to a t-value or a
 t-value to a d-value. And for studies where you have the d-value but no
 sample size, you cannot compute the corresponding sampling variance. So,
 without additional information, you cannot include these studies. Maybe
 studies where a d-value is directly reported also report a CI for the
 d-value? Then the sampling variance can be back-calculated (since a 95% CI
 for d is typically computed with d +- 1.96 sqrt(vi), where vi is the
 sampling variance).


 Verena,
 What Wolfgang says is true of course but if you have _both_ the t value
 and the p value you can backcalculate the number of degrees of freedom and
 then if you are willing to assume equal arms you have the sample sizes.

 finddf - function(t, pval) {
helper - function(df) {res - pval - pt(t, df, lower.tail = FALSE);
 res}
res - uniroot(helper, interval = c(5, 1))
res
 }

 If you call finddf with the value of t and the _one-sided_ p-value (divide
 by 2 if two-sided) it should give you a return value which, if you look at
 the element of the list called root is its estimate of the degrees of
 freedom. If you get errors from uniroot the interval supplied in the call
 may need to be widened.

 I would suggest that when you have your final dataset it would be a really
 good idea to do some model checks using plot.influence to see whether the
 studies for which you have imputed values are fundamentally different for
 some reason. This will also check your calculations as a bonus.


  Best,
 Wolfgang

  -Original Message-
  From: Verena Weinbir [mailto:vwein...@gmail.com]
  Sent: Tuesday, May 06, 2014 15:09
  To: Michael Dewey
  Cc: Viechtbauer Wolfgang (STAT); r-help@r-project.org
  Subject: Re: [R] Metafor: How to integrate effectsizes?
 
  Thank you very much for your illustration, Wolfgang! It helped me a
  lot.  And also thank you for the package-hint, Michael!

 
  Now, I have re-checked the respective studies, and there still are a
  couple of studies left, only stating cohens d, and the respective
 t-value
  and p-value - sample and group sizes are not addressed (its data from an
  older meta-analysis). Is there a way to embed these studies in my
 sample?
  Wolfgangs illustration addresses only cases in which group sizes are
  stated, if I understand you correctly...
 
  Many thanks in advance,
 
  Verena
 
  On Sat, Apr 26, 2014 at 1:38 PM, Michael Dewey i...@aghmed.fsnet.co.uk
 
  wrote:
  At 20:34 25/04/2014, Viechtbauer Wolfgang (STAT) wrote:
  If you know the d-value and the corresponding group sizes for a study,
  then it's possible to add that study to the rest of the dataset. Also,
 if
  you only know the test statistic from an independent samples t-test (or
  only the p-value corresponding to that test), it's possible to back-
  compute what the standardized mean difference is.
 
  I added an illustration of this to the metafor package website:
 
  http://www.metafor-project.org/doku.php/tips:assembling_data_smd
 
  Verena might also like to look at the compute.es package available from
  CRAN to see whether any of the conversions programmed there do the job.
 
 
  Best,
  Wolfgang
 
  --
  Wolfgang Viechtbauer, Ph.D., Statistician
  Department of Psychiatry and Psychology
  School for Mental Health and Neuroscience
  Faculty of Health, Medicine, and Life Sciences
  Maastricht University, P.O. Box 616 (VIJV1)
  6200 MD Maastricht, The Netherlands
  +31 (43) 388-4170Â | http://www.wvbauer.com

 
   -Original Message-
   From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
  project.org]
   On Behalf Of Michael Dewey
   Sent: Friday, April 25, 2014 16:23
   To: Verena Weinbir
   Cc: r-help@r-project.org
   Subject: Re: [R] Metafor: How to integrate effectsizes?
  
   At 12:33 25/04/2014, you wrote:
   Thank you very much for your reply and the book recommendation,
  Michael.
   
   Yes, I mean Cohen's d - sorry for the typo :-)
   
   Just to make this sure for me: There is no
   possibility to integrate stated Cohens' ds in an
   R-Metaanalysis (or a MA at all), if there is no
   further information traceable regarding SE or the like?
  
   If there is really no other information like
   sample sizes, significance level, value of some
   significance test then you would have to 

[R] Non-convergence in boot.stepAIC function with a logit model

2014-05-22 Thread Justin Michell
Hi all

I am getting warning when I try to perform a bootstrap selection procedure on 
variables (using boot.stepAIC function in the bootStepAIC package). I had 
previously established which variables were collinear and kept the one which 
had the lowest AIC following univariate regression on each predictor. I obtain 
a candidate list of variables that are not correlated at the end of this 
procedure. I then revisit those variables that were excluded at each step using 
bootstrapping. I have referred to other list questions (such as 
http://stackoverflow.com/questions/8596160/why-am-i-getting-algorithm-did-not-converge-and-fitted-prob-numerically-0-or)
 and I see that this is a common problem with logit models, but convergence 
fails only in a bootstrapping context. 

For the first set of previously excluded variables, I added individually each 
variable to candidate list of variables and then performed bootstrapping, and 
then added more than one variable to see if the algorithm would converge. 
Sometimes it did other times not (as indicated by ‘dc’). I suppose the presence 
of multicollinearity affects this process?

From the next group  on of excluded variables I only really considered adding 
variables separately one at a time and then checked if there was an 
improvement in AIC. If one of the previously excluded variables is in the 
candidate list, then i take that variable out and add the previously excluded 
one and see if there is an improvement in AIC. 

From this reasoning I end up adding two new variables to the list. They are 
not correlated with any of the variables in candidate list, nor are they 
correlated.  

My question is, is this a valid way to come up with my best set of predictors? 
Is there a way I can monitor more closely what is going on, i.e. if 
multicollinearity in is mathematically causing the algorithm not to converge 
for some variables? 

Here is my workflow using the boot.stepAIC function in the the forward stepwise 
direction (the forward direction seems to be more robust w.r.t convergence):  

(if reproducible code is required I can happily provide it - via dropbox for 
the data)

#kept altitude (15454.23) (but not in candidate list) and excluded: 
# meanTemp (14422.72), minTemp (14435.72), bio1 (14767.88), bio6 (didn't 
converge (dc)), bio8 (15050.46), bio10 (14285.46), bio11 (14655.82), bio18 
(15445.24), bio10+bio11 (dc), # bio10 + bio11 + # bio18 (dc), bio10+bio18 (dc), 
meanTemp + bio10+bio11 (14160.33), minTemp + bio10+bio11 (14204.41), meanTemp + 
minTemp + bio10+bio11 (14135.49), meanTemp+minTemp + bio10+bio11+bio1(dc),
# bio10+bio11+bio1(dc)

fit.1 - glm(Pos/Examind ~ bio13 + bio15 + bio2 + bio3 + DstTClW + bio4 + NDVI 
+ bio5 + bio9 + bio10, weights = Examind, data = spatialVars, family=binomial)

bootGLM.1 - boot.stepAIC(fit.1, spatialVars, direction = backward, alpha = 
0.05, B = 1000)  #15445.24

# add bio10 (lowest AIC - 14285.46)
# (backward drection dc)


# kept bio2 and excluded: bio7 (dc), -bio2 + bio7 (14710.04), -bi02 - bio10 + 
bio7 (15676.62)
fit.2 - glm(Pos/Examind ~ bio13 + bio15 + bio2 + bio3 + DstTClW + bio4 + NDVI 
+ bio5 + bio9 + bio10, weights = Examind, data = spatialVars, 
family=binomial) #15302.59

bootGLM.2 - boot.stepAIC(fit.2, spatialVars, direction = forward, alpha = 
0.05, B = 1000)  

# keep bio2 in candidate list (+bio10)

# kept bio5 and excluded: altitude (dc), -bio5 + altitude (15659.26), -bio5 
+maxTemp (15637.91) 
fit.3 - glm(Pos/Examind ~ bio13 + bio15 + bio2 + bio3 + DstTClW + bio4 + NDVI 
+ bio5 + bio9 + bio10, weights = Examind, data = spatialVars, 
family=binomial) 

bootGLM.3 - boot.stepAIC(fit.3, spatialVars, direction = forward, alpha = 
0.05, B = 1000)  

# keep bio5 in candidate list (+bio10)

# kept bio17 (not in candidate list) (bio17 (14178.88)) and excluded: bio12 
(dc), bio14 (14168.77), bio16 (14287.42), bio19 (14248.65), rain (14287.45), 
bio17+bio12(14162.3)
fit.4 - glm(Pos/Examind ~ bio13 + bio15 + bio2 + bio3 + DstTClW + bio4 + NDVI 
+ bio5 + bio9 + bio10 + rain, weights = Examind, data = spatialVars, 
family=binomial) 

bootGLM.4 - boot.stepAIC(fit.4, spatialVars, direction = forward, alpha = 
0.05, B = 1000) 

# add bio14 to candiate list (+bio10)

# keptp bio15 (14168.77) (not included in candidate list) and excluded: bio17 
(14161.03)
fit.5 - glm(Pos/Examind ~ bio13 + bio15 + bio2 + bio3 + DstTClW + bio4 + NDVI 
+ bio5 + bio9 + bio10 + bio14, weights = Examind, data = spatialVars, 
family=binomial) 

bootGLM.5 - boot.stepAIC(fit.5, spatialVars, direction = forward, alpha = 
0.05, B = 1000) 

Thanks very much (for any help, advice or thoughts)
Justin 


[[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] solve scalar linear equation

2014-05-22 Thread message

On 2014-05-22 11:00, Berend Hasselman wrote:



uniroot(function(x) 5*x - 55, c(0, 10))

Error in uniroot(function(x) 5 * x - 55, c(0, 10)) :
 f() values at end points not of opposite sign



I don’t believe this.
The error message says it all.

5*0-55 == -55
5*10-55 == -5



The error states opposite sign, which suggests to a rudimentary novice 
that end points (0 and 10, or 0 and 20) must give results of the 
function such that one value is negative, another value is positive. Or 
is this interpretation wrong?



See the Details section of the uniroot documentation.



The documentation states that the upper end point (in this example 10, 
or 20) must be strictly larger than the lower point (0). What is being 
mis-understood please?


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


Re: [R] Second axis on bottom of graph

2014-05-22 Thread Jeff Newmiller
Sarah's perhaps-too-clever comments had nothing to do with R, and everything to 
do with the fact that Nabble misleadingly suggests to you that this mailing 
list is hosted at their website. Very few of the participants on this EMAIL 
LIST use Nabble, so we don't have any idea about the troubles you may be having 
or the web page buttons you write about, and your mention of these issues is 
OFF TOPIC. Please read the Posting Guide.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On May 22, 2014 3:31:02 AM PDT, Hurr hill0...@umn.edu wrote:
Sorry, I don't know enough about R to understand what you said. 
But I don't think I need to understand it.
And secondly, my reason for my stupid recent post about not finding a 
recent post was that I didn't notice that there was a little 1  2 in 
the lower right hand corner meaning that I had to select a second page.
I think it is better to start a new thread when 
that happens so others will see my post too.
Hurr



--
View this message in context:
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691042.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] multiple colour to symbols using brkdn.plot()

2014-05-22 Thread Luigi Marongiu
 Dear all,
I have been plotting response variable (defined as y in the example
below) from 4 groups (defined as z variable ) under 5 conditions
(defined by the x variable). The formula used is: y ~ z+x.
I can differentiate the different z value using a call pch=c(symbol 1,
symbol 2, ...) but it would be even better to have different colours
for each of these symbols.
In analogy to the pch=c(symbol 1, symbol 2, ...) i have tired to
provide a bg(colour 1, colour 2, ...) but this give the colour to the
x variables rather than the z ones.
How can I give the colour to the z variables?

best regards,
Luigi


# code:
my.data-structure(list(
  row = 1:60,
  x = c(
0, 0, 0, 1, 1, 1, 2, 2, 2,
3, 3, 3, 4, 4, 4, 0, 0, 0,
1, 1, 1, 2, 2, 2, 3, 3, 3,
4, 4, 4, 0, 0, 0, 1, 1, 1,
2, 2, 2, 3, 3, 3, 4, 4, 4,
3, 3, 3, 0, 0, 0, 1, 1, 1,
2, 2, 2, 3, 3, 3, 4, 4, 4),
  y = c(
2073.928223, 2131.830067, 2131.830067, 0.143912883,
2191.348468, 2073.928223, 2117.20479, 2017.59903, 1896.388977,
1976.358448, 2003.757427, 1883.378928, 2283.756186,
2363.732429, 2315.416732, 2206.485917, 2191.348468,
2176.314869, 1990.010783, 2059.700178, 1976.358448,
617.4528799, 613.2168858, 617.4528799, 1686.950197,
1819.655315, 1832.225173, 1480.122531, 1298.652866,
1212.260417, 495.3736815, 505.7106218, 538.0337432,
383.9842946, 365.919416, 330.0195927, 505.7106218,
541.7503854, 498.7956356, 512.7214729, 584.3675585,
564.5956413, 604.8318804, 604.8318804, 592.4688595,
1272.107849, 1298.652866, 1298.652866, 1935.96084,
2088.254554, 1962.799773, 4452.994159, 4422.444691,
4128.243033, 312.3359691, 316.6659968, 332.2993098,
1500.642011, 1531.95584, 1430.042989),
  z = c(
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3)),
 row.names = c(NA, -60L),  class = data.frame)
attach(my.data)
### *** PLOT DATA *** ###
# open library
 library(plotrix)
par(mfrow = c(1, 2))
brkdn.plot(
  y ~ z+x,data=my.data, mct=mean, md=sd,
  stagger=NA, dispbar=TRUE,
  type=p, pch=c(0, 1, 2, 5),
  main=z indicated by symbol ,
  xlab=expression(bold(x)),
  ylab=expression(bold(y))
 )
brkdn.plot(
  y ~ z+x,data=my.data, mct=mean, md=sd,
  stagger=NA, dispbar=TRUE,
  type=p, pch=c(21, 21, 21, 21), bg=c(blue, green, red, orange),
  main=z indicated by colour (???),
  xlab=expression(bold(x)),
  ylab=expression(bold(y))
 )

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


Re: [R] How to compute a P-value for a complex mixture of chi-squared distributions in R

2014-05-22 Thread Duncan Murdoch

On 01/06/2013, 12:26 AM, Tiago V. Pereira wrote:

Hello, R users!

I am struggling with the following problem:

I need to compute a P-value for a mixture of two chi-squared
distributions. My P-value is given by:

P = 0.5*prob(sqrt(chi2(1)) = x) + 0.5*prob(sqrt(chi2(2)) = x)


Isn't this simply

0.5*pchisq(x^2, df=1) + 0.5*pchisq(x^2, df=2)

?

Duncan Murdoch



In words, I need to compute the p-value for 50–50 mixture of the square
root of a chi-squared random variable with 1 degree of freedom and the
square root of a chi-squared with two degrees of freedom.

Although I can quickly simulate data, the P-values I am looking for are at
the tail of the distribution, that is, alpha levels below 10^-7. Hence,
simulation is not efficient.

Are you aware of smart approach?


All the best,

Tiago

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] manual installation errors; install.package, R CMD

2014-05-22 Thread message

Readers,

As root user, from the command:

install.packages()

A dialogue window appears to select packages of interest. What to do if 
a specific packages exists on the cran page 
(http://cran.r-project.org/web/packages/available_packages_by_name.html), 
but not in the dialogue window of a repository?


Sometimes, a dependent package is reported as being un-available, e.g.:


install.packages(mclust)

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

Alternatively, tried the command 'R CMD':

R CMD INSTALL 
http://cran.r-project.org/src/contrib/ChemoSpec_1.61-3.tar.gz
Warning: invalid package 
‘http://cran.r-project.org/src/contrib/ChemoSpec_1.61-3.tar.gz’

Error: ERROR: no packages specified

The FAQ web page 
(http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-add_002don-packages-be-installed_003f) 
states that the above syntax should be accepted.


What is my mistake please?

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


Re: [R] solve scalar linear equation

2014-05-22 Thread Rui Barradas

Hello,
See inline.

Em 22-05-2014 13:35, message escreveu:

On 2014-05-22 11:00, Berend Hasselman wrote:



uniroot(function(x) 5*x - 55, c(0, 10))

Error in uniroot(function(x) 5 * x - 55, c(0, 10)) :
 f() values at end points not of opposite sign



I don’t believe this.
The error message says it all.

5*0-55 == -55
5*10-55 == -5



The error states opposite sign, which suggests to a rudimentary novice
that end points (0 and 10, or 0 and 20) must give results of the
function such that one value is negative, another value is positive. Or
is this interpretation wrong?


No, it's not. This is basic Math.




See the Details section of the uniroot documentation.



The documentation states that the upper end point (in this example 10,
or 20) must be strictly larger than the lower point (0). What is being
mis-understood please?


I believe that Berend was trying to have you read that The function 
values at the endpoints must be of opposite signs (or zero), for 
extendInt=no, the default.


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

2014-05-22 Thread Berend Hasselman

On 22-05-2014, at 14:35, message let...@openmailbox.org wrote:

 On 2014-05-22 11:00, Berend Hasselman wrote:
 uniroot(function(x) 5*x - 55, c(0, 10))
 Error in uniroot(function(x) 5 * x - 55, c(0, 10)) :
 f() values at end points not of opposite sign
 I don’t believe this.
 The error message says it all.
 5*0-55 == -55
 5*10-55 == -5
 
 The error states opposite sign, which suggests to a rudimentary novice that 
 end points (0 and 10, or 0 and 20) must give results of the function such 
 that one value is negative, another value is positive. Or is this 
 interpretation wrong?
 

No. It is exactly what the error message says. Both function values are 
negatieve i.e. not of opposite sign.
Which is why you got the error message.

 See the Details section of the uniroot documentation.
 
 The documentation states that the upper end point (in this example 10, or 20) 
 must be strictly larger than the lower point (0). What is being 
 mis-understood please?
 

Read the sentences after the first.

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


Re: [R] manual installation errors; install.package, R CMD

2014-05-22 Thread Sarah Goslee
Hi,

On Thu, May 22, 2014 at 8:48 AM, message let...@openmailbox.org wrote:
 Readers,

 As root user, from the command:

 install.packages()

 A dialogue window appears to select packages of interest. What to do if a
 specific packages exists on the cran page
 (http://cran.r-project.org/web/packages/available_packages_by_name.html),
 but not in the dialogue window of a repository?

 Sometimes, a dependent package is reported as being un-available, e.g.:

 install.packages(mclust)

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

It's possible that a package is not available for your OS or version
of R, but you don't tell us either.

 Alternatively, tried the command 'R CMD':

 R CMD INSTALL http://cran.r-project.org/src/contrib/ChemoSpec_1.61-3.tar.gz
 Warning: invalid package
 ‘http://cran.r-project.org/src/contrib/ChemoSpec_1.61-3.tar.gz’
 Error: ERROR: no packages specified

 The FAQ web page
 (http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-add_002don-packages-be-installed_003f)
 states that the above syntax should be accepted.

 What is my mistake please?

That FAQ doesn't say that R is capable of downloading it for you: you
need to download the package manually, then use R CMD INSTALL to
install the *local* package.

Sarah


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

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


[R] Fwd: problem importing apparently common txt files

2014-05-22 Thread zuzana zajkova
Dear list,

I would like to import into R studio txt files coming from Adobe photoshop.
These files contain different measures. The files are apparently common txt
files with columns separate by tab.  However with common function
read.table the import process doesn't work and weird symbols appear once
imported.  An example file is attached.

Do you have any idea what it is happening?

Thank you in advance

Zuzana



Here just a view of a file.
DocumentoLongitudÁnguloÁreaAlturaAnchura
6143066.17.4.12.DSC_0001.png8.832613-90.00
6143066.17.4.12.DSC_0001.png8.93791890.337288
6143066.17.4.12.DSC_0001.png551.10310916.736842
52.543860
6143066.17.4.12.DSC_0002.png8.942544-89.662891
6143066.17.4.12.DSC_0002.png8.994992-90.00
6143066.17.4.12.DSC_0002.png550.14650716.736842
52.491228
6106937.17.4.12.DSC_0004.png12.159715-89.008611
DocumentoLongitud  ÁnguloÁrea  Altura
Anchura
6143066.17.4.12.DSC_0001.png  8.832613  -90.00
6143066.17.4.12.DSC_0001.png  8.937918  90.337288 
6143066.17.4.12.DSC_0001.png  551.10310916.736842 
52.543860
6143066.17.4.12.DSC_0002.png  8.942544  -89.662891
6143066.17.4.12.DSC_0002.png  8.994992  -90.00
6143066.17.4.12.DSC_0002.png  550.14650716.736842 
52.491228
6106937.17.4.12.DSC_0004.png  12.159715 -89.008611
6106937.17.4.12.DSC_0004.png  12.054468 -88.54
6106937.17.4.12.DSC_0004.png  574.21083417.526316 
52.192982
6106937.17.4.12.DSC_0005.png  12.210640 -89.753112
6106937.17.4.12.DSC_0005.png  12.316239 -89.510454
6106937.17.4.12.DSC_0005.png  573.66912917.561404 
52.122807
6188609.17.4.12.DSC_0009.png  13.268267 -91.590146
6188609.17.4.12.DSC_0009.png  13.319529 -91.357689
6188609.17.4.12.DSC_0009.png  526.27516215.491228 
52.438596
6188609.17.4.12.DSC_0010.png  13.196761 -91.371180
6188609.17.4.12.DSC_0010.png  13.231048 -91.215643
6188609.17.4.12.DSC_0010.png  526.78085615.491228 
52.385965
6143090.15.4.12.DSC_0013.png  12.140351 -90.00
6143090.15.4.12.DSC_0013.png  12.00 -90.00
6143090.15.4.12.DSC_0013.png  610.21083418.421053 
52.596491
6143090.15.4.12.DSC_0014.png  12.090731 -89.750728
6143090.15.4.12.DSC_0014.png  11.992736 -90.00
6143090.15.4.12.DSC_0014.png  610.64112018.245614 
52.649123
6195159.14.5.12.DSC_0017.png  16.742131 -88.559723
6195159.14.5.12.DSC_0017.png  16.847362 -88.568721
6195159.14.5.12.DSC_0017.png  630.46506620.473684 
55.684211
6195159.14.5.12.DSC_0018.png  16.797712 -88.205510
6195159.14.5.12.DSC_0018.png  16.846130 -88.747572
6195159.14.5.12.DSC_0018.png  630.21699020.491228 
55.684211
6175701.15.4.12.DSC_0021.png  14.732429 -101.116408   
6175701.15.4.12.DSC_0021.png  14.629281 -101.195797   
6175701.15.4.12.DSC_0021.png  518.33271818.298246 
53.614035
6175701.15.4.12.DSC_0022.png  14.780985 -101.703689   
6175701.15.4.12.DSC_0022.png  14.801433 -101.064184   
6175701.15.4.12.DSC_0022.png  517.61588218.245614 
53.508772
6134530.15.4.12.DSC_0025.png  10.868923 -94.025757
6134530.15.4.12.DSC_0025.png  10.865356 -93.748940
6134530.15.4.12.DSC_0025.png  569.84641418.649123 
54.526316
6134530.15.4.12.DSC_0026.png  10.902122 -93.875406
6134530.15.4.12.DSC_0026.png  10.899807 -93.691386
6134530.15.4.12.DSC_0026.png  570.21329618.67 
54.456140
6140703.DSC_0029.png  13.057253 -94.469557
6140703.DSC_0029.png  13.019577 -94.327648
6140703.DSC_0029.png  507.53031716.157895 
51.473684
6140703.DSC_0030.png  12.981982 -94.184916
6140703.DSC_0030.png  13.086967 -94.151285
6140703.DSC_0030.png  507.12526916.157895 
51.736842
6140725.15.4.12.DSC_0033 - copia.png  14.174917 -95.682369

6140725.15.4.12.DSC_0033 - copia.png  14.213342 -95.809112

6140725.15.4.12.DSC_0033 - copia.png  583.036627
20.894737 54.017544

Re: [R] manual installation errors; install.package, R CMD

2014-05-22 Thread message

On 2014-05-22 13:08, Sarah Goslee wrote:


It's possible that a package is not available for your OS or version
of R, but you don't tell us either.



For the record, GNU/Linux R2110



That FAQ doesn't say that R is capable of downloading it for you: you
need to download the package manually, then use R CMD INSTALL to
install the *local* package.



For the benefit of other novices, that help page should state that the 
term path refers to _local_path. Thanks anyway.


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

2014-05-22 Thread arun
Hi,

Check if this works:
 dat1 - read.table(folder2.txt, 
header=TRUE,stringsAsFactors=FALSE,sep=\t,fileEncoding=UTF-16)


'data.frame':    79 obs. of  6 variables:
 $ Documento: chr  6143066.17.4.12.DSC_0001.png 
6143066.17.4.12.DSC_0001.png 6143066.17.4.12.DSC_0001.png 
6143066.17.4.12.DSC_0002.png ...
 $ Longitud : num  8.83 8.94 NA 8.94 8.99 ...
 $ Ángulo   : num  -90 90.3 NA -89.7 -90 ...
 $ Área : num  NA NA 551 NA NA ...
 $ Altura   : num  NA NA 16.7 NA NA ...
 $ Anchura  : num  NA NA 52.5 NA NA ...



A.K.


On Thursday, May 22, 2014 9:11 AM, zuzana zajkova zuzu...@gmail.com wrote:
Dear list,

I would like to import into R studio txt files coming from Adobe photoshop.
These files contain different measures. The files are apparently common txt
files with columns separate by tab.  However with common function
read.table the import process doesn't work and weird symbols appear once
imported.  An example file is attached.

Do you have any idea what it is happening?

Thank you in advance

Zuzana



Here just a view of a file.
Documento    Longitud    Ángulo    Área    Altura    Anchura
6143066.17.4.12.DSC_0001.png    8.832613    -90.00
6143066.17.4.12.DSC_0001.png    8.937918    90.337288
6143066.17.4.12.DSC_0001.png            551.103109    16.736842
52.543860
6143066.17.4.12.DSC_0002.png    8.942544    -89.662891
6143066.17.4.12.DSC_0002.png    8.994992    -90.00
6143066.17.4.12.DSC_0002.png            550.146507    16.736842
52.491228
6106937.17.4.12.DSC_0004.png    12.159715    -89.008611
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] subsetting to exclude different values for each subject in study

2014-05-22 Thread Monaly Mistry
Hi,

I've written a code to determine the difference in score for a single
subject and its non-neighbours

o-(ao[,c(13,5)]) ##this is the table with the relevant information
o-na.omit(o)  ##omitted data with NA
o-o[!o$NestkastNummer %in% c(176,140,162,713),] ##removed neighbours
XO[7,1]-abs((XO[1,176]-(mean(o[,COR_LOC]  #difference between that
individual and average non-neighbours scores

Since each subject has a different number of non-neighbours I was wondering
if there is an efficient way of writing the code, instead of writing the
same code again and again (76 subjects) for each subject and its
non-neighbours.


Best,

Monaly.

[[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] Boxplot colors

2014-05-22 Thread Richard M. Heiberger
## Shane,

## This uses your color_list.   Your other variables weren't included
in the email
## so I invented some data.

## I recommend bwplot() using panel=panel.bwplot.superpose

## and I also show how to use boxplot()


## install.packages(HH) ## if necessary.
library(HH)
## install.packages(reshape2) ## if necessary.
library(reshape2)

## you didn't include data, so I am making up some data
pH - data.frame(matrix(rnorm(200), 10, 20))

bwplot(value ~ variable, data=melt(pH), col=unlist(colors_list),
   panel=panel.bwplot.superpose, groups=variable)

boxplot(value ~ variable, data=melt(pH), col=unlist(colors_list))

## Rich

On Thu, May 22, 2014 at 5:50 AM, Shane Carey careys...@gmail.com wrote:
 Hi

 Im producing boxplots based on factors and rearranging them by median (This
 is for a Geochemistry element). Im giving each boxplot a unique color based
 on its level (factor) name.

 Im trying to produce a look up list to produce these colors as the order of
 the boxplots will change from element to element.

 Here is by color lool up and boxplot code:

 colors_list-list(Dalradian Appin Group quartzite=#00,Sperrins
 Dalradian (position uncertain)=#D7D79E,
   Namurian sandstone, shale=#C7D79E,Lr-Mid Ordovocian
 acid volcanics=#FFD37F,
   Tertiary granite, felsite=#FF5500,Caledonian
 appinite suite=#946379,
   Dalradian Argyll Gp quartzite=#00,Slishwood
 Division =#FFEDCC,
   Dalradian S Highland Gp volcanics=#00E6A9,LEITRIM
 GP; Visean mudstone, sandstone=#E6,
   Dalradian Argyll Group=#FFD9C7,Metadolerite or
 amphibolite=#4C7300,
   Caledonian granite=#FF7F7F,Dalradian Appin
 Group=#9EAAD7,
   Lr-Mid Ordovician basic volcanics=#448970,Ordovician
 Granite=#E6,
   Tertiary basic intrusion=#8400A8,Dalradian Argyll Gp
 volcanics=#00E6A9,
   VISEAN \\basal clastics\\=#73A6A6,Carboniferous
 volcs  minor intrus=#AAFF00,
   Metagabbro, metadiorite (Tyrone Plu=#00A885,TYRONE
 GP; Visean mudstone, sandstone=#CC,
   Late Visean-Westphalian 'ORS'=#F5A27A,Dalradian S
 Highland Group=#FFD9C7,
   Mid Devonian ORS=#FFD37F,Mid-Up Ordovician
 slate=#C2753D,
   Interbasaltic formation laterite, b=#00,Visean
 shelf limestone, shale=#FF00C5,
   Tertiary rhyolite (volcintru)=#FFEABE,COURCEYAN
 \\basal clastics\\=#4D8099,
   Up Dev-Lr Carb ORS=#CDAA66,Tyrone CI
 (Corvanaghan=?Slishwood=#C9FFC9,
   Visean basinal limestone \\Calp\\=#CFD6EB,Mid-Up
 Ordovician g'wacke, sndst, shale=#C29ED7,
   Up Silurian - Lr Devonian ORS=#CD8966,Westphalian
 shale, sandstone=#B2B2B2,
   Upper Basalt Formation=#FAC2E0,Causeway Tholeiite
 Mbr=#C29ED7,
   Courceyan limestone=#73B2FF,Tertiary minor
 volcanics=#E600A9,
   Silurian sandstone, g'wacke, shale=#ADE6D1,Up
 Cretaceous limestone=#73FFDF,
   Lower Basalt Formation=#E0A8C7,Ballycastle
 succession=#CCB3B3,
   Navan Group=#408CBF,Devonian basic volcs, minor
 intrus=#A5F57A,
   Up. Ord-Sil \\Moffat shale\\
 etc.=#DB,Oligocene clay, sand=#704489,
   Lr Jurassic mudstone=#704489,Lr Jurassic
 mudstone=#267300,
   Mid-Up Ordovician acid volcanics=#448970,Armagh
 Gp=#8073B3,
   Rathkenny Formation=#704489,Triassic
 sandstone=#F7DB5E,
   Waulsortian Limestones=#B2B2B2,Permian
 sandstone=#F5CA7A,
   Mid-Up Ordovician basic volcanics=#448970)


 boxplot(na.omit(C_pH$DATA.pH)~bymedian,axes=FALSE,horizontal=TRUE,col=unlist(colors_list),outwex=one,whisklty
 = solid,whisklwd=lwth,outcol= black, outpch=dtsym,  outcex=dtsize)

 However it is not reading the colors based on the color_list given here.
 Anyone know how to solve this?

 Thanks for your help

 --
 Shane

 [[alternative HTML version deleted]]

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

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


Re: [R] How to compute a P-value for a complex mixture of chi-squared distributions in R

2014-05-22 Thread peter dalgaard

On 22 May 2014, at 14:44 , Duncan Murdoch murdoch.dun...@gmail.com wrote:

 On 01/06/2013, 12:26 AM, Tiago V. Pereira wrote:
 Hello, R users!
 
 I am struggling with the following problem:
 
 I need to compute a P-value for a mixture of two chi-squared
 distributions. My P-value is given by:
 
 P = 0.5*prob(sqrt(chi2(1)) = x) + 0.5*prob(sqrt(chi2(2)) = x)
 
 Isn't this simply
 
 0.5*pchisq(x^2, df=1) + 0.5*pchisq(x^2, df=2)
 

...as suggested by yours truly in 2011! ( :-o ???!!!)
 


On Jun 12, 2011, at 03:36 , Thomas Lumley wrote:

 On Sun, Jun 12, 2011 at 12:44 PM, Tiago Pereira
 tiago.pere...@mbe.bio.br wrote:
 
 The test I am working on has an asymptotic 0.5*chi2(1)+0.5*chi2(2)
 distribution, where numbers inside parenthesis stand for the degrees of
 freedom. Is is possible to compute quickly in R the cumulative distribution
 of that distribution?
 
 
 There appear to be pchibar() functions in both the ibdreg and ic.infer
 packages that should do want you want.  Simulation is also fairly
 efficient.

Assuming that you mean a 50-50 mixture of the two, it should also work just to 
take the average of the two CDFs. The integral is a linear operator after all. 

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School

 ?
 
 Duncan Murdoch
 
 
 In words, I need to compute the p-value for 50–50 mixture of the square
 root of a chi-squared random variable with 1 degree of freedom and the
 square root of a chi-squared with two degrees of freedom.
 
 Although I can quickly simulate data, the P-values I am looking for are at
 the tail of the distribution, that is, alpha levels below 10^-7. Hence,
 simulation is not efficient.
 
 Are you aware of smart approach?
 
 
 All the best,
 
 Tiago
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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.

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

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


Re: [R] subsetting to exclude different values for each subject in study

2014-05-22 Thread Monaly Mistry
Hi,

Sorry I'm fairly new to R and I don't really understand using dput(), when
you say reproducible example do you mean the code with the output?

Best,

Monaly.


On Thu, May 22, 2014 at 4:03 PM, arun smartpink...@yahoo.com wrote:

 Hi,

 It would be helpful if you provide a reproducible example using ?dput().

 A.K.




 On Thursday, May 22, 2014 10:15 AM, Monaly Mistry monaly.mis...@gmail.com
 wrote:
 Hi,

 I've written a code to determine the difference in score for a single
 subject and its non-neighbours

 o-(ao[,c(13,5)]) ##this is the table with the relevant information
 o-na.omit(o)  ##omitted data with NA
 o-o[!o$NestkastNummer %in% c(176,140,162,713),] ##removed neighbours
 XO[7,1]-abs((XO[1,176]-(mean(o[,COR_LOC]  #difference between that
 individual and average non-neighbours scores

 Since each subject has a different number of non-neighbours I was wondering
 if there is an efficient way of writing the code, instead of writing the
 same code again and again (76 subjects) for each subject and its
 non-neighbours.


 Best,

 Monaly.

 [[alternative HTML version deleted]]

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



[[alternative HTML version deleted]]

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


Re: [R] Voronoi-Diagrams in R

2014-05-22 Thread Raphael Päbst
Hello again,
I have found further depths of confusion concerning delaunay
triangulations to explore.

Here is the code I'm using to create the confusing results:

bm - getbm(x) # a data.frame with 2 columns and 800 rows, values are
integers ranging from 1 to 82

del - deldir(bm) # creating an object of type deldir with the 800
coordinates from bm
tri - triang.list(del) # creating a list of length n, holding the n
triangles created by the delaunay triangulation with deldir(bm) as
data.frames

geodel - delaunayn(bm) # creating a matrix with 3 columns and m rows
for the m triangles created by the delaunay triangulation using
delaunayn(bm) from geometry-package

now, the following is what I would expect: n and m should be the same,
since both triangulations should give me the same number of triangles,
right?

but this is what I get:

nrow(geodel) = 1584
length(tri) = 1186

This confuses me and I have the feeling I have left out some very
important parameter either in delaunayn() or deldir() to create the
different results.
There is however more confusion to come, this time in the result of
triang.list(del):

Every element in that list is a data.frame holding information on one
triangle. It has 3 columns and 3 rows with column headers 'ptNum', 'x'
and 'y'. Now I would expect, that 'ptNum' would give me the index at
which I can find the coordinates 'x' and 'y' as a row in my original
data.frame of coordinates, bm. And for example

bm[1,] gives me the same 'x' and 'y' that are listed in data.frame
tri[1] as 'ptNum' = 1.
But for some other points this does not work and for example the 'x'
and 'y' of 'ptNum' = 129 do not match bm[129, ]. Have I totally
misunderstood the meaning of 'ptNum' in this case or does my mistake
lie somewhere else?

Once again please excuse my slightly chaotic description of my
problems and my faulty english and thanks for any help you can give!

Raphael

On 5/21/14, Rolf Turner r.tur...@auckland.ac.nz wrote:
 On 21/05/14 23:34, Raphael Päbst wrote:
 I believe you are right. A night of sleep has done wonders for my
 understanding of the problem.

 Oh sleep it is a gentle thing
 Beloved from pole to pole!

 Thank you for your patience and help!

 Patience?  Moi?  This must be some new use of the word patience with
 which I am not familiar! :-)

 Glad your tessellations are working out.

 cheers,

 Rolf



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


Re: [R] subsetting to exclude different values for each subject in study

2014-05-22 Thread Bert Gunter
Follow the link at the bottom of this message!

-- Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Thu, May 22, 2014 at 8:31 AM, Monaly Mistry monaly.mis...@gmail.com wrote:
 Hi,

 Sorry I'm fairly new to R and I don't really understand using dput(), when
 you say reproducible example do you mean the code with the output?

 Best,

 Monaly.


 On Thu, May 22, 2014 at 4:03 PM, arun smartpink...@yahoo.com wrote:

 Hi,

 It would be helpful if you provide a reproducible example using ?dput().

 A.K.




 On Thursday, May 22, 2014 10:15 AM, Monaly Mistry monaly.mis...@gmail.com
 wrote:
 Hi,

 I've written a code to determine the difference in score for a single
 subject and its non-neighbours

 o-(ao[,c(13,5)]) ##this is the table with the relevant information
 o-na.omit(o)  ##omitted data with NA
 o-o[!o$NestkastNummer %in% c(176,140,162,713),] ##removed neighbours
 XO[7,1]-abs((XO[1,176]-(mean(o[,COR_LOC]  #difference between that
 individual and average non-neighbours scores

 Since each subject has a different number of non-neighbours I was wondering
 if there is an efficient way of writing the code, instead of writing the
 same code again and again (76 subjects) for each subject and its
 non-neighbours.


 Best,

 Monaly.

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


Re: [R] converting a matrix to array

2014-05-22 Thread arun

Hi,
Try:
mat - 
as.matrix(read.csv(R.csv,header=TRUE,stringsAsFactors=FALSE,sep=\t,row.names=1))
pdf(Hist_colwise.pdf)
lst1 - lapply(seq_len(ncol(mat)),function(i) {x- mat[,i,drop=FALSE]; hist(x, 
main=paste(Histogram of, colnames(x)))})
dev.off()

##or may be this would be another way to look at the data
library(reshape2)
library(ggplot2)
 dat - melt(mat)


pdf(Hist_all.pdf, width=14)
ggplot(dat, aes(x=Var2, y=value, 
fill=Var1))+geom_histogram(stat=identity,position=dodge)+
 theme(legend.position = none)+
 xlab() +
 theme(axis.line = element_line(colour = black),
 panel.grid.major = element_blank(),
 panel.grid.minor = element_blank(),
 panel.border = element_blank(),
 panel.background = element_blank()) 
dev.off()



A.K.


On Thursday, May 22, 2014 10:48 AM, Effat Habibi habibi...@gmail.com wrote:



Thanks. I think columnwise histogram should be fine. Can you please help me 
with the commands for making that?
On May 22, 2014 2:21 AM, arun smartpink...@yahoo.com wrote:

Hi Effat,

Sorry, I was a bit busy.  I did read the data. 


mat - 
as.matrix(read.csv(R.csv,header=TRUE,stringsAsFactors=FALSE,sep=\t,row.names=1))
 is.matrix(mat)
#[1] TRUE

 head(mat,2)
  COG0001H COG0002E COG0003P COG0004P COG0005F COG0006E COG0007H
NC_014218   NA   NA   NA   NA  274  502   NA
NC_013501  437  345   NA  458  284  364  271
  COG0008J COG0009J COG0010E COG0011S COG0012J COG0013J COG0014E
NC_014218  427  212   NA  103  365  890   NA
NC_013501  500  317  316   NA  366  953   NA
  COG0015F
NC_014218  479
NC_013501  431



I am not sure I understand what you really wanted.  In the matrix example I 
showed, I did the table for all the elements of the matrix.  Do you want a 
columnwise histogram or a rowwise histogram??

A.K.



On Tuesday, May 20, 2014 1:29 PM, Effat Habibi habibi...@gmail.com wrote:



Thanks, it works. But this histogram doesn't show any information about my 
data,
I want to make an informative histogram of my data which tells about length of 
different COGs across 
the genome. 






__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Post-hoc tests on linear mixed model give mixed results.

2014-05-22 Thread Claire
Dear all,

I am quite new to R so apologies if I fail to ask properly. I have done a test 
comparing bat species richness in five habitats as assessed by three methods. I 
used a linear mixed model in lme4 and got habitat, method and the interaction 
between the two as significant, with the random effects explaining little 
variation.

I then ran Tukey's post hoc tests as pairwise comparisons in three ways:

Firstly in lsmeans:
lsmeans(LMM.richness, pairwise~Habitat*Method, adjust=tukey)

Then in ‘agricolae’:

tx - with(diversity, interaction(Method, Habitat))
amod - aov(Richness ~ tx, data=diversity)
library(agricolae)
interaction -HSD.test(amod, tx, group=TRUE)
interaction

Then in ghlt 'multcomp':
summary(glht(LMM.richness, linfct=mcp(Habitat=Tukey)))

summary(glht(LMM.richness, linfct=mcp(Method=Tukey)))

tuk - glht(amod, linfct = mcp(tx = Tukey))
summary(tuk)  # standard display
tuk.cld - cld(tuk)   # letter-based display
opar - par(mai=c(1,1,1.5,1))
par(mfrow=c(1,1))
plot(tuk.cld)
par(opar)

I got somewhat different levels of significance from each method, with ghlt 
giving me the greatest number of significant results and lsmeans the least. All 
the results from all packages make sense based on the graphs of the data. 

Can anyone tell me if there are underlying reasons why these tests might be 
more or less conservative, whether in any case I have failed to specify 
anything correctly or whether any of these post-hoc tests are not suitable for 
linear mixed models?

Thankyou for your time,
Claire
  
[[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] Boxplot colors

2014-05-22 Thread Shane Carey
Thanks very much, that worked superb!


On Thu, May 22, 2014 at 3:41 PM, Richard M. Heiberger r...@temple.eduwrote:

 ## Shane,

 ## This uses your color_list.   Your other variables weren't included
 in the email
 ## so I invented some data.

 ## I recommend bwplot() using panel=panel.bwplot.superpose

 ## and I also show how to use boxplot()


 ## install.packages(HH) ## if necessary.
 library(HH)
 ## install.packages(reshape2) ## if necessary.
 library(reshape2)

 ## you didn't include data, so I am making up some data
 pH - data.frame(matrix(rnorm(200), 10, 20))

 bwplot(value ~ variable, data=melt(pH), col=unlist(colors_list),
panel=panel.bwplot.superpose, groups=variable)

 boxplot(value ~ variable, data=melt(pH), col=unlist(colors_list))

 ## Rich

 On Thu, May 22, 2014 at 5:50 AM, Shane Carey careys...@gmail.com wrote:
  Hi
 
  Im producing boxplots based on factors and rearranging them by median
 (This
  is for a Geochemistry element). Im giving each boxplot a unique color
 based
  on its level (factor) name.
 
  Im trying to produce a look up list to produce these colors as the order
 of
  the boxplots will change from element to element.
 
  Here is by color lool up and boxplot code:
 
  colors_list-list(Dalradian Appin Group quartzite=#00,Sperrins
  Dalradian (position uncertain)=#D7D79E,
Namurian sandstone, shale=#C7D79E,Lr-Mid
 Ordovocian
  acid volcanics=#FFD37F,
Tertiary granite, felsite=#FF5500,Caledonian
  appinite suite=#946379,
Dalradian Argyll Gp quartzite=#00,Slishwood
  Division =#FFEDCC,
Dalradian S Highland Gp volcanics=#00E6A9,LEITRIM
  GP; Visean mudstone, sandstone=#E6,
Dalradian Argyll Group=#FFD9C7,Metadolerite or
  amphibolite=#4C7300,
Caledonian granite=#FF7F7F,Dalradian Appin
  Group=#9EAAD7,
Lr-Mid Ordovician basic
 volcanics=#448970,Ordovician
  Granite=#E6,
Tertiary basic intrusion=#8400A8,Dalradian Argyll
 Gp
  volcanics=#00E6A9,
VISEAN \\basal
 clastics\\=#73A6A6,Carboniferous
  volcs  minor intrus=#AAFF00,
Metagabbro, metadiorite (Tyrone Plu=#00A885,TYRONE
  GP; Visean mudstone, sandstone=#CC,
Late Visean-Westphalian 'ORS'=#F5A27A,Dalradian S
  Highland Group=#FFD9C7,
Mid Devonian ORS=#FFD37F,Mid-Up Ordovician
  slate=#C2753D,
Interbasaltic formation laterite, b=#00,Visean
  shelf limestone, shale=#FF00C5,
Tertiary rhyolite (volcintru)=#FFEABE,COURCEYAN
  \\basal clastics\\=#4D8099,
Up Dev-Lr Carb ORS=#CDAA66,Tyrone CI
  (Corvanaghan=?Slishwood=#C9FFC9,
Visean basinal limestone
 \\Calp\\=#CFD6EB,Mid-Up
  Ordovician g'wacke, sndst, shale=#C29ED7,
Up Silurian - Lr Devonian ORS=#CD8966,Westphalian
  shale, sandstone=#B2B2B2,
Upper Basalt Formation=#FAC2E0,Causeway Tholeiite
  Mbr=#C29ED7,
Courceyan limestone=#73B2FF,Tertiary minor
  volcanics=#E600A9,
Silurian sandstone, g'wacke, shale=#ADE6D1,Up
  Cretaceous limestone=#73FFDF,
Lower Basalt Formation=#E0A8C7,Ballycastle
  succession=#CCB3B3,
Navan Group=#408CBF,Devonian basic volcs, minor
  intrus=#A5F57A,
Up. Ord-Sil \\Moffat shale\\
  etc.=#DB,Oligocene clay, sand=#704489,
Lr Jurassic mudstone=#704489,Lr Jurassic
  mudstone=#267300,
Mid-Up Ordovician acid volcanics=#448970,Armagh
  Gp=#8073B3,
Rathkenny Formation=#704489,Triassic
  sandstone=#F7DB5E,
Waulsortian Limestones=#B2B2B2,Permian
  sandstone=#F5CA7A,
Mid-Up Ordovician basic volcanics=#448970)
 
 
 
 boxplot(na.omit(C_pH$DATA.pH)~bymedian,axes=FALSE,horizontal=TRUE,col=unlist(colors_list),outwex=one,whisklty
  = solid,whisklwd=lwth,outcol= black, outpch=dtsym,  outcex=dtsize)
 
  However it is not reading the colors based on the color_list given here.
  Anyone know how to solve this?
 
  Thanks for your help
 
  --
  Shane
 
  [[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.




-- 
Shane

[[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] Post-hoc tests on linear mixed model give mixed results.

2014-05-22 Thread Bert Gunter
Wrong list! This does not concern R programming.

Post on the r-sig-mixed-models list instead in **PLAIN TEXT** rather than html.

Cheers,
Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Thu, May 22, 2014 at 6:52 AM, Claire c.word...@live.com wrote:
 Dear all,

 I am quite new to R so apologies if I fail to ask properly. I have done a 
 test comparing bat species richness in five habitats as assessed by three 
 methods. I used a linear mixed model in lme4 and got habitat, method and the 
 interaction between the two as significant, with the random effects 
 explaining little variation.

 I then ran Tukey's post hoc tests as pairwise comparisons in three ways:

 Firstly in lsmeans:
 lsmeans(LMM.richness, pairwise~Habitat*Method, adjust=tukey)

 Then in ‘agricolae’:

 tx - with(diversity, interaction(Method, Habitat))
 amod - aov(Richness ~ tx, data=diversity)
 library(agricolae)
 interaction -HSD.test(amod, tx, group=TRUE)
 interaction

 Then in ghlt 'multcomp':
 summary(glht(LMM.richness, linfct=mcp(Habitat=Tukey)))

 summary(glht(LMM.richness, linfct=mcp(Method=Tukey)))

 tuk - glht(amod, linfct = mcp(tx = Tukey))
 summary(tuk)  # standard display
 tuk.cld - cld(tuk)   # letter-based display
 opar - par(mai=c(1,1,1.5,1))
 par(mfrow=c(1,1))
 plot(tuk.cld)
 par(opar)

 I got somewhat different levels of significance from each method, with ghlt 
 giving me the greatest number of significant results and lsmeans the least. 
 All the results from all packages make sense based on the graphs of the data.

 Can anyone tell me if there are underlying reasons why these tests might be 
 more or less conservative, whether in any case I have failed to specify 
 anything correctly or whether any of these post-hoc tests are not suitable 
 for linear mixed models?

 Thankyou for your time,
 Claire

 [[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] How do I move the axis labels precisely

2014-05-22 Thread Hurr
#trying for both period-labeled and frequency labeled horizontal axis 
rm(list=ls(all=TRUE))
install.packages('plotrix')
library(plotrix)
staxlab-function(side=1,at,labels,nlines=2,top.line=0.5,
 line.spacing=0.8,srt=NA,ticklen=0.03,adj=1,...) {
 if(missing(labels)) labels-at
 nlabels-length(labels)
 if(missing(at)) at-1:nlabels
 axislim-par(usr)[3:4-2*side%%2]
 if(any(at  axislim[1]) || any(at  axislim[2]))
  warning(Some axis labels are off the plot)
 if(is.na(srt)) {
  linepos-rep(top.line,nlines)
  for(i in 2:nlines) linepos[i]-linepos[i-1]+line.spacing
  linepos-rep(linepos,ceiling(nlabels/nlines))[1:nlabels]
  axis(side=side,at=at,labels=rep(,nlabels))
  mtext(text=labels,side=side,line=linepos,at=at,...)
 }
 else {
  linewidth-strheight(M)
  xylim-par(usr)
  if(side == 1) {
   xpos-at
   if(par(ylog)) ypos-10^(xylim[3]-ticklen*(xylim[4]-xylim[3]))
   else ypos-xylim[3]-ticklen*(xylim[4]-xylim[3])-top.line*linewidth
  }
  if(side == 3) {
   xpos-at
   if(par(ylog)) ypos-10^(xylim[4]+ticklen*(xylim[4]-xylim[3]))
   else ypos-xylim[4]+ticklen*(xylim[4]-xylim[3])+top.line*linewidth
  }
  if(side == 2) {
   ypos-at
   if(par(xlog)) xpos-10^(xylim[1]-ticklen*(xylim[2]-xylim[1]))
   else xpos-xylim[1]-ticklen*(xylim[2]-xylim[1])-top.line*linewidth
  }
  if(side == 4) {
   ypos-at
   if(par(xlog)) xpos-10^(xylim[2]+ticklen*(xylim[2]-xylim[1]))
   else xpos-xylim[2]+ticklen*(xylim[2]-xylim[1])+top.line*linewidth
  }
  par(xpd=TRUE)
  text(xpos,ypos,labels,srt=srt,adj=adj,...)
  par(xpd=FALSE)
 }
}
horAxisLims=c(0,7213); print(horAxisLims) 
par(mar=c(8,4,4,2)+.1,lheight=0.7)  #margins=c(bot,lef,top,rit);
default:c(5,4,4,2)+.1 
#vertical text space = char height * character expansion * lheight 
#set only by
par():ask,fig,fin,lheight,mai,mar,mex,mfcol,mfrow,mfg,new,oma,omd,omi,pin,plt,ps,pty,usr,xlog,ylog,ylbias
 
prdAxDistDown=0; frqAxDistDown=3.5; 
verData=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
#not fussy 
horData=c(1,300,800,1200,1700,2100,2900,3400,3800,4300,4800,5200,5600,6100,6500,7000)
#not at tics 
prdTicLocs=c(1,365.,1252,1461,1753,2191,2922,4383,7000)
prdLabels=c(1Yr,1Da,7Hr,6Hr,5Hr,4Hr,3Hr,2Hr,1.25\nHr);
print(prdLabels) 
nFrqTicInvls=9; frqTicLocs - vector(length=nFrqTicInvls+1); frqLabels -
vector(length=nFrqTicInvls+1); 
frqInvl=(horAxisLims[2]-horAxisLims[1])/nFrqTicInvls 
for(i in 1:(nFrqTicInvls+1))frqTicLocs[i]=horAxisLims[1]+(i-1)*frqInvl 
for(i in
1:(nFrqTicInvls+1))frqLabels[i]=format(round(frqTicLocs[i]),digits=4,trim=TRUE,scientific=FALSE)
 
print(frqLabels) 
#default mgp=c(3,1,0) margin line in mex units
c(axisTitle,axisLabel,axisLine) 
las=2; #las=2 makes axis labels perpendicular to axis 
plot(horData,verData,xaxt='n',xlim=horAxisLims,xlab=) 
#tck if = 0.5 then fraction of relevant side; if =1 then gridlines 
axis(1,tick=TRUE,line=prdAxDistDown,at=prdTicLocs,labels=rep(,length(prdLabels)),padj=0,tck=-.08)
staxlab(1,top.line=(prdAxDistDown),at=prdTicLocs,labels=prdLabels,srt=90,adj=c(1,0))
 
axis(1,tick=TRUE,line=frqAxDistDown,at=frqTicLocs,labels=rep(,length(frqLabels)),padj=0,tck=-.08)
 
staxlab(1,top.line=(frqAxDistDown),at=frqTicLocs,labels=frqLabels,srt=90,adj=c(1,0))
 
title(xlab=Cycles/Yr,line=6)




--
View this message in context: 
http://r.789695.n4.nabble.com/How-do-I-move-the-axis-labels-precisely-tp4691082.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Running the cox model in R, through python or unix.

2014-05-22 Thread AoifeM
Hi guys, 

I have a piece of R code. Example code:

R
library(survival)
ReadTable - read.table(TestFile,header=F)
CoxModel -coxph(Surv(V1)~V2+V3+V4+V5,data=ReadTable)
summary(CoxModel)
plot(survfit(CoxModel))

I have to run this on 100 files, instead of 1 TestFile, and get outputs of
100 plots and summaries, instead of one summary and plot.

Would anyone know how to run this set of R commands in a shell script on
unix, or through a python script? I've been trying to understand Rpy2, PypeR
and pyRserve, but I was wondering if someone had come across this before,
and could show me a simple example of running R commands (such as those
above) through unix or python.

Many thanks
Aoife





--
View this message in context: 
http://r.789695.n4.nabble.com/Running-the-cox-model-in-R-through-python-or-unix-tp4691077.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] Questions in R about optim( ) and optimize( )

2014-05-22 Thread Prof J C Nash (U30A)
You need to provide reproducible examples if you want to get readers to
actually give you answers.

The two issues both come up from time to time and generally relate to
how the objective function is set up, though sometimes to options in the
call. However, generally really isn't good enough.

JN



 Date: Wed, 21 May 2014 20:37:10 +
 From: Gao, Vicky v...@panagora.com
 To: 'r-help@r-project.org' r-help@r-project.org
 Subject: [R] Questions in R about optim( ) and optimize( )
 Message-ID:
   e6231a6c907f1e4ebdc773df7f92327cdfe...@exmailbox1.panagora.com
 Content-Type: text/plain
 
 Hello,
 
 I would be really thankful if I could bother you with two questions.
 
 1.  I ran into some problems when I used the code optim() in my work. I 
 used it to optimize a function-fn(x,y), where x is a two-dimensional 
 parameter.  For y I want to pass the value later when I use optim(), because 
 it needs to be inside of a loop, which changes the value of y every time.
 
 For (point in 100:500){
   
   optim(c(0,0.5),fn,p=point)
   
}
 
 But it always turned to be Error in fn(par, ...) : argument p is missing, 
 with no default.  I'm confused about this, is that caused by optim() has 
 some specific requirements towards the objective function?
 
 2.  I'm also confused about optimize() actually.  My code is like: 
 optimize(f,c(0,0.99),b=1.0,p=point). I have nothing wrong when I run it, 
 but the result is not accurate enough. Like I got the $minimum as 0.39 from 
 the interval as above (0,0.99), however, I got 0.87 when I change it to 
 (0.2,0.99), 0.96 for (0.3, 0.99). And the only thing I changed is the 
 interval value, so I'm not sure what I should do to improve it.
 
 As above, could you help me with these two problems? I would really 
 appreciate that if you could give me some information.
 
 Thank you very much! I look forward for your reply soon.
 
 Vicky
 
 
   [[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] Fwd: problem importing apparently common txt files

2014-05-22 Thread zuzana zajkova
Thank you! It seems to work.

Zuzana

On 22 May 2014 15:47, arun smartpink...@yahoo.com wrote:

 Hi,

 Check if this works:
  dat1 - read.table(folder2.txt,
 header=TRUE,stringsAsFactors=FALSE,sep=\t,fileEncoding=UTF-16)


 'data.frame':79 obs. of  6 variables:
  $ Documento: chr  6143066.17.4.12.DSC_0001.png
 6143066.17.4.12.DSC_0001.png 6143066.17.4.12.DSC_0001.png
 6143066.17.4.12.DSC_0002.png ...
  $ Longitud : num  8.83 8.94 NA 8.94 8.99 ...
  $ Ángulo   : num  -90 90.3 NA -89.7 -90 ...
  $ Área : num  NA NA 551 NA NA ...
  $ Altura   : num  NA NA 16.7 NA NA ...
  $ Anchura  : num  NA NA 52.5 NA NA ...



 A.K.


 On Thursday, May 22, 2014 9:11 AM, zuzana zajkova zuzu...@gmail.com
 wrote:
 Dear list,

 I would like to import into R studio txt files coming from Adobe photoshop.
 These files contain different measures. The files are apparently common txt
 files with columns separate by tab.  However with common function
 read.table the import process doesn't work and weird symbols appear once
 imported.  An example file is attached.

 Do you have any idea what it is happening?

 Thank you in advance

 Zuzana



 Here just a view of a file.
 DocumentoLongitudÁnguloÁreaAlturaAnchura
 6143066.17.4.12.DSC_0001.png8.832613-90.00
 6143066.17.4.12.DSC_0001.png8.93791890.337288
 6143066.17.4.12.DSC_0001.png551.10310916.736842
 52.543860
 6143066.17.4.12.DSC_0002.png8.942544-89.662891
 6143066.17.4.12.DSC_0002.png8.994992-90.00
 6143066.17.4.12.DSC_0002.png550.14650716.736842
 52.491228
 6106937.17.4.12.DSC_0004.png12.159715-89.008611
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Adding segments to a dot plot in ggplot2

2014-05-22 Thread Kate Ignatius
I'm trying to plot a GWAS (in you will) with lined segments
representing an overall p-value for each gene.  Here is my code:

skatg - ggplot(comm, aes(x = position,y = p, colour = grey)) +
 geom_point(size = 0.75) +
  geom_segment(data=rare, aes(x = txStart, y =
-log10(p), xend=txEnd,  yend = -log10(p), colour = darkgreen))   +
  labs(x = Position,y = -log10 P value) +
  facet_wrap(~ Chrom, scales = free, ncol = 4)

Where comm is a file with 250k+ variants and genes.in.locus is a file
with about 18k genes.

When running this script, I get the error

Don't know how to automatically pick scale for object of type
function. Defaulting to continuous
Error in data.frame(x = c(40840353L, 31902418L, 19468080L, 236748505L,  :
  arguments imply differing number of rows: 79746, 0

Is this because there are different number of rows in each data frame
I'm trying to plot?  If so, what is a best way to overcome this error?

Example of my data is as follows:

comm:

 Namegene Chrom   position p
1  rs1037FAM114A1 4  38924330 0.7513597
2  rs1250  CC2D2A 4  15482477 0.9202882
4  rs1911   USP38 4 144136193 0.8335902
5 rs10001  STXBP219   7711221 0.4709547
7  rs10001370   USP46 4  53463730 0.8759828
8   rs1000152  ZNF462 9 109687288 0.3451001
10 rs10002583POLN 4   2194953 0.7878575
12 rs10002971 EGF 4 110896050 0.5082255
15 rs10003873  SORBS2 4 186605868 0.2309855
16 rs10003909ARHGAP24 4  86915848 0.8714853
17 rs10003947   ANXA3 4  79512800 0.5141532
18rs10004SSR1 6   7310259 0.6851725
20 rs10004136   STX18 4   4463587 0.5296092
21 rs10004516   ENPEP 4 111398208 0.8564897
22  rs1000521  SLC8A314  70522484 0.6234326
23 rs10005849   DCHS2 4 155287317 0.8192577
24 rs10006362   RGS12 4   3319271 0.8061674
25  rs1000640WWP26  69905668 0.2682735
26 rs10006580  PCDH18 4 138449812 0.5178650
27 rs10006676   CYTL1 4   5021086 0.3531493
28 rs10006845   PCDH7 4  31116375 0.4817453
29 rs10007075   NEIL3 4 178274694 0.5433481
31 rs10008636 TMPRSS11BNL 4  69083563 0.8346434
32 rs10008910UBA6 4  68500171 0.5705853
33 rs10009228  CHRNA9 4  40356422 0.4223378


rare:

   geneName txStart  txEnd Chromposition p
36131YTHDC16026  45746 4   6026 0.5009490
10898   FAM110C   38813  46588 19  38813 1.000
37306ZNF595   53178  88099 4  53178 0.1261045
16450   KIR2DL4   57208  6812319  57208 0.156
28406SCAND3   61610  77316 6  61610 0.2568
19926   MPG  127017 1358506 127017 00.000987456
34149TRIM27  174179 195169 6 174179 0.025698

I haven't included all information here.

Any help will be greatly appreciated.

Thanks!

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


Re: [R] Variation Inflation factor for GLS

2014-05-22 Thread John Fox
Dear Laura,

I've modified vif() in the development version of the car package on R-Forge
so that it works with a wider variety of models, including gls models. Once
the package is built on R-Forge, which usually takes about a day, you can
install it via install.packages(car,
repos=http://R-Forge.R-project.org;). Eventually, the development version
of the car package will be moved to CRAN.

Best,
 John

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Laura Riggi
 Sent: Tuesday, May 20, 2014 9:27 AM
 To: r-help@R-project.org
 Subject: [R] Variation Inflation factor for GLS
 
 Dear all,
 I am running a gls and I would like to check the vif of my model. It
 seems that the vif function in the car package and the vif.mer function
 available online do not work for gls. Would you know of a method to
 measure variance inflation factors for GLS?
 Thank you
 Laura
 
 
 
   [[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] Post-hoc tests on linear mixed model give mixed results.

2014-05-22 Thread Claire
Thanks Bert,

Will post on r-sig-mixed-models list. Can't help it being in html though as i 
sent the query via -email.

Cheers
Claire

 Date: Thu, 22 May 2014 09:29:44 -0700
 Subject: Re: [R] Post-hoc tests on linear mixed model give mixed results.
 From: gunter.ber...@gene.com
 To: c.word...@live.com
 CC: r-help@r-project.org
 
 Wrong list! This does not concern R programming.
 
 Post on the r-sig-mixed-models list instead in **PLAIN TEXT** rather than 
 html.
 
 Cheers,
 Bert
 
 Bert Gunter
 Genentech Nonclinical Biostatistics
 (650) 467-7374
 
 Data is not information. Information is not knowledge. And knowledge
 is certainly not wisdom.
 H. Gilbert Welch
 
 
 
 
 On Thu, May 22, 2014 at 6:52 AM, Claire c.word...@live.com wrote:
  Dear all,
 
  I am quite new to R so apologies if I fail to ask properly. I have done a 
  test comparing bat species richness in five habitats as assessed by three 
  methods. I used a linear mixed model in lme4 and got habitat, method and 
  the interaction between the two as significant, with the random effects 
  explaining little variation.
 
  I then ran Tukey's post hoc tests as pairwise comparisons in three ways:
 
  Firstly in lsmeans:
  lsmeans(LMM.richness, pairwise~Habitat*Method, adjust=tukey)
 
  Then in ‘agricolae’:
 
  tx - with(diversity, interaction(Method, Habitat))
  amod - aov(Richness ~ tx, data=diversity)
  library(agricolae)
  interaction -HSD.test(amod, tx, group=TRUE)
  interaction
 
  Then in ghlt 'multcomp':
  summary(glht(LMM.richness, linfct=mcp(Habitat=Tukey)))
 
  summary(glht(LMM.richness, linfct=mcp(Method=Tukey)))
 
  tuk - glht(amod, linfct = mcp(tx = Tukey))
  summary(tuk)  # standard display
  tuk.cld - cld(tuk)   # letter-based display
  opar - par(mai=c(1,1,1.5,1))
  par(mfrow=c(1,1))
  plot(tuk.cld)
  par(opar)
 
  I got somewhat different levels of significance from each method, with ghlt 
  giving me the greatest number of significant results and lsmeans the least. 
  All the results from all packages make sense based on the graphs of the 
  data.
 
  Can anyone tell me if there are underlying reasons why these tests might be 
  more or less conservative, whether in any case I have failed to specify 
  anything correctly or whether any of these post-hoc tests are not suitable 
  for linear mixed models?
 
  Thankyou for your time,
  Claire
 
  [[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] Random forest proximity measure

2014-05-22 Thread Maggie Makar
Hi all,

I've been using the randomForest package on a dataset (described later) and
my problem is: even though I specify proximity= TRUE in the call I get a
NULL proximity matrix. Any thoughts on why that may happen?

Unfortunately I can't post my dataset, which is particularly problematic
here since i believe that's where the problem is. So I'll try to give as
detailed of an account as i can.

The outcome is binary, highly skewed with the positive outcome being 1.5%
of the data.
The dataset has ~7000 observations and 200 predictors. these are either 2
level factors or continuous variables. Extremely sparse.

Here is my call:

#i pass a balanced dataset for each tree, to deal with the skewed outcome.
rf-randomForest(y~. ,data=train, ntree=800,replace=TRUE,sampsize = c(112,
112), proximilty=TRUE)



Any ideas on why im getting a null proximity measure/ solutions?

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.


[R] Zip multiple files with same prefix?

2014-05-22 Thread mr_kirkwood
I have thousands of files that need to be zipped. The files that need to be
zipped together have the same seven digit prefix e.g. 40111h1. 

I am a novice at R-Studio and would appreciate some help on this matter. 

Thanks!



--
View this message in context: 
http://r.789695.n4.nabble.com/Zip-multiple-files-with-same-prefix-tp4691088.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] equivalent of R CMD BATCH --vanilla for those who can't do anything non-GUI?

2014-05-22 Thread Charles Geyer
For a Google Group about aster models, I want to say that people wanting
help are best advised to provide an example that works as

R CMD BATCH --vanilla foo.R

but I realize that many R users have zero idea of how to start R in any way
other than clicking on an icon.  Is there a way to start up the standard
mac and windows GUIs or Rstudio with no loaded saved global environment?
(Without making it impossible to go back to what they were doing before?)

Is there a way to make the source function do the job (ignore everything in
the global environment)?

What do you tell users about how to make an example that doesn't assume
there is huge amounts of crap that the user doesn't even remember what it
is that is involved?

Do I just have to explain the command line to all the GUI fans?

-- 
Charles Geyer
Professor, School of Statistics
University of Minnesota
char...@stat.umn.edu

[[alternative HTML version deleted]]

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


Re: [R] equivalent of R CMD BATCH --vanilla for those who can't do anything non-GUI?

2014-05-22 Thread Greg Snow
You could have them spawn a vanilla R session using system instead of
the command line:

system('R CMD BATH --vanilla foo.R')

Or you could use the local argument to source to evaluate in a new
environment that does not inherit from the global environment:

source('foo.R', local=new.env(parent=parent.env(.GlobalEnv)))

this will prevent the code seeing anything in the global environment,
but it could still use functions/objects from any loaded packages.

On Thu, May 22, 2014 at 3:00 PM, Charles Geyer char...@stat.umn.edu wrote:
 For a Google Group about aster models, I want to say that people wanting
 help are best advised to provide an example that works as

 R CMD BATCH --vanilla foo.R

 but I realize that many R users have zero idea of how to start R in any way
 other than clicking on an icon.  Is there a way to start up the standard
 mac and windows GUIs or Rstudio with no loaded saved global environment?
 (Without making it impossible to go back to what they were doing before?)

 Is there a way to make the source function do the job (ignore everything in
 the global environment)?

 What do you tell users about how to make an example that doesn't assume
 there is huge amounts of crap that the user doesn't even remember what it
 is that is involved?

 Do I just have to explain the command line to all the GUI fans?

 --
 Charles Geyer
 Professor, School of Statistics
 University of Minnesota
 char...@stat.umn.edu

 [[alternative HTML version deleted]]

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



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

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


Re: [R] subsetting to exclude different values for each subject in study

2014-05-22 Thread Monaly Mistry
Hi Everyone,

I hope I did this correctly (I called my data frame ao) and Thank you very
much for the info about using dput(), I'm starting to understand all the
different things that can be done in R and I appreciate all the advice.  I
must appologize in advance since my coding is quite long but hopefully it
makes sense. and there is a efficient way to do this.

structure(list(num = 1:99, FORM_CHK = c(20870L, 22018L, 30737L,
22010L, 22028L, 36059L, 36063L, 36066L, 30587L, 30612L, 36056L,
30376L, 35153L, 30435L, 30536L, 30486L, 30475L, 36053L, 36048L,
36076L, 36045L, 36065L, 35772L, 36949L, 35702L, 36894L, 36080L,
35542L, 35457L, 35533L, 36042L, 36925L, 36827L, 36008L, 35817L,
36350L, 35985L, 35973L, 35801L, 36639L, 35810L, 35812L, 35807L,
36351L, 35967L, 35944L, 37006L, 36345L, 36062L, 36077L, 35802L,
35984L, 36043L, 35769L, 36360L, 36082L, 36071L, 36354L, 35771L,
35754L, 36295L, 35746L, 36064L, 35779L, 35751L, 35752L, 35785L,
35792L, 37011L, 36003L, 36040L, 36831L, 36031L, 36652L, 36992L,
36965L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA), RingNummerMan = structure(c(1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L,
16L, 17L, 19L, 22L, 23L, 24L, 25L, 26L, 27L, 29L, 30L, 31L, 34L,
35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 46L, 47L, 48L,
49L, 50L, 51L, 52L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 63L,
65L, 67L, 69L, 70L, 73L, 74L, 75L, 76L, 78L, 79L, 80L, 81L, 82L,
83L, 85L, 86L, 87L, 88L, 89L, 93L, 96L, 97L, 18L, 20L, 21L, 28L,
32L, 33L, 45L, 53L, 62L, 64L, 66L, 68L, 71L, 72L, 77L, 84L, 90L,
91L, 92L, 94L, 95L, 98L, 99L), .Label = c(AJ...75425, AL...62371,
AR...11060, AR...29297, AR...29307, AR...29502, AR...29504,
AR...29507, AR...30039, AR...30085, AR...30165, AR...30491,
AR...30563, AR...30616, AR...30652, AR...30687, AR...30701,
AR...30927, AR...30959, AR...30963, AR...30964, AR...30965,
AR...30966, AR...30985, AR...30988, AR...40917, AR...40996,
AR...45735, AR...45904, AR...45928, AR...47609, AR...65387,
AR...65479, AR...65550, AR...65629, AR...65948, AR...86074,
AR...86521, AR...86527, AR...90061, AR...90064, AR...90067,
AR...90077, AR...90081, AR...90098, AR...90101, AR...90106,
AR...90112, AR...90133, AR...90155, AR...90176, AR...90178,
AR...90180, AR...90187, AR...90212, AR...90247, AR...90252,
AR...90256, AR...90258, AR...90269, AR...90272, AR...90275,
AR...90294, AR...90298, AR...90300, AR...90337, AR...90338,
AR...90367, AR...90397, AR...90410, AR...90463, AR...90520,
AR...90544, AR...90556, AR...90678, AR...90712, AR...90737,
AR...90744, AR...90829, AR...90862, AR...90863, AR...90873,
AR...90880, AR...90892, AR...90898, AR...90945, AR...90951,
AR...90965, AR...90970, AR...90972, AU...15008, AU...15009,
AU...15027, AU...15032, AU...15036, AU...15038, AU...15046,
AU...15049, AU...15505), class = factor), year_score_taken = c(2006L,
2008L, 2009L, 2008L, 2008L, 2011L, 2011L, 2011L, 2009L, 2009L,
2011L, 2009L, 2010L, 2009L, 2009L, 2009L, 2009L, 2011L, 2011L,
2011L, 2011L, 2011L, 2011L, 2012L, 2011L, 2012L, 2011L, 2010L,
2010L, 2010L, 2011L, 2012L, 2012L, 2011L, 2011L, 2012L, 2011L,
2011L, 2011L, 2012L, 2011L, 2011L, 2011L, 2012L, 2011L, 2011L,
2013L, 2012L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2012L,
2012L, 2011L, 2012L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
2011L, 2011L, 2011L, 2011L, 2013L, 2011L, 2011L, 2012L, 2011L,
2012L, 2012L, 2012L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), COR_LOC = c(15.13404,
13.88054, 30.0969, 19.09152, 16.88054, 14.15718, 39.15718, 16.15718,
16.13566, 23.07538, 39.15718, 24.56838, 12.13942, 21.4123, 19.06945,
12.33264, 32.48872, 30.15718, 37.15718, 37.15718, 49.15718, 22.15718,
18.50272, 23.69432, 24.9322, 47.29712, 41.15718, 21.47903, 38.6588,
34.99572, 28.15718, 13.08614, 16.71908, 22.68894, 19.2616, 15.96234,
22.83964, 13.89992, 14.2616, 18.17118, 24.2616, 22.2616, 13.2616,
23.96234, 24.89992, 24.05062, 10.20884, 6.96234, 13.15718, 17.15718,
40.2616, 21.83964, 20.15718, 39.50272, 26.81164, 20.3843, 14.15718,
7.96234, 19.50272, 40.74384, 5.7675, 42.95482, 29.15718, 18.32188,
28.74384, 37.74384, 22.32188, 25.32188, 18.20884, 14.68894, 22.15718,
39.71908, 18.2067, 15.1109, 15.61466, 47.4532, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA), IndividuID = c(11394L, 15676L, 342518L, 344902L,
344909L, 377497L, 377499L, 377504L, 352003L, 351986L, 352260L,
352392L, 353800L, 353892L, 353949L, 354060L, 354074L, 377487L,
377490L, 377511L, 377513L, 377495L, 377297L, 357796L, 366326L,
378446L, 377518L, 358157L, 358730L, 366215L, 377519L, 378407L,
378453L, 377443L, 377358L, 377726L, 377422L, 377402L, 377341L,
378354L, 377350L, 377352L, 377347L, 378408L, 377396L, 377374L,
34L, 377743L, 377500L, 377510L, 377342L, 377421L, 377786L,
377294L, 377836L, 378291L, 377508L, 378199L, 377296L, 377280L,
373000L, 373020L, 377496L, 377306L, 373025L, 377278L, 377310L,
377317L, 377337L, 377439L, 377450L, 377464L, 

Re: [R] How do I move the axis labels precisely

2014-05-22 Thread Hurr
I included runnable code to help demonstrate what I want to do but
Sorry in my rush I forgot to include this request:
I want to move the x axis labels to make the right end close to 
the axis with a very small gap, and the bottom close to the 
tick with an even smaller gap. 
The staxlab function to be standard soon was sent to me by 
the author to make staxlab work on the second x axis.
Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/How-do-I-move-the-axis-labels-precisely-tp4691082p4691095.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] equivalent of R CMD BATCH --vanilla for those who can't do anything non-GUI?

2014-05-22 Thread Duncan Murdoch

On 22/05/2014, 5:00 PM, Charles Geyer wrote:

For a Google Group about aster models, I want to say that people wanting
help are best advised to provide an example that works as

R CMD BATCH --vanilla foo.R

but I realize that many R users have zero idea of how to start R in any way
other than clicking on an icon.  Is there a way to start up the standard
mac and windows GUIs or Rstudio with no loaded saved global environment?
(Without making it impossible to go back to what they were doing before?)


On Windows, you can copy the shortcut, and edit it to add a --vanilla 
option to the command line.




Is there a way to make the source function do the job (ignore everything in
the global environment)?


Only in the way Greg said:  start a new R process to run it.



What do you tell users about how to make an example that doesn't assume
there is huge amounts of crap that the user doesn't even remember what it
is that is involved?


I just ask for a minimal, self-contained example.  You won't always 
get that, but I suspect people won't always follow your --vanilla 
instructions, either.


Duncan Murdoch



Do I just have to explain the command line to all the GUI fans?



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


Re: [R] Post-hoc tests on linear mixed model give mixed results.

2014-05-22 Thread Rolf Turner

On 23/05/14 06:59, Claire wrote:

Thanks Bert,

Will post on r-sig-mixed-models list. Can't help it being in html
though as i sent the query via -email.


Huh?  What do you mean by -email?  Do you really mean email (without 
the minus sign)? We *all* send our queries via email.  This *is* email. 
 Set your expletive deleted email *not* to post in html!!!


cheers,

Rolf

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


Re: [R] HMM states simulation

2014-05-22 Thread Rolf Turner

On 22/05/14 21:38, Baba Bukar wrote:

Dear all,

I have 100 observations sampled from poisson and negative binomial
distributions and i want set a hidden states for the observations, class
with zero and one {0,1}. Larger observations to be one and smaller
observations to be zero using R.

Can someone please help?


No, I don't think anyone can help you.  You question is too ill-posed, 
incoherent and garbled.


If you can actually explain what you want to do, in meaningful terms, 
then some *might* be able to help.  However I suspect that you really 
have no clear idea of what you want to do, and/or what you want to do 
makes no sense at all.


cheers,

Rolf Turner

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


Re: [R] Voronoi-Diagrams in R

2014-05-22 Thread Rolf Turner


I just tried the following:

require(deldir)
require(geometry)
set.seed(42)
bm - data.frame(x=sample(1:82,800,TRUE),y=sample(1:82,800,TRUE))
del - deldir(bm)
tri - triang.list(del)
geodel - delaunayn(bm)
length(tri) # Got [1] 1481
dim(geodel) # Got [1] 14813

So all seems to be in harmony in the universe.

Something is weird about your bm; hard to say what without seeing it.

One thought:  Are there any duplicated points in your bm?  (Upon 
re-reading your message and noting the problem with ptNum, I think 
this might be the case.)


Try doing something like:

newbm - bm[!duplicated(bm),]

and then hit newbm with both deldir() and delaunayn().

cheers,

Rolf Turner

On 23/05/14 03:36, Raphael Päbst wrote:

Hello again,
I have found further depths of confusion concerning delaunay
triangulations to explore.

Here is the code I'm using to create the confusing results:

bm - getbm(x) # a data.frame with 2 columns and 800 rows, values are
integers ranging from 1 to 82

del - deldir(bm) # creating an object of type deldir with the 800
coordinates from bm
tri - triang.list(del) # creating a list of length n, holding the n
triangles created by the delaunay triangulation with deldir(bm) as
data.frames

geodel - delaunayn(bm) # creating a matrix with 3 columns and m rows
for the m triangles created by the delaunay triangulation using
delaunayn(bm) from geometry-package

now, the following is what I would expect: n and m should be the same,
since both triangulations should give me the same number of triangles,
right?

but this is what I get:

nrow(geodel) = 1584
length(tri) = 1186

This confuses me and I have the feeling I have left out some very
important parameter either in delaunayn() or deldir() to create the
different results.
There is however more confusion to come, this time in the result of
triang.list(del):

Every element in that list is a data.frame holding information on one
triangle. It has 3 columns and 3 rows with column headers 'ptNum', 'x'
and 'y'. Now I would expect, that 'ptNum' would give me the index at
which I can find the coordinates 'x' and 'y' as a row in my original
data.frame of coordinates, bm. And for example

bm[1,] gives me the same 'x' and 'y' that are listed in data.frame
tri[1] as 'ptNum' = 1.
But for some other points this does not work and for example the 'x'
and 'y' of 'ptNum' = 129 do not match bm[129, ]. Have I totally
misunderstood the meaning of 'ptNum' in this case or does my mistake
lie somewhere else?

Once again please excuse my slightly chaotic description of my
problems and my faulty english and thanks for any help you can give!


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


Re: [R] multiple colour to symbols using brkdn.plot()

2014-05-22 Thread Jim Lemon
On Thu, 22 May 2014 01:43:23 PM Luigi Marongiu wrote:
  Dear all,
 I have been plotting response variable (defined as y in the example
 below) from 4 groups (defined as z variable ) under 5 conditions
 (defined by the x variable). The formula used is: y ~ z+x.
 I can differentiate the different z value using a call pch=c(symbol 1,
 symbol 2, ...) but it would be even better to have different colours
 for each of these symbols.
 In analogy to the pch=c(symbol 1, symbol 2, ...) i have tired to
 provide a bg(colour 1, colour 2, ...) but this give the colour to the
 x variables rather than the z ones.
 How can I give the colour to the z variables?
 
Hi Luigi,
Very good example. The brkdn.plot function assigns colors to the group 
variable based upon the col argument. Try using this:

brkdn.plot(y~z+x,
  data=my.data, mct=mean, md=sd,
  stagger=NA, dispbar=TRUE,
  type=p, pch=20, col=2:6,
  main=z indicated by colour (???),
  xlab=x,ylab=y,cex=2)

Jim

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


Re: [R] subsetting to exclude different values for each subject in study

2014-05-22 Thread Monaly Mistry
Hi,

Neighbours in this case were selected if they shared a boundary in the
voroni tesellation.

Best,
Monaly
On May 23, 2014 3:19 AM, arun smartpink...@yahoo.com wrote:



 HI Monaly,
 Thanks for the code and dput.  But, I have a doubt about how you are
selecting the neigbours.  Is there another dataset with the information?
Sorry, if I have missed something
 For e.g.
 ### average difference b/n neighbours for each individual
 XO[avg, 176]- mean(abs((XO[1,176])-XO[1,c(140,162,713)]))


 A.K.


 On Thursday, May 22, 2014 5:21 PM, Monaly Mistry monaly.mis...@gmail.com
wrote:
 Hi Everyone,

 I hope I did this correctly (I called my data frame ao) and Thank you very
 much for the info about using dput(), I'm starting to understand all the
 different things that can be done in R and I appreciate all the advice.  I
 must appologize in advance since my coding is quite long but hopefully it
 makes sense. and there is a efficient way to do this.

 structure(list(num = 1:99, FORM_CHK = c(20870L, 22018L, 30737L,
 22010L, 22028L, 36059L, 36063L, 36066L, 30587L, 30612L, 36056L,
 30376L, 35153L, 30435L, 30536L, 30486L, 30475L, 36053L, 36048L,
 36076L, 36045L, 36065L, 35772L, 36949L, 35702L, 36894L, 36080L,
 35542L, 35457L, 35533L, 36042L, 36925L, 36827L, 36008L, 35817L,
 36350L, 35985L, 35973L, 35801L, 36639L, 35810L, 35812L, 35807L,
 36351L, 35967L, 35944L, 37006L, 36345L, 36062L, 36077L, 35802L,
 35984L, 36043L, 35769L, 36360L, 36082L, 36071L, 36354L, 35771L,
 35754L, 36295L, 35746L, 36064L, 35779L, 35751L, 35752L, 35785L,
 35792L, 37011L, 36003L, 36040L, 36831L, 36031L, 36652L, 36992L,
 36965L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
 NA, NA, NA, NA, NA, NA, NA, NA, NA), RingNummerMan = structure(c(1L,
 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L,
 16L, 17L, 19L, 22L, 23L, 24L, 25L, 26L, 27L, 29L, 30L, 31L, 34L,
 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 46L, 47L, 48L,
 49L, 50L, 51L, 52L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 63L,
 65L, 67L, 69L, 70L, 73L, 74L, 75L, 76L, 78L, 79L, 80L, 81L, 82L,
 83L, 85L, 86L, 87L, 88L, 89L, 93L, 96L, 97L, 18L, 20L, 21L, 28L,
 32L, 33L, 45L, 53L, 62L, 64L, 66L, 68L, 71L, 72L, 77L, 84L, 90L,
 91L, 92L, 94L, 95L, 98L, 99L), .Label = c(AJ...75425, AL...62371,
 AR...11060, AR...29297, AR...29307, AR...29502, AR...29504,
 AR...29507, AR...30039, AR...30085, AR...30165, AR...30491,
 AR...30563, AR...30616, AR...30652, AR...30687, AR...30701,
 AR...30927, AR...30959, AR...30963, AR...30964, AR...30965,
 AR...30966, AR...30985, AR...30988, AR...40917, AR...40996,
 AR...45735, AR...45904, AR...45928, AR...47609, AR...65387,
 AR...65479, AR...65550, AR...65629, AR...65948, AR...86074,
 AR...86521, AR...86527, AR...90061, AR...90064, AR...90067,
 AR...90077, AR...90081, AR...90098, AR...90101, AR...90106,
 AR...90112, AR...90133, AR...90155, AR...90176, AR...90178,
 AR...90180, AR...90187, AR...90212, AR...90247, AR...90252,
 AR...90256, AR...90258, AR...90269, AR...90272, AR...90275,
 AR...90294, AR...90298, AR...90300, AR...90337, AR...90338,
 AR...90367, AR...90397, AR...90410, AR...90463, AR...90520,
 AR...90544, AR...90556, AR...90678, AR...90712, AR...90737,
 AR...90744, AR...90829, AR...90862, AR...90863, AR...90873,
 AR...90880, AR...90892, AR...90898, AR...90945, AR...90951,
 AR...90965, AR...90970, AR...90972, AU...15008, AU...15009,
 AU...15027, AU...15032, AU...15036, AU...15038, AU...15046,
 AU...15049, AU...15505), class = factor), year_score_taken =
c(2006L,
 2008L, 2009L, 2008L, 2008L, 2011L, 2011L, 2011L, 2009L, 2009L,
 2011L, 2009L, 2010L, 2009L, 2009L, 2009L, 2009L, 2011L, 2011L,
 2011L, 2011L, 2011L, 2011L, 2012L, 2011L, 2012L, 2011L, 2010L,
 2010L, 2010L, 2011L, 2012L, 2012L, 2011L, 2011L, 2012L, 2011L,
 2011L, 2011L, 2012L, 2011L, 2011L, 2011L, 2012L, 2011L, 2011L,
 2013L, 2012L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2012L,
 2012L, 2011L, 2012L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
 2011L, 2011L, 2011L, 2011L, 2013L, 2011L, 2011L, 2012L, 2011L,
 2012L, 2012L, 2012L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
 NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), COR_LOC = c(15.13404,
 13.88054, 30.0969, 19.09152, 16.88054, 14.15718, 39.15718, 16.15718,
 16.13566, 23.07538, 39.15718, 24.56838, 12.13942, 21.4123, 19.06945,
 12.33264, 32.48872, 30.15718, 37.15718, 37.15718, 49.15718, 22.15718,
 18.50272, 23.69432, 24.9322, 47.29712, 41.15718, 21.47903, 38.6588,
 34.99572, 28.15718, 13.08614, 16.71908, 22.68894, 19.2616, 15.96234,
 22.83964, 13.89992, 14.2616, 18.17118, 24.2616, 22.2616, 13.2616,
 23.96234, 24.89992, 24.05062, 10.20884, 6.96234, 13.15718, 17.15718,
 40.2616, 21.83964, 20.15718, 39.50272, 26.81164, 20.3843, 14.15718,
 7.96234, 19.50272, 40.74384, 5.7675, 42.95482, 29.15718, 18.32188,
 28.74384, 37.74384, 22.32188, 25.32188, 18.20884, 14.68894, 22.15718,
 39.71908, 18.2067, 15.1109, 15.61466, 47.4532, NA, NA, NA, NA,
 NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
 NA, NA, NA), IndividuID = 

[R] Loop Issue

2014-05-22 Thread Ricardo Rocha
Hi everybody.

Consider the following exampling code: 

x=numeric()
  for(i in 1:10){
u=runif(1,-1,2)
x[i]=log(u)
  }
This code, in each interation, generates a random value in the (-1,2) interval 
and then calculates the log of the value. 
When the generated value is less than 0 the log produces a NaN, which gives a 
warning.

What I want is to make it start over when a warning is produced, in order to 
repeat it until a positive value is generated and therefore the log is 
calculated. Logically, would be like: if there's a warning here, go back at 
the beginning and start over, without changing the iteration.

Could someone help me with some directions?

Thanks a lot,

Ricardo   
[[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] Loop Issue

2014-05-22 Thread Yvan Richard
Hi Ricardo
Assuming you have a good reason to use such approach (what are you
trying to do ultimately?), you can just increment your counter when
you get a good value, i.e.:

x - numeric()
n - 0
while (n  10) {
u - log(runif(1, -1, 2))
if (is.finite(u)) {
n - n+1
x[n] - u
}
}
x

On 23 May 2014 12:11, Ricardo Rocha ricardoroch...@hotmail.com wrote:
 Hi everybody.

 Consider the following exampling code:

 x=numeric()
   for(i in 1:10){
 u=runif(1,-1,2)
 x[i]=log(u)
   }
 This code, in each interation, generates a random value in the (-1,2) 
 interval and then calculates the log of the value.
 When the generated value is less than 0 the log produces a NaN, which gives a 
 warning.

 What I want is to make it start over when a warning is produced, in order to 
 repeat it until a positive value is generated and therefore the log is 
 calculated. Logically, would be like: if there's a warning here, go back at 
 the beginning and start over, without changing the iteration.

 Could someone help me with some directions?

 Thanks a lot,

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



-- 
Yvan Richard

  DRAGONFLY Science

Physical address: Level 5, 158 Victoria St, Te Aro, Wellington
Postal address: PO Box 27535, Wellington 6141
New Zealand
Ph: 04.385.9285
web page

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