Re: [R] Problem Installign Packages

2012-08-17 Thread David Winsemius


On Aug 16, 2012, at 8:48 PM, ziad.elmou...@tnsglobal.com wrote:


To Whom It May Concern,

In attempting to install the e1071 package, I get the message  
below after selecting the mirror site.


And what was the command you issued?


-- Please select a CRAN mirror for use in this session ---
Warning: unable to access index for repository 
http://mirror.fcaglp.unlp.edu.ar/CRAN/bin/windows/contrib/2.15

I seem to have the problem with any other package that I attempt to  
install.



 Please advise.


Use a different mirror (or that mirror may have been down and will now  
work.)


--

David Winsemius, MD
Alameda, CA, USA

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


Re: [R] specific matrix element tranformation

2012-08-17 Thread Rui Barradas

Hello,

Inline

Em 17-08-2012 04:39, bantex escreveu:

Hi guys,

After a long while I came up with this :

set.seed(2)
a-matrix(rnorm(4),ncol=2)
abc-function(a)
{
b=matrix(NA,nrow=3,ncol=3)
b[1,1]=a[1,1]+1
b[1,2]=a[2,1]*a[2,2]
b[1,3]=a[2,2]+a[1,1]
b[2,1]=a[1,1]-5
b[2,2]=sqrt(a[2,2])
b[2,3]=a[1,1]/a[2,2]
b[3,1]=a[2,2]-3
b[3,2]=a[1,1]*(a[1,2]+a[2,2])
b[3,3]=sqrt(a[1,1])/a[1,2]

return(b=matrix(c(b[1,1],b[1,2],b[1,3],b[2,1],b[2,2],b[2,3],
b[3,1],b[3,2],b[3,3]),ncol=3))


You don't need to say that 'b' is a matrix a second time! And this form 
is wrong, you should add 'byrow = TRUE' since you're using row order.



}

How can I improve on it?


With your data, you would have two errors in applying function abc to 
matrix 'a'. Try the following.


fun - function(a){
b - matrix(nrow = 3, ncol = 3)
#let's say these are the transformations i wish to perform
b[1,1] - a[1,1]+1
b[1,2] - a[2,1]*a[2,2]
b[1,3] - a[2,2]+a[1,1]
b[2,1] - a[1,1]-5
if(a[2,2]  0){
warning(a[2, 2] is negative, using zero for its square root 
b[2,2].)

b[2,2] - 0
}else{
b[2,2] - sqrt(a[2,2])
}
if(a[2,2] == 0){
warning(a[2, 2] is zero, using zero for division result b[2,3].)
b[2,3] - 0
}else{
b[2,3] - a[1,1]/a[2,2]
}
b[3,1] - a[2,2]-3
b[3,2] - a[1,1]*(a[1,2]+a[2,2])
if(a[1,2] == 0){
warning(a[1, 2] is zero, using zero for division result b[3,3].)
b[3,3] - 0
}else if(a[1,1]/a[1,2]  0){
warning(a[1,1]/a[1,2] is negative, using zero for its square 
root b[3,3].)

b[3,3] - 0
}else{
b[3,3] - sqrt(a[1,1]/a[1,2])
}
b
}

set.seed(2)
a - matrix(rnorm(4),ncol = 2)
fun(a)




Cheers,
B




--
View this message in context: 
http://r.789695.n4.nabble.com/specific-matrix-element-tranformation-tp4640550p4640554.html
Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] specific matrix element tranformation

2012-08-17 Thread David Winsemius


On Aug 16, 2012, at 8:39 PM, bantex wrote:


Hi guys,

After a long while I came up with this :

set.seed(2)
a-matrix(rnorm(4),ncol=2)
abc-function(a)
{
b=matrix(NA,nrow=3,ncol=3)
b[1,1]=a[1,1]+1
b[1,2]=a[2,1]*a[2,2]
b[1,3]=a[2,2]+a[1,1]
b[2,1]=a[1,1]-5
b[2,2]=sqrt(a[2,2])
b[2,3]=a[1,1]/a[2,2]
b[3,1]=a[2,2]-3
b[3,2]=a[1,1]*(a[1,2]+a[2,2])
b[3,3]=sqrt(a[1,1])/a[1,2]

# return(b=matrix(c(b[1,1],b[1,2],b[1,3],b[2,1],b[2,2],b[2,3],
# b[3,1],b[3,2],b[3,3]),ncol=3))


 return(b)


}

How can I improve on it?

Cheers,
B




--
View this message in context: 
http://r.789695.n4.nabble.com/specific-matrix-element-tranformation-tp4640550p4640554.html
Sent from the R help mailing list archive at Nabble.com.

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


David Winsemius, MD
Alameda, CA, USA

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


Re: [R] r data structures

2012-08-17 Thread Patrick Burns

To slightly correct what's been said: In general
lists are linear objects, but a list can have
dimension.

An example is in Circle 8.1.8 of 'The R Inferno'.

http://www.burns-stat.com/pages/Tutor/R_inferno.pdf

Pat


On 16/08/2012 21:50, Schumacher, Jay S wrote:


are these correct/accurate/sensible statements:

   a vector is a one dimensional object.
   a matrix is a two dimensional object.

   a list is a one dimensional object.

i'm working from this web page:
http://www.agr.kuleuven.ac.be/vakken/statisticsbyR/someDataStructures.htm



-


On Aug 16, 2012, at 11:49 AM, Schumacher, Jay S wrote:




hi,
  i'm trying to understand r data structures.  i see that vectors,
matrix, factors and arrays have a dimension.
  there seems to be no mention of dimensionality anywhere for lists
or dataframes.  can i consider lists and frames to be of fixed
dimension 2?


About half of what you have deduced is wrong. Matrices, arrays, and
dataframes do have dimensions, at least in technical R parlance,
namely they have an attribute which can be queried with dim(). By
definition matrices and dataframes have 2 dimensions. Arrays and
matrices can be redimensioned, but dataframes cannot.

Factors, lists, and atomic vectors do not have dimensions, but they
do have lengths. An appropriately structured list (one with vectors
all the same length) can be coerced to a dataframe with as.data.frame().



--
Patrick Burns
pbu...@pburns.seanet.com
twitter: @portfolioprobe
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')

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

2012-08-17 Thread ya
 
Dear list,

 
I have a question about imputing 2 level data in MICE, could you give me some 
suggestions please? Thank you very much.

The data set contains 35634 cases and 1007 variables, 280 of them are 
categorical variables, and the rest of them are continuous variables. On the 
second level, there are 198 units. I am trying to impute missing values for 270 
categorical variables by using the principle components of all the continuous 
variables. In the JSS paper about MICE:

It requires the specification of the fixed effects, the random effects and the 
class variable. Furthermore, it assumes that the predictors contain a column of 
ones representing the intercept. Random effects are coded in the predictor 
matrix as a `2'. The class variable (only one is allowed) is coded by a `-2'.

and  

R pred[popular, ] - c(0, -2, 0, 2, 1, 2, 0) 
R imp - mice(popmis, meth = c(, , 2l.norm, , , 
+ , ), pred = pred, maxit = 1, seed = 71152)

My questions are:

1. In the above example,  only 1 variable have  missing values, so in the code, 
only one 2l.norm was specified. In my case, I have 270 categorical variables 
to be imputed, how do I do this?

2. how to designate the fixed effects, random effects and class variable in the 
above code with 2 and -2?

3. Should I add a column myself into the data set with 1 for all values for the 
intercept term? I already have the unit ID variables in the data set, should I 
change all the values of it to -2? and what does 0 and 1 in R pred[popular, 
] - c(0, -2, 0, 2, 1, 2, 0)  mean?

4. Is there any example similar to my situation please? The example in the 
paper is a quite simple case. Thank you very much.

ya
[[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] specific matrix element tranformation

2012-08-17 Thread Rui Barradas

Hello,

I've made a mistake, it's in the last if/else/if/else. Complete 
statement below.


Em 17-08-2012 06:23, Rui Barradas escreveu:

Hello,

Inline

Em 17-08-2012 04:39, bantex escreveu:

Hi guys,

After a long while I came up with this :

set.seed(2)
a-matrix(rnorm(4),ncol=2)
abc-function(a)
{
b=matrix(NA,nrow=3,ncol=3)
b[1,1]=a[1,1]+1
b[1,2]=a[2,1]*a[2,2]
b[1,3]=a[2,2]+a[1,1]
b[2,1]=a[1,1]-5
b[2,2]=sqrt(a[2,2])
b[2,3]=a[1,1]/a[2,2]
b[3,1]=a[2,2]-3
b[3,2]=a[1,1]*(a[1,2]+a[2,2])
b[3,3]=sqrt(a[1,1])/a[1,2]

return(b=matrix(c(b[1,1],b[1,2],b[1,3],b[2,1],b[2,2],b[2,3],
b[3,1],b[3,2],b[3,3]),ncol=3))


You don't need to say that 'b' is a matrix a second time! And this 
form is wrong, you should add 'byrow = TRUE' since you're using row 
order.



}

How can I improve on it?


With your data, you would have two errors in applying function abc to 
matrix 'a'. Try the following.


fun - function(a){
b - matrix(nrow = 3, ncol = 3)
#let's say these are the transformations i wish to perform
b[1,1] - a[1,1]+1
b[1,2] - a[2,1]*a[2,2]
b[1,3] - a[2,2]+a[1,1]
b[2,1] - a[1,1]-5
if(a[2,2]  0){
warning(a[2, 2] is negative, using zero for its square root 
b[2,2].)

b[2,2] - 0
}else{
b[2,2] - sqrt(a[2,2])
}
if(a[2,2] == 0){
warning(a[2, 2] is zero, using zero for division result 
b[2,3].)

b[2,3] - 0
}else{
b[2,3] - a[1,1]/a[2,2]
}
b[3,1] - a[2,2]-3
b[3,2] - a[1,1]*(a[1,2]+a[2,2])
if(a[1,2] == 0){
warning(a[1, 2] is zero, using zero for division result 
b[3,3].)

b[3,3] - 0
}else if(a[1,1]/a[1,2]  0){
warning(a[1,1]/a[1,2] is negative, using zero for its square 
root b[3,3].)

b[3,3] - 0
}else{
b[3,3] - sqrt(a[1,1]/a[1,2])
}
b
}

set.seed(2)
a - matrix(rnorm(4),ncol = 2)
fun(a)




Correction:

if(a[1,2] == 0){
warning(a[1, 2] is zero, using zero for division result b[3,3].)
b[3,3] - 0
}else if(a[1,1]  0){
warning(a[1, 1] is negative, using zero for its square root 
b[3,3].)

b[3,3] - 0
}else{
b[3,3] - sqrt(a[1,1])/a[1,2]
}

I thought it was sqrt(a[1,1]/a[1,2]).
And apparently I've also forgot to sign.

Rui Barradas



Cheers,
B




--
View this message in context: 
http://r.789695.n4.nabble.com/specific-matrix-element-tranformation-tp4640550p4640554.html

Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] multiple boxplots on the same figure - reducing space in between

2012-08-17 Thread ziqizh...@hotmail.co.uk
thanks! this solves my problem perfectly



--
View this message in context: 
http://r.789695.n4.nabble.com/multiple-boxplots-on-the-same-figure-reducing-space-in-between-tp4640503p4640570.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] no true negative data, need roc curve

2012-08-17 Thread Jessica Streicher
Okay, first of a point in ROC space is spanned by true positive rate and false 
positive rate.
Now you need to decide if you want to plot a curve for each image or maybe a 
curve for the complete data (add all together).

In your case you only have 2 thresholds, so that makes the curves a little 
awkward because you only have 4 points total, but whatever.

Lets say you want a curve for image1:
tp1-1066
fp1-70
fn1-116
tn1-0
tpr1-tp1/(tp1+fn1)
fpr1-fp1/(fp1+tn1)

tp2-446
fp2-41
fn2-55
tn2-0
tpr2-tp2/(tp2+fn2)
fpr2-fp2/(fp2+tn2)

plot(0,0,type=n,ylim=c(0,1),xlim=c(0,1))
points(c(0,fpr1,fpr2,1),c(0,tpr1,tpr2,1))
lines(c(0,fpr1,fpr2,1),c(0,tpr1,tpr2,1))

Now i have to say though, after taking a look at that data you provided: THE 
DATA IS WRONG
If you add up all values (tp+tn+fp+fn), the number in threshold 2 is lower than 
in threshold 1.

It needs to be the same, so what the hell have you DONE? ^^

greetings 
Jessi

On 16.08.2012, at 17:49, Jessica Streicher wrote:

 To clarify:
 
 Is TN = 0 or do you not know TN (N)?
 
 On 16.08.2012, at 11:51, vjyns wrote:
 
 Hi,
 
  I want to plot ROC curve for my detection algorithm which detects
 features in different images at two different thresholds.
 
 6 different images used and obtained tp, fp and fn. No tn in my case.
 
 in first threshold run i obtained 6 values of tp,fp and fn. In second
 threshold run agian i got 6 more.
 
 i had calculated tpr and fpr. How to plot ROC in this case. 
 
 Is this possible to plot ROC curve in this case? If s, please guide me to
 plot that.
 
 thank you.
 
 http://r.789695.n4.nabble.com/file/n4640474/in1.png 
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/no-true-negative-data-need-roc-curve-tp4640474.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] The message headers matched a filter rule

2012-08-17 Thread Jessica Streicher
Pretty much every time i reply to a post in this list i get a bounce saying the 
above, + waiting for approval.

I first thought it was because i didn't send in plain, but now they are and it 
hasn't become any better. Any other ideas? Is this normal?
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] no true negative data, need roc curve

2012-08-17 Thread vjyns
Hi,

 thanks for the quick response, but as i said in my case due to two
different threshold the detected features will differ. Moreover, there is
some standard /refined/ formula in calculating the tpr and fpr. herewith i
had attached the refined formula from a standard international journal 
http://r.789695.n4.nabble.com/file/n4640577/tpr_and_fpr.jpg 

when i used the above mentioned formula (fpr=fp/fp+tp) then i can able to
see my point are distributed on the extreme left corner. Like this it is
possible to put all the 6 images.  Will you please suggest me now how to
obtain the plot for different images of two threshold. 



--
View this message in context: 
http://r.789695.n4.nabble.com/no-true-negative-data-need-roc-curve-tp4640474p4640577.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] Get the filename from the given path

2012-08-17 Thread Rantony
Hi,

Here i have a file path, 
for eg : - 
FPath - D:\\MyFolder\\MyFile.txt

HOW IS POSSIBLE TO GET THE FILE NAME FROM THIS GIVEN PATH ?

- thanks in advance
Antony.



--
View this message in context: 
http://r.789695.n4.nabble.com/Get-the-filename-from-the-given-path-tp4640578.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] Problem with global variable building a package

2012-08-17 Thread Eva Prieto Castro
Hi,

I could build the package, finally, adjusting the path correctly (Rtools 
folders in front).

Regards

Eva

--- El jue, 16/8/12, Eva Prieto Castro evapcas...@yahoo.es escribió:

De: Eva Prieto Castro evapcas...@yahoo.es
Asunto: Re: [R] Problem with global variable building a package
Para: Uwe Ligges lig...@statistik.tu-dortmund.de
CC: Greg Snow 538...@gmail.com, R-help@r-project.org
Fecha: jueves, 16 de agosto, 2012 10:50

I forget one question:

Where do I indicate this path? :

PATH=c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;c:\MiKTeX\miktex\bin;
c:\R\R-2.15\bin\i386;c:\windows;c:\windows\system32

Regards,
Eva

--- El jue, 16/8/12, Eva Prieto Castro evapcas...@yahoo.es escribió:

De: Eva Prieto Castro evapcas...@yahoo.es
Asunto: Re: [R] Problem with global variable building a package
Para: Uwe Ligges lig...@statistik.tu-dortmund.de
CC: Greg Snow 538...@gmail.com, R-help@r-project.org
Fecha: jueves, 16 de agosto, 2012 10:41

Hi,

I altered .internal file
 as Ligges indicated, but I have a problem when I make R CMD build pkg: 

ERROR
packaging into .tar.gz failed

The question is the following: what is the problem? I have installed Rtools, 
Must I do anything else?. 

Obs.: I work under Windows 7, but the package generated will be used under 
windows and mac.

Thanks in advance.

Eva

--- El mié, 8/8/12, Uwe Ligges lig...@statistik.tu-dortmund.de escribió:

De: Uwe Ligges lig...@statistik.tu-dortmund.de
Asunto: Re: [R] Problem with global variable building a package
Para: Eva Prieto Castro evapcas...@yahoo.es
CC: Greg Snow 538...@gmail.com,
 R-help@r-project.org
Fecha: miércoles, 8 de agosto, 2012 11:24



On 08.08.2012 08:53, Eva Prieto Castro wrote:
 Hello, Greg:

 That is one of the solutions I have tried; the problem is that I can't obtain 
 a package in this way, because an glo-internal.R file is generated (glo is 
 the name of the package) and when I try to create the package an error 
 message appears (a parse error).

 The content of the glo-internal.R file is the following:

 .glo.env -
 environment


To avoid parser errors, replace  environment by something that is 
syntactically valid, in this case: new.env().

Best,
Uwe Ligges



 where .glo.env is the name of the new environment I create in my source code.

 What am I doing wrong?.

 Thanks again for your help.


 Regards.

 Eva

 --- El mar, 7/8/12, Greg Snow 538...@gmail.com escribió:

 De: Greg Snow 538...@gmail.com
 Asunto: Re: [R] Problem with global variable building a package
 Para: Eva Prieto Castro evapcas...@yahoo.es
 CC: R-help@r-project.org
 Fecha: martes, 7 de agosto, 2012 23:30

 Probably the best thing to do is create an environment within the
 package that you can assign to and read from.

 Somewhere in the source code for the package include a line like:

 my.env -
 new.env()

 then within any functions defined after that line you can set
 variables within the environment with code like:

   my.env$paramA - 3

 and other functions can then read my.env$paramA.  This way you don't
 need to worry about assign or - and all your functions will have
 access to the same set of variables (but they won't interfere with the
 users workspace).

 On Tue, Aug 7, 2012 at 1:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote:


 Hi,



 My name is
 Eva and this is my first message here. My English is not very good, but I 
 hope
 you can understand my question, in the context of an academic
 project.



 I have
 developed several functions in R and the
 idea is that the user can access functions in order to:



 1)
 Alter
 parameters in relation with data and type of analysis.

 2)
 Run
 statistical analysis (Text and pdf files with results will be generated).

 3)
 View
 the value of the most important parameters.



 All the
 parameters I need are stored in a list object, and this list is used in all 
 the
 functions along the cycle performed by the user, but I would like the user 
 does
 not need to pass the name of the list as argument when he/she runs the 
 different
 functions, so I think I need to treat the list as a global
 variable.



 Firstly, I
 used the global assignment operator (“-“); secondly, I used 
 “get� and “assign�
 functions and even I used a new.env() in order to use a new environment
 exclusively for my list. However, when I try to build a package with all my
 functions I don’t reach this end, because of an error in parse 
 process.



 My question
 for you is the following: taking into account that my end is to build a
 package, what can I do with this “global� list?. How can I 
 treat it?.



 Thanks in
 advance.



 Regards,

 Eva




         Â
 [[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, 

[R] How can we compare corresponding values of x and y (first value of x exacly matches with the first value of y)?

2012-08-17 Thread Sri krishna Devarayalu Balanagu
df - data.frame  (
RowId = 4:7,
x=c(1_1, 2_2, 3_3, 3_3),
 y=c(1_1, 3_3, 2_2, 3_3)
 )

How can we compare corresponding values of x and y (first value of x exacly 
matches with the first value of y)?
If they were not matced exactly how can we get the row id?
In this case the row ids were 5 and 6.



Notice: The information contained in this electronic mail message is intended 
only for the use of the designated recipient. This message is privileged and 
confidential. and the property of GVK BIO or its affiliates and subsidiaries. 
If the reader of this message is not the intended recipient or an agent 
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this message in error and that any review, 
dissemination, distribution, or copying of this message is strictly prohibited. 
If you have received this communication in error, please notify us immediately 
by telephone +91-40-6692tel:%2B91-40-6692 and destroy any and all 
copies of this message in your possession (whether hard copies or 
electronically stored copies).

[[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] Find and install old package to R 2.11 in UNIX

2012-08-17 Thread Uwe Ligges



On 17.08.2012 02:42, David Winsemius wrote:


On Aug 16, 2012, at 4:33 PM, Kevin Goulding wrote:


Hi, I'm having trouble installing and using the 'foreign' package in R
on a
UNIX machine.


sessionInfo()

R version 2.11.1 (2010-05-31)
sparc-sun-solaris2.10

locale:
[1] C

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

Is there a way to find and install an old 'foreign' package that works
with
my machine?

Does such a method generalize to finding other out-of-date packages
for my
machine?


Yes, there is a general method. Install from archived package as source.

http://cran.r-project.org/src/contrib/Archive





Right, but then foreign is a recommended package and is shipped with 
released versions of R, hence should be available already.


Best,
Uwe Ligges

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


Re: [R] How can we compare corresponding values of x and y (first value of x exacly matches with the first value of y)?

2012-08-17 Thread Jim Lemon

On 08/17/2012 07:48 PM, Sri krishna Devarayalu Balanagu wrote:

df- data.frame  (
 RowId = 4:7,
 x=c(1_1, 2_2, 3_3, 3_3),
  y=c(1_1, 3_3, 2_2, 3_3)
  )

How can we compare corresponding values of x and y (first value of x exacly 
matches with the first value of y)?
If they were not matced exactly how can we get the row id?
In this case the row ids were 5 and 6.


Hi Sri krishna Devarayalu Balanagu,
how about this:

df$RowId[which(df$x != df$y)]

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] The message headers matched a filter rule

2012-08-17 Thread Pascal Oettli

It happens relatively often to me.

Regards


Le 17/08/2012 17:19, Jessica Streicher a écrit :

Pretty much every time i reply to a post in this list i get a bounce saying the 
above, + waiting for approval.

I first thought it was because i didn't send in plain, but now they are and it 
hasn't become any better. Any other ideas? Is this normal?
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] tikzDevice not available

2012-08-17 Thread nikos giallousis
Hello, many thanks for the advice.

Unfortunately I did not mention that my os is Windows 7. I am sorry for
that.

Some feedback here?

 install.packages(tikzDevice, repos=http://R-Forge.R-project.org;)
Installing package(s) into ‘C:/Users/N31k/Documents/R/win-library/2.14’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository
http://R-Forge.R-project.org/bin/windows/contrib/2.14
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
  package ‘tikzDevice’ is not available (for R version 2.14.2)
 utils:::menuInstallLocal()
Error in read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type))
:
  cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type)) :
  cannot open compressed file 'tikzDevice_0.6.2.tar.gz/DESCRIPTION',
probable reason 'No such file or directory'

[[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] Trouble compiling package on Windows (64 bit)

2012-08-17 Thread Fg Nu


I am trying to compile the R package KernGPLM found here:
http://www.marlenemueller.de/KernGPLM/KernGPLM_0.65.tar.gz

since the binary available is for R 2.4.

but the compilation ends with the error message:
*** arch-i386
ERROR: compilation failed for the package 'KernGPLM'

Here is my session info:

R version 2.14.2 (2012-02-29)
Platform: x86_64-pc-mingw32/x64 (64-bit)

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

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

other attached packages:
[1] Revobase_6.0.0   RevoMods_6.0.0   RevoScaleR_3.0-0 lattice_0.20-0  

loaded via a namespace (and not attached):
[1] codetools_0.2-8 foreach_1.4.0   grid_2.14.2     iterators_1.0.6
[5] tools_2.14.2   



Is it possible to diagnose the problem from this information?

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] Reference a variable inside a string and another for object assingments

2012-08-17 Thread Gabor Grothendieck
On Thu, Aug 16, 2012 at 3:30 PM, Kenneth Rose kennethros...@gmail.com wrote:
 Hi R community

 I copied a bit of my R code that gets some data from a database. You
 won't be able to run the code, but I am a beginner so you will
 probably understand what going on.

 I would like to make a variable I can refer to inside the sqlQuery.
 Instead of writing the start date and time (ex SP.lokaldatotid =
 '2005-01-01 00:00:00') inside the query I would like to define it in
 the beginning of the code, so I don't have to fiddle with a lot of
 dates each time I wan't to change it. I would like to do this for a
 few of the variables and maybe even make a list/array I can loop
 through, so I don't have to write the same code multiple times (for
 SYS and DK1).

 I have searched for a solution for two days now, but I am not sure
 what it's called and are probably writing the wrong queries :-)


 Thank you for your help!

 Kenneth

 My code:

 library(xts)
 library(RODBC)


 #Define channnel (i configured my own SYSTEM-DNS, via ODBC)
 ch - odbcConnect(DI2)

 #
 ## GET DATA##
 #

 ## SYSTEM spot ##
 # Hent data fra SQL Server
 sys - sqlQuery (ch, paste(SELECT  SP.lokaldatotid, SP.pris FROM
 DataIndsamling2.dbo.SpotPriser SP,
WHERE (SP.omraade_id= 0 AND
 SP.lokaldatotid = '2005-01-01 00:00:00')))
 #Definer dato og tid kolonne
 sys$lokaldatotid - as.POSIXct(sys$lokaldatotid)

 #Make a XTS object
 sys_xts - xts(sys[,-1], order.by=sys[,1])

 # Recalculate data from hours to daily, monthly and yearly averages
 sys_xts_daily - apply.daily(sys_xts, FUN=mean)
 sys_xts_monthly - apply.monthly(sys_xts, FUN=mean)
 sys_xts_yearly - apply.yearly(sys_xts, FUN=mean)


 ## DK1 spot #
 # Hent data fra SQL Server
 dk1 - sqlQuery (ch, paste(SELECT  SP.lokaldatotid, SP.pris FROM
 DataIndsamling2.dbo.SpotPriser SP,
WHERE (SP.omraade_id= 5 AND
 SP.lokaldatotid = '2005-01-01 00:00:00')))

You can use paste as shown in the example in ?sqlGetResults or
fn$ in the gsubfn package can do quasi-perl-like string interpolation.
With fn you just preface any command with fn$ and then its
arguments are subject to string interpolation as explained further
in ?fn and http://gsubfn.googlecode.com. e.g.

library(gsubfn)

id - 5
date - '2005-01-01 00:00:00'

dk1 - fn$sqlQuery (ch, SELECT  SP.lokaldatotid, SP.pris FROM
DataIndsamling2.dbo.SpotPriser SP
WHERE (SP.omraade_id = $id AND
SP.lokaldatotid = '$date' ) )

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

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


Re: [R] How can we compare corresponding values of x and y (first value of x exacly matches with the first value of y)?

2012-08-17 Thread Rui Barradas

Hello,

I've changed the name of the data.frame, df is an R function.

DF$RowId[ DF$x != DF$y ]

Hope this helps,

Rui Barradas

Em 17-08-2012 10:48, Sri krishna Devarayalu Balanagu escreveu:

df - data.frame  (
 RowId = 4:7,
 x=c(1_1, 2_2, 3_3, 3_3),
  y=c(1_1, 3_3, 2_2, 3_3)
  )

How can we compare corresponding values of x and y (first value of x exacly 
matches with the first value of y)?
If they were not matced exactly how can we get the row id?
In this case the row ids were 5 and 6.



Notice: The information contained in this electronic mail message is intended only 
for the use of the designated recipient. This message is privileged and confidential. 
and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this 
message is not the intended recipient or an agent responsible for delivering it to 
the intended recipient, you are hereby notified that you have received this message 
in error and that any review, dissemination, distribution, or copying of this message 
is strictly prohibited. If you have received this communication in error, please 
notify us immediately by telephone +91-40-6692tel:%2B91-40-6692 and 
destroy any and all copies of this message in your possession (whether hard copies or 
electronically stored copies).

[[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] tikzDevice not available

2012-08-17 Thread Uwe Ligges



On 17.08.2012 12:37, nikos giallousis wrote:

Hello, many thanks for the advice.

Unfortunately I did not mention that my os is Windows 7. I am sorry for
that.

Some feedback here?


Yes: R-forge seems to support the current release version of R only re. 
binaries. If you want it for an old release of R, install from sources, 
i.e.:
install.packages(tikzDevice, repos=http://R-Forge.R-project.org;, 
type=source)


Uwe Ligges






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

Installing package(s) into ‘C:/Users/N31k/Documents/R/win-library/2.14’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository
http://R-Forge.R-project.org/bin/windows/contrib/2.14
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
   package ‘tikzDevice’ is not available (for R version 2.14.2)

utils:::menuInstallLocal()

Error in read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type))
:
   cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type)) :
   cannot open compressed file 'tikzDevice_0.6.2.tar.gz/DESCRIPTION',
probable reason 'No such file or directory'

[[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] Error in metafor documentation on maximum iterations

2012-08-17 Thread Michael Dewey

At 19:01 16/08/2012, Viechtbauer Wolfgang (STAT) wrote:
I had noticed this oversight a while ago. In an updated version of 
the metafor package (hopefully to be released in the near future), 
the argument will be called maxiter (as intended). Using maxit 
will then work as well, due to partial matching.


Thanks for bringing this to my attention though.

Also, the package name is metafor (spelled with an f). It's 
supposed to be a (convoluted) abbreviation for META-analysis FOr 
R). I suppose metaphor would then be META-analysis PHOr R, but 
I decided against that (other candidates were metaforR, metafoR, and 
a few others). Well, at the time, I thought the name metafor was 
clever. These days, I am not so sure anymore.


The big advantage of metafor is that it is not the (English) word for 
metaphor so making Google searching for metafor a lot easier (at 
least from my location). Readers in the Nordic countries mileage 
probably varies here.




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-boun...@r-project.org]
 On Behalf Of Michael Weylandt
 Sent: Thursday, August 16, 2012 04:19
 To: John Hodgson
 Cc: r-help@r-project.org
 Subject: Re: [R] Error in metafor documentation on maximum iterations

 Send this to Wolfgang directly. See

 maintainer(metaphor)

 Michael

 On Aug 15, 2012, at 12:13 PM, John Hodgson j...@formby.plus.com wrote:

  Both the official R documentation and Wolfgang's paper in the Journal of
  Statistical Science describing this (extremely useful) package, name the
  control variable for maximum iterations in numeric model fitting as
  'maxiter'.  The correct name is 'maxit'.  A small point concerning an (I
  guess) infrequently used bit of functionality, but this may help save
  someone an hour or so's head scratching!
 
  John Hodgson
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/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.


Michael Dewey
i...@aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html

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


Re: [R] Linear mixed model using R

2012-08-17 Thread li li
Thanks, Bert.

2012/8/17 Bert Gunter gunter.ber...@gene.com

 1. Post on R-sig-mixed-models, not here.

 2. Models 2 and 3 make no sense (to me, anyway). What do you think
 they mean? (Don't answer here -- explain on the mixed models list).

 -- Bert

 On Thu, Aug 16, 2012 at 9:13 PM, li li hannah@gmail.com wrote:
  Dear all,
I am trying to use R to fit mixed models.
Take the following example, where ind is a random effect and
  sample is fixed. I wanted to fit
 Model 1: values = ind + sample
 Model 2: values =ind * sample
 Model 3:  values=ind(sample) + sample
 
  Tried to use the below for mod1, but it did not work.
  Can anyone give
  some help on this. Thanks so much.
  mod1 - lme(values ~ sample +
   random=~ 1|ind, data=y)

 Your syntax is wrong. Re-read ?lme
 (random is a separate argument, not part of the formula).
  
 
 
 
 
 
 
 
 values ind sample
  1  0.03325   1  1
  2  0.03305   1  1
  3  0.03185   1  1
  4  0.03515   1  1
  5  0.03375   1  1
  6  0.01180   1  2
  7  0.01850   1  3
  8  0.02915   1  4
  9  0.06200   1  5
  10 0.03230   2  1
  11 0.03345   2  1
  12 0.03385   2  1
  13 0.03605   2  1
  14 0.03225   2  1
  15 0.01145   2  2
  16 0.01805   2  3
  17 0.02950   2  4
  18 0.05995   2  5
  19 0.03425   3  1
  20 0.03575   3  1
  21 0.03535   3  1
  22 0.03380   3  1
  23 0.03410   3  1
  24 0.01050   3  2
  25 0.01735   3  3
  26 0.03140   3  4
  27 0.06170   3  5
  28 0.03430   4  1
  29 0.03185   4  1
  30 0.03165   4  1
  31 0.03380   4  1
  32 0.03235   4  1
  33 0.01100   4  2
  34 0.01825   4  3
  35 0.03045   4  4
  36 0.06060   4  5
 
  [[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.htmlhttp://www.r-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.



 --

 Bert Gunter
 Genentech Nonclinical Biostatistics

 Internal Contact Info:
 Phone: 467-7374
 Website:

 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm


[[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] Trouble compiling package on Windows (64 bit)

2012-08-17 Thread Uwe Ligges



On 17.08.2012 12:38, Fg Nu wrote:



I am trying to compile the R package KernGPLM found here:
http://www.marlenemueller.de/KernGPLM/KernGPLM_0.65.tar.gz




since the binary available is for R 2.4.

but the compilation ends with the error message:
*** arch-i386
ERROR: compilation failed for the package 'KernGPLM'



See the R Installation and Administration manual.
It tells you how to set up an environment under Windows to be able to 
install the package from sources.


We cannot say more without the actual output of R CMD INSTALL.

Best,
Uwe Ligges





Here is my session info:

R version 2.14.2 (2012-02-29)
Platform: x86_64-pc-mingw32/x64 (64-bit)

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

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

other attached packages:
[1] Revobase_6.0.0   RevoMods_6.0.0   RevoScaleR_3.0-0 lattice_0.20-0

loaded via a namespace (and not attached):
[1] codetools_0.2-8 foreach_1.4.0   grid_2.14.2 iterators_1.0.6
[5] tools_2.14.2



Is it possible to diagnose the problem from this information?

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.



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


Re: [R] Get the filename from the given path

2012-08-17 Thread R. Michael Weylandt
On Fri, Aug 17, 2012 at 5:28 AM, Rantony antony.akk...@ge.com wrote:
 Hi,

 Here i have a file path,
 for eg : -
 FPath - D:\\MyFolder\\MyFile.txt

 HOW IS POSSIBLE TO GET THE FILE NAME FROM THIS GIVEN PATH ?


Quite possibly by yelling at it


or regular expressions: you know, whatever

 - thanks in advance
 Antony.



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Get-the-filename-from-the-given-path-tp4640578.html
 Sent from the R help mailing list archive at Nabble.com.

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

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


Re: [R] Get the filename from the given path

2012-08-17 Thread Berend Hasselman

On Fri, Aug 17, 2012 at 5:28 AM, Rantony antony.akk...@ge.com wrote:
 Hi,
 
 Here i have a file path,
 for eg : -
 FPath - D:\\MyFolder\\MyFile.txt
 
 HOW IS POSSIBLE TO GET THE FILE NAME FROM THIS GIVEN PATH ?
 

Please don't shout.

?basename


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] Get the filename from the given path

2012-08-17 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 17/08/12 15:04, Berend Hasselman wrote:
 
 On Fri, Aug 17, 2012 at 5:28 AM, Rantony antony.akk...@ge.com wrote:
 Hi,
 
 Here i have a file path, for eg : - FPath - D:\\MyFolder\\MyFile.txt
 
 HOW IS POSSIBLE TO GET THE FILE NAME FROM THIS GIVEN PATH ?
 
 
 Please don't shout.

Just to explain - not everybody knows this:

writing in capital letters is considered as shouting in emails and in forums, 
and not used to
highlight certain parts.

Cheers,

Rainer


 
 ?basename
 
 
 Berend
 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAuTpQACgkQoYgNqgF2egqDSwCePmmZ7blv4vlwqF8ANufs13x8
YccAnA+eqjGmueHlOup083/WfSbNP7RL
=McDs
-END PGP SIGNATURE-

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


[R] Plot multiple variables: label points

2012-08-17 Thread cm256
Hello, I have a data.frame with 10-15 entries which looks like this:

group time1 time2 time3
1  F18  4394.500  21043.50 14949.00
2  F25  4678.000  23727.65 15683.12
3  F30  4909.775  23487.60 16724.40

I plot this with:
plot(variable[,2:4])
so that a plot with 3 rows and 3 lines for time1, time2 and time3 appears.

Is it somehow possible to label the data points with the values stored in
group (F18, F25...)?



--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-multiple-variables-label-points-tp4640611.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] no true negative data, need roc curve

2012-08-17 Thread Jessica Streicher
Above mentioned formula is wrong - maybe a typo
http://en.wikipedia.org/wiki/Receiver_operating_characteristic

The false positive rate is the rate of false positives, meaning how many of the 
total negatives (all in reality negatives(N), that is, all negatives falsely 
classified as positives(fp) and all negatives correctly classified as 
negatives(tn)) have been falsely classified as positive.

Also the authors obviously had (N+P=number of features), and therefore at least 
could have computed this properly. For example:

N+P=100
P=TP+FN
N=FP+TN
- do the math with what you got

On 17.08.2012, at 11:13, vjyns wrote:

 Hi,
 
 thanks for the quick response, but as i said in my case due to two
 different threshold the detected features will differ. Moreover, there is
 some standard /refined/ formula in calculating the tpr and fpr. herewith i
 had attached the refined formula from a standard international journal 
 http://r.789695.n4.nabble.com/file/n4640577/tpr_and_fpr.jpg 
 
 when i used the above mentioned formula (fpr=fp/fp+tp) then i can able to
 see my point are distributed on the extreme left corner. Like this it is
 possible to put all the 6 images.  Will you please suggest me now how to
 obtain the plot for different images of two threshold. 
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/no-true-negative-data-need-roc-curve-tp4640474p4640577.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Reference a variable inside a string and another for object assingments

2012-08-17 Thread Kenneth Rose
I tried these two and testquery2 now does the job :) Somehow the str_c
function from the stringr package doesn't work when I run the sqlQuery
function even though the testquery string is the same as testquery2
string. Thanks for the pointers!

fromdate - c('2005-01-01 00:00:00')

testquery - str_c(SELECT  SP.lokaldatotid, SP.pris FROM
DataIndsamling2.dbo.SpotPriser SP,
   WHERE (SP.omraade_id= 0 AND SP.lokaldatotid =
,fromdate[1],))

testquery2 - paste(SELECT  SP.lokaldatotid, SP.pris FROM
DataIndsamling2.dbo.SpotPriser SP,
WHERE (SP.omraade_id= 0 AND SP.lokaldatotid =
,fromdate[1],))

I still can't figure out how to assign an existing xts object to a
name from a list or array. I have data that i want to rename to one of
the names i a character vector.

Example:


names - c(data2, data3)

data - xts(11:10, Sys.Date()+1:10)

# The next part is not real code but just so you get the basic idea:

names[1] - data
remove(data)

data2 should now be assigned to data.


Thanks for your help with the first part!!

/Kenneth


On Thu, Aug 16, 2012 at 10:57 PM, MacQueen, Don macque...@llnl.gov wrote:
 I sometimes do this sort of thing with tricks like this:

   sql - select * from mytable where dt = 'ADATE'

   dbGetQuery( con, gsub('ADATE', '2012-06-12 23:14', sql) )



 Or if mydates is a vector of dates stored as a POSIXt object:

 for (id in mydates) {
  dbGetQuery( con,  gsub('ADATE', format(id), sql) )
 }


 -Don

 --
 Don MacQueen

 Lawrence Livermore National Laboratory
 7000 East Ave., L-627
 Livermore, CA 94550
 925-423-1062





 On 8/16/12 12:30 PM, Kenneth Rose kennethros...@gmail.com wrote:

Hi R community

I copied a bit of my R code that gets some data from a database. You
won't be able to run the code, but I am a beginner so you will
probably understand what going on.

I would like to make a variable I can refer to inside the sqlQuery.
Instead of writing the start date and time (ex SP.lokaldatotid =
'2005-01-01 00:00:00') inside the query I would like to define it in
the beginning of the code, so I don't have to fiddle with a lot of
dates each time I wan't to change it. I would like to do this for a
few of the variables and maybe even make a list/array I can loop
through, so I don't have to write the same code multiple times (for
SYS and DK1).

I have searched for a solution for two days now, but I am not sure
what it's called and are probably writing the wrong queries :-)


Thank you for your help!

Kenneth

My code:

library(xts)
library(RODBC)


#Define channnel (i configured my own SYSTEM-DNS, via ODBC)
ch - odbcConnect(DI2)

#
## GET DATA##
#

## SYSTEM spot ##
# Hent data fra SQL Server
sys - sqlQuery (ch, paste(SELECT  SP.lokaldatotid, SP.pris FROM
DataIndsamling2.dbo.SpotPriser SP,
   WHERE (SP.omraade_id= 0 AND
SP.lokaldatotid = '2005-01-01 00:00:00')))
#Definer dato og tid kolonne
sys$lokaldatotid - as.POSIXct(sys$lokaldatotid)

#Make a XTS object
sys_xts - xts(sys[,-1], order.by=sys[,1])

# Recalculate data from hours to daily, monthly and yearly averages
sys_xts_daily - apply.daily(sys_xts, FUN=mean)
sys_xts_monthly - apply.monthly(sys_xts, FUN=mean)
sys_xts_yearly - apply.yearly(sys_xts, FUN=mean)


## DK1 spot #
# Hent data fra SQL Server
dk1 - sqlQuery (ch, paste(SELECT  SP.lokaldatotid, SP.pris FROM
DataIndsamling2.dbo.SpotPriser SP,
   WHERE (SP.omraade_id= 5 AND
SP.lokaldatotid = '2005-01-01 00:00:00')))
#Definer dato og tid kolonne
dk1$lokaldatotid - as.POSIXct(dk1$lokaldatotid)

#Lav om til xts object
dk1_xts - xts(dk1[,-1], order.by=dk1[,1])

#Data omregnet fra time - daglig, måned, årlige gennemsnit
dk1_xts_daily - apply.daily(dk1_xts, FUN=mean)
dk1_xts_monthly - apply.monthly(dk1_xts, FUN=mean)
dk1_xts_yearly - apply.yearly(dk1_xts, FUN=mean)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Reference a variable inside a string and another for object assingments

2012-08-17 Thread Kenneth Rose
Thanks Gabor!

This is exactly what I was searching for! --- And it works like a charm.


On Fri, Aug 17, 2012 at 1:03 PM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
 On Thu, Aug 16, 2012 at 3:30 PM, Kenneth Rose kennethros...@gmail.com wrote:
 Hi R community

 I copied a bit of my R code that gets some data from a database. You
 won't be able to run the code, but I am a beginner so you will
 probably understand what going on.

 I would like to make a variable I can refer to inside the sqlQuery.
 Instead of writing the start date and time (ex SP.lokaldatotid =
 '2005-01-01 00:00:00') inside the query I would like to define it in
 the beginning of the code, so I don't have to fiddle with a lot of
 dates each time I wan't to change it. I would like to do this for a
 few of the variables and maybe even make a list/array I can loop
 through, so I don't have to write the same code multiple times (for
 SYS and DK1).

 I have searched for a solution for two days now, but I am not sure
 what it's called and are probably writing the wrong queries :-)


 Thank you for your help!

 Kenneth

 My code:

 library(xts)
 library(RODBC)


 #Define channnel (i configured my own SYSTEM-DNS, via ODBC)
 ch - odbcConnect(DI2)

 #
 ## GET DATA##
 #

 ## SYSTEM spot ##
 # Hent data fra SQL Server
 sys - sqlQuery (ch, paste(SELECT  SP.lokaldatotid, SP.pris FROM
 DataIndsamling2.dbo.SpotPriser SP,
WHERE (SP.omraade_id= 0 AND
 SP.lokaldatotid = '2005-01-01 00:00:00')))
 #Definer dato og tid kolonne
 sys$lokaldatotid - as.POSIXct(sys$lokaldatotid)

 #Make a XTS object
 sys_xts - xts(sys[,-1], order.by=sys[,1])

 # Recalculate data from hours to daily, monthly and yearly averages
 sys_xts_daily - apply.daily(sys_xts, FUN=mean)
 sys_xts_monthly - apply.monthly(sys_xts, FUN=mean)
 sys_xts_yearly - apply.yearly(sys_xts, FUN=mean)


 ## DK1 spot #
 # Hent data fra SQL Server
 dk1 - sqlQuery (ch, paste(SELECT  SP.lokaldatotid, SP.pris FROM
 DataIndsamling2.dbo.SpotPriser SP,
WHERE (SP.omraade_id= 5 AND
 SP.lokaldatotid = '2005-01-01 00:00:00')))

 You can use paste as shown in the example in ?sqlGetResults or
 fn$ in the gsubfn package can do quasi-perl-like string interpolation.
 With fn you just preface any command with fn$ and then its
 arguments are subject to string interpolation as explained further
 in ?fn and http://gsubfn.googlecode.com. e.g.

 library(gsubfn)

 id - 5
 date - '2005-01-01 00:00:00'

 dk1 - fn$sqlQuery (ch, SELECT  SP.lokaldatotid, SP.pris FROM
 DataIndsamling2.dbo.SpotPriser SP
 WHERE (SP.omraade_id = $id AND
 SP.lokaldatotid = '$date' ) )

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

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


Re: [R] Get the filename from the given path

2012-08-17 Thread Rui Barradas

Hello,

basename(FPath)

Hope this helps,

Rui Barradas
Em 17-08-2012 10:28, Rantony escreveu:

Hi,

Here i have a file path,
for eg : -
FPath - D:\\MyFolder\\MyFile.txt

HOW IS POSSIBLE TO GET THE FILE NAME FROM THIS GIVEN PATH ?

- thanks in advance
Antony.



--
View this message in context: 
http://r.789695.n4.nabble.com/Get-the-filename-from-the-given-path-tp4640578.html
Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] Get the filename from the given path

2012-08-17 Thread Rantony
Thanks pramod.

 

From: Pramod [via R] [mailto:ml-node+s789695n4640600...@n4.nabble.com] 
Sent: Friday, August 17, 2012 5:24 PM
To: Akkara, Antony (GE Energy, Non-GE)
Subject: Re: Get the filename from the given path

 

x - substr(FPath,13,nchar(FPath)) should give you the desired output. 



If you reply to this email, your message will be added to the discussion
below:

http://r.789695.n4.nabble.com/Get-the-filename-from-the-given-path-tp464
0578p4640600.html 

To unsubscribe from Get the filename from the given path, click here
http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscrib
e_by_codenode=4640578code=YW50b255LmFra2FyYUBnZS5jb218NDY0MDU3OHwxNTUx
OTQzMDI5 .
NAML
http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_view
erid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.Bas
icNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.tem
plate.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml
-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemai
l.naml  





--
View this message in context: 
http://r.789695.n4.nabble.com/Get-the-filename-from-the-given-path-tp4640578p4640601.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

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


Re: [R] Get the filename from the given path

2012-08-17 Thread Uwe Ligges



On 17.08.2012 11:28, Rantony wrote:

Hi,

Here i have a file path,
for eg : -
FPath - D:\\MyFolder\\MyFile.txt

HOW IS POSSIBLE TO GET THE FILE NAME FROM THIS GIVEN PATH ?



basename(FPath)

Uwe Ligges


- thanks in advance
Antony.



--
View this message in context: 
http://r.789695.n4.nabble.com/Get-the-filename-from-the-given-path-tp4640578.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] Get the filename from the given path

2012-08-17 Thread Michael Meyer
Do
 
splits - strsplit(filePath,file://%22,fixed=true)[[1/]]
fileName - splits[length(splits)])
[[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] Unequal splits from a column

2012-08-17 Thread arun
HI,
Try this:
dat1-data.frame(slope=c(slope (60/25/15),slope (90/10),slope 
(40/35/15/10),slope (40/25/25/10) ))
dat1$slope-gsub(slope\\s+.*(\\(.*\\)),\\1,dat1$slope)
 dat1$slope-gsub(\\((.*)\\),\\1,dat1$slope)
dat2-strsplit(dat1$slope,/)
dat2[[1]][4]-0
dat2[[2]][3:4]-0
data.frame(do.call(rbind,dat2))
#  X1 X2 X3 X4
#1 60 25 15  0
#2 90 10  0  0
#3 40 35 15 10
#4 40 25 25 10



- Original Message -
From: Sapana Lohani lohani.sap...@ymail.com
To: r-help@r-project.org r-help@r-project.org
Cc: 
Sent: Friday, August 17, 2012 1:05 AM
Subject: [R] Unequal splits from a column

Hi I am new to R so am struggling with the commands here

I have one column in a table that looks like


slope (60/25/15) 
slope (90/10) 
slope (40/35/15/10) 
slope (40/25/25/10) 
I want to have 4 columns with just the number inside the parenthesis. when 
there is no number that cell can have 0. I want the output like this

60 25 15 0
90 10 0 0
40 35 15 10
40 25 25 10

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


[R] Error: level sets of factors are different?

2012-08-17 Thread Sri krishna Devarayalu Balanagu
Why the error is coming? even though the length of outcome.new$compkey and 
outcome.new$armkey were exactly same.
Can anyone help?

setwd(D:/AZ)
library(RODBC)
cdb_cnct - 
odbcConnectExcel(AZIF_DC_GVK_NSCLC_MSALL_287papers_02072012_141450_v1_4.xls)
outcomes - sqlFetch(cdb_cnct, Outcomes_info)
odbcClose(cdb_cnct)
rm(cdb_cnct)
sink(Dependency checks.log)
outcomes[(outcomes$Comparator != ), ] - outcome
compkey - paste(outcome$Comparator, outcome$Comparator_Subarm, sep='_')
armkey - paste(outcome$Arm_ID, outcome$SubArm_ID, sep='_')
outcome.new - cbind(outcome, compkey, armkey)
invalid.ids - outcome.new[outcome.new$compkey == outcome.new$armkey, 
c(Assessment_record_ID)]

Error in Ops.factor(outcome.new$compkey, outcome.new$armkey) :
  level sets of factors are different



Notice: The information contained in this electronic mail message is intended 
only for the use of the designated recipient. This message is privileged and 
confidential. and the property of GVK BIO or its affiliates and subsidiaries. 
If the reader of this message is not the intended recipient or an agent 
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this message in error and that any review, 
dissemination, distribution, or copying of this message is strictly prohibited. 
If you have received this communication in error, please notify us immediately 
by telephone +91-40-6692tel:%2B91-40-6692 and destroy any and all 
copies of this message in your possession (whether hard copies or 
electronically stored copies).

[[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] dimnames in an array(I'll be grateful if this message will be passed to all list users)

2012-08-17 Thread aleksandr shfets

Michael,
Thank you for suggestions; 
it seems to me that there's a fundamental lacuna with respect to names of a 
three dimensional array:
that is, rownames fits dimension 1, colnames fits another dimension(that is, 3, 
if I read it correctly),
but there is no specific name for the third dimension. I've tried setnames 
thinking that this would be appropriate 
for naming the sets, but there is no such R function.

On the other hand you're right, the suggestion
             dimnames(data11a)[[2]]=c(V,R)

doesn't ameliorate the analysis: while now dimnames(data11a)[[2]]

comes out as 
[2]

returning to the original analysis the same error comes up, that is, that the 
length of dimnames[2] doesn't agree with thee.
'array extent' -- that is, even though the boxcar contents are two in number, 
it evaluates the analysis on the basis of the 
dimnames(data11a)[2] value.

I'm using colloc infer (available under R 2.14) and trying to do the 
FHN(FitzHugh Nagumo) analysis in section 9.1 of the manual; it's very complex 
work, but I doubt the program is in error.

It seems to me in any case that, if R demands that the length of 'dimnames[2] 
must be equal to the array extent, then there must be a way to make the length 
of the names equal to the extent of the array, am I right?
Otherwise R would be inconsistent with itself, like Nomad on Startrek, and I've 
never seen a case where it was thus.

This is again why I ask if others with extensive experience with dimnames of an 
array have seen anything similar.
Certainly someone might know what is the significance of the dimnames of the 
array, how much can the length of them be altered for use generally?

regards,
A
Thu, 16 Aug 2012 00:00:35 -0400 от R. Michael Weylandt 
michael.weyla...@gmail.com:
   








On Wed, Aug 15, 2012 at 3:57 AM, aleksandr shfets a_shf...@mail.ru wrote:

 Hi Michael,

 Thanks for help on double brackets: I wasn't aware of this use of them.



 I went back to readjust my array so the dimnames(data11a)[[2]] would have

 two elements, and remade the array to include the new dimnames:



 dimnames(data11a)[[2]]=c(V,R)



 so that inside the second car of the train would

 be two items?


Yes.




 There seems to be no way to define dimnames(data11a)[2] to be two elements

 rather than one[as you say we have no way to combine the elements of the

 train except using the train].


You could do this:


dimnames(data11a)[2] - list(c(V,R))


but I'm not sure that's any clearer. To keep the metaphor rolling (get

it!), list() puts your stuff in a boxcar so now you can put it

directly on the train.


 So having tried to do what I can to make the

 middle element of the list to two rather than one, I rerun the analysis with

 the same result.



 if I read the thing right, regardless of how I define the inside of the

 boxcar, the analysis that I referred to



  res11a = inneropt(coefs, times=times, data=data11a,

 lik=lik,

  proc=proc, pars=spars, in.meth='nlminb',

 control.in=control.out)




Where is this inneropt function from? It could be an error in that. If

it's from a package, give me the name and I'll take a look at it and

you can also contact the maintainer: get contact info using the

maintainer() function.


Also, some of the advice here will probably be helpful  in seeking follow-up:

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example


Cheers,

Michael


 still won't look at the 'contents' of the car, but gives the same message:



   Error in `colnames-`(`*tmp*`, value = c(V, R)) :

   length of 'dimnames' [2] not equal to array extent





 I've tried a couple of other things like, after defining the second boxcar

 as:



   dimnames(data11a)[[2]]=c(V,R)





 then





dimnames(data11a)[2]=list(dimnames(data11a)[[2]])





 but this last generates an error.



 Somehow I think that that the clue to the thing is in the error message:

 what I see[ with my untrained eye] is that there should be some way to

 reconcile the three-- colnames, dimnames and the array- to a greater degree

 than their present agreement.

 Am I right?

 regards,

 Russell



 Tue, 14 Aug 2012 01:27:50 -0400 от R. Michael Weylandt

 michael.weyla...@gmail.com:



 On Mon, Aug 13, 2012 at 5:10 AM, aleksandr russell sss...@gmail.com wrote:

 Hello,



 I'm hoping someone with a wide experience with R may be able to see

 what the program is trying to tell me.



 I've got an array:



 y1=rnorm(41,0.2)

 y2=rnorm(41,0.2)

 y3=rbind(y1,y2)







 data11-array(0,c(41,2,2))

 data11[,1,]=y3

 data11[,2,]=y3

 rownames(data11)-rownames(data11, do.NULL = FALSE, prefix = Obs.)

 colnames=c(V,R)

 varnames=c(one,two)

 dimnames(data11)-list(rownames(data11), varnames, colnames)







 data11a-as.array(data11, dimnames=dimnames(data11))



 

Re: [R] Plot multiple variables: label points

2012-08-17 Thread Bert Gunter
?text

Have you read the Introduction to R tutorial. If not, do so before
further posting. If so, re-read section 12.2.

-- Bert



On Fri, Aug 17, 2012 at 6:33 AM, cm256 d-...@gmx.at wrote:
 Hello, I have a data.frame with 10-15 entries which looks like this:

 group time1 time2 time3
 1  F18  4394.500  21043.50 14949.00
 2  F25  4678.000  23727.65 15683.12
 3  F30  4909.775  23487.60 16724.40

 I plot this with:
 plot(variable[,2:4])
 so that a plot with 3 rows and 3 lines for time1, time2 and time3 appears.

 Is it somehow possible to label the data points with the values stored in
 group (F18, F25...)?



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Plot-multiple-variables-label-points-tp4640611.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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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


Re: [R] How to join two plotmath type expressions

2012-08-17 Thread peter dalgaard

On Aug 15, 2012, at 23:17 , Trevor Carey-Smith wrote:

 On 08/15/2012 10:45 PM, S Ellison wrote:
 label- 'Temperature'
 unit- bquote(degree*C)
 text(5,5,substitute(l~u, list(l=label, u=unit)))
 
 Thanks, that's exactly what I was after.

A curious application of bquote though. How about using it where it matters?

plot(5, 4)
label - 'Temperature'
unit - quote(degree*C)
text(5, 5, bquote(.(label) ~ .(unit)))

 Regards,
 Trevor.
 --
 Please consider the environment before printing this email.
 NIWA is the trading name of the National Institute of Water  Atmospheric 
 Research Ltd.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] dimnames in an array(I'll be grateful if this message will be passed to all list users)

2012-08-17 Thread William Dunlap
Have you showed us how to reproduce your original problem?
Have you showed us the output of traceback() after encountering
the error?  Have you tried setting options(error=recover) before
encountering the error and then using recover() to look at the dimensions
and dimnames of the array that caused the problem?

This error message
Error in `colnames-`(`*tmp*`, value = c(V, R)) :
length of 'dimnames' [2] not equal to array extent
comes from a nested replacement operation.  One such such case is
 mat - matrix(1:6,nrow=2,ncol=3)
 colnames(mat)[1:2] - c(V, R)
where the nested replacement gets expanded into
 tmp - colnames(mat) # tmp becomes NULL
 tmp[1:2] - c(V, R) # tmp becomes c(V,R), length is 2
 colnames(tmp) - tmp # error: 2 colnames for 3 columns
(R uses `*tmp*` where I used tmp - the former is for internal use only.)

There are lots of other possibilities, but you need to at least show the
output of traceback() to pin it down.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf
 Of aleksandr shfets
 Sent: Friday, August 17, 2012 6:25 AM
 To: R. Michael Weylandt
 Cc: r-help@r-project.org
 Subject: Re: [R] dimnames in an array(I'll be grateful if this message will 
 be passed to all
 list users)
 
 
 Michael,
 Thank you for suggestions;
 it seems to me that there's a fundamental lacuna with respect to names of a 
 three
 dimensional array:
 that is, rownames fits dimension 1, colnames fits another dimension(that is, 
 3, if I read it
 correctly),
 but there is no specific name for the third dimension. I've tried setnames 
 thinking that
 this would be appropriate
 for naming the sets, but there is no such R function.
 
 On the other hand you're right, the suggestion
  dimnames(data11a)[[2]]=c(V,R)
 
 doesn't ameliorate the analysis: while now dimnames(data11a)[[2]]
 
 comes out as
 [2]
 
 returning to the original analysis the same error comes up, that is, that the 
 length of
 dimnames[2] doesn't agree with thee.
 'array extent' -- that is, even though the boxcar contents are two in number, 
 it evaluates
 the analysis on the basis of the
 dimnames(data11a)[2] value.
 
 I'm using colloc infer (available under R 2.14) and trying to do the 
 FHN(FitzHugh Nagumo)
 analysis in section 9.1 of the manual; it's very complex work, but I doubt 
 the program is
 in error.
 
 It seems to me in any case that, if R demands that the length of 'dimnames[2] 
 must be
 equal to the array extent, then there must be a way to make the length of the 
 names
 equal to the extent of the array, am I right?
 Otherwise R would be inconsistent with itself, like Nomad on Startrek, and 
 I've never
 seen a case where it was thus.
 
 This is again why I ask if others with extensive experience with dimnames of 
 an array
 have seen anything similar.
 Certainly someone might know what is the significance of the dimnames of the 
 array,
 how much can the length of them be altered for use generally?
 
 regards,
 A
 Thu, 16 Aug 2012 00:00:35 -0400 от R. Michael Weylandt
 michael.weyla...@gmail.com:
 
 
 
 
 
 
 
 
 
 On Wed, Aug 15, 2012 at 3:57 AM, aleksandr shfets a_shf...@mail.ru wrote:
 
  Hi Michael,
 
  Thanks for help on double brackets: I wasn't aware of this use of them.
 
 
 
  I went back to readjust my array so the dimnames(data11a)[[2]] would have
 
  two elements, and remade the array to include the new dimnames:
 
 
 
  dimnames(data11a)[[2]]=c(V,R)
 
 
 
  so that inside the second car of the train would
 
  be two items?
 
 
 Yes.
 
 
 
 
  There seems to be no way to define dimnames(data11a)[2] to be two elements
 
  rather than one[as you say we have no way to combine the elements of the
 
  train except using the train].
 
 
 You could do this:
 
 
 dimnames(data11a)[2] - list(c(V,R))
 
 
 but I'm not sure that's any clearer. To keep the metaphor rolling (get
 
 it!), list() puts your stuff in a boxcar so now you can put it
 
 directly on the train.
 
 
  So having tried to do what I can to make the
 
  middle element of the list to two rather than one, I rerun the analysis with
 
  the same result.
 
 
 
  if I read the thing right, regardless of how I define the inside of the
 
  boxcar, the analysis that I referred to
 
 
 
   res11a = inneropt(coefs, times=times, data=data11a,
 
  lik=lik,
 
   proc=proc, pars=spars, in.meth='nlminb',
 
  control.in=control.out)
 
 
 
 
 Where is this inneropt function from? It could be an error in that. If
 
 it's from a package, give me the name and I'll take a look at it and
 
 you can also contact the maintainer: get contact info using the
 
 maintainer() function.
 
 
 Also, some of the advice here will probably be helpful  in seeking follow-up:
 
 http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-
 example
 
 
 Cheers,
 
 

Re: [R] Get the filename from the given path

2012-08-17 Thread R. Michael Weylandt michael.weyla...@gmail.com


On Aug 17, 2012, at 10:00 AM, Rainer M Krug r.m.k...@gmail.com wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 17/08/12 15:04, Berend Hasselman wrote:
 
 On Fri, Aug 17, 2012 at 5:28 AM, Rantony antony.akk...@ge.com wrote:
 Hi,
 
 Here i have a file path, for eg : - FPath - D:\\MyFolder\\MyFile.txt
 
 HOW IS POSSIBLE TO GET THE FILE NAME FROM THIS GIVEN PATH ?
 
 
 Please don't shout.
 
 Just to explain - not everybody knows this:
 
 writing in capital letters is considered as shouting in emails and in 
 forums, and not used to
 highlight certain parts.
 
 Cheers,
 
 Rainer

Thanks Rainer: for the OP, this is also a good read for those getting 
acquainted with mailing lists

http://www.catb.org/esr/faqs/smart-questions.html

Michael 
 
 
 
 ?basename
 
 
 Berend
 
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iEYEARECAAYFAlAuTpQACgkQoYgNqgF2egqDSwCePmmZ7blv4vlwqF8ANufs13x8
 YccAnA+eqjGmueHlOup083/WfSbNP7RL
 =McDs
 -END PGP SIGNATURE-
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Error: level sets of factors are different?

2012-08-17 Thread Jeff Newmiller
The length of a vector of yes/no answers has little to do with the number of 
possible responses (2). Factors keep both pieces of information.

If you only have yes responses in your data set, when converted to factor you 
would have to tell R that other responses  were possible.

I prefer to avoid working with factors until I need them.  Use the str function 
to investigate where factors are being introduced and either use options to 
keep the data as character or convert it back to character if you can't figure 
that out.
---
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.

Sri krishna Devarayalu Balanagu balanagudevaray...@gvkbio.com wrote:

Why the error is coming? even though the length of outcome.new$compkey
and outcome.new$armkey were exactly same.
Can anyone help?

setwd(D:/AZ)
library(RODBC)
cdb_cnct -
odbcConnectExcel(AZIF_DC_GVK_NSCLC_MSALL_287papers_02072012_141450_v1_4.xls)
outcomes - sqlFetch(cdb_cnct, Outcomes_info)
odbcClose(cdb_cnct)
rm(cdb_cnct)
sink(Dependency checks.log)
outcomes[(outcomes$Comparator != ), ] - outcome
compkey - paste(outcome$Comparator, outcome$Comparator_Subarm,
sep='_')
armkey - paste(outcome$Arm_ID, outcome$SubArm_ID, sep='_')
outcome.new - cbind(outcome, compkey, armkey)
invalid.ids - outcome.new[outcome.new$compkey == outcome.new$armkey,
c(Assessment_record_ID)]

Error in Ops.factor(outcome.new$compkey, outcome.new$armkey) :
  level sets of factors are different



Notice: The information contained in this electronic mail message is
intended only for the use of the designated recipient. This message is
privileged and confidential. and the property of GVK BIO or its
affiliates and subsidiaries. If the reader of this message is not the
intended recipient or an agent responsible for delivering it to the
intended recipient, you are hereby notified that you have received this
message in error and that any review, dissemination, distribution, or
copying of this message is strictly prohibited. If you have received
this communication in error, please notify us immediately by telephone
+91-40-6692tel:%2B91-40-6692 and destroy any and all copies
of this message in your possession (whether hard copies or
electronically stored copies).

   [[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] prevalence of R in publications and institutions

2012-08-17 Thread Douglas Bates
On Fri, Aug 17, 2012 at 6:46 AM, Travis Perry travis.pe...@furman.edu wrote:
 Dr. Bates,
   Our department is considering replacing existing statistical
 software packages in our curriculum with R, at my request.  To better inform
 this decision we are interested to know the prevalence of R in the published
 literature and its use across academic and research institutions.  I have so
 far been unable to find satisfactory information on the subject.   Any
 information you could provide would be much appreciated.

 Thank you in advance for your time and consideration.

 best,

 --
 Travis Perry
 Associate Professor of Biology
 Department of Biology
 Furman University
 3300 Poinsett Highway
 Greenville, SC 29613

 Senior Research Associate
 Rhodes University
 Grahamstown, South Africa
 Cell (864)-561-4240


Because R is an Open Source system which is freely distributed and may
be freely redistributed there is no way of keeping track of the
downloads and its use in academic and research institutions.

Searching for R statistics at a book site such as amazon.com or
barnesandnoble.com should produce enough hits to convince your
colleagues of an active development community.

On scholar.google.com the system itself has been cited 3782 times and
the initial paper on the system by Ihaka and Gentleman has been cited
over 6000 times.

Others on the R-help list may be able to give more information
regarding the use of R in the biological sciences.

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

2012-08-17 Thread penguins
Can anyone tell me how to remove several numbers for a sequence. For example:

xx- c(1,5,7,10)
yy-seq(1,10,1)

how do I get take xx away from yy to get the new sequence 

2,3,4,6,8,9

Many thanks in advance



--
View this message in context: 
http://r.789695.n4.nabble.com/Remove-several-numbers-from-a-sequence-tp4640630.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] RGDAL OGRwrite question

2012-08-17 Thread Scott Duke-Sylvester
I have a quick question: It appears that in rgdal v0.7-12 (R version
2.15.1, OSX 10.6.8) writeOGR will not write a shapefile the the
current directory. Is this correct? An earlier version of rgdal must
have allowed this because I have a older script that used to work, but
doesn't now.

So, as an example, here is what I get today:

 shape = readOGR('.', layer='S20_G75_V00_HAASHP10_R00')
OGR data source with driver: ESRI Shapefile
Source: ., layer: S20_G75_V00_HAASHP10_R00
with 169 features and 23 fields
Feature type: wkbPolygon with 2 dimensions

 writeOGR(shape, '.', layer='temp', driver='ESRI Shapefile', verbose=TRUE)
Error in writeOGR(shape, ., layer = temp, driver = ESRI Shapefile) :
  Creation of output file failed

 writeOGR(shape, '/tmp', layer='temp', driver='ESRI Shapefile',verbose=TRUE)
$object_type
[1] SpatialPolygonsDataFrame

$output_dsn
[1] /tmp

$output_layer
[1] temp

$output_diver
[1] ESRI Shapefile

$output_n
[1] 169

$output_nfields
[1] 23

$output_fields
 [1] ID ANID   F_AREA Avg_z  Manning
 [6] IniWL  IniSal DispCoeff  HydRad veg1_DW
[11] veg2_IWveg3_SWveg4_DCveg5_ICveg6_SC
[16] veg7_Marsh veg8_Swamp Rain_StID  WetlandOpenwater
[21] iniBed_m   maxH_m BoxID

$output_fclasses
 [1] 0 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 4

$dataset_options
NULL

$layer_options
NULL


--
Scott M. Duke-Sylvester
Assistant Professor
Department of Biology

Office : 300 E. St. Mary Blvd
 Billeaud Hall, Room 141
 Lafayette, LA 70504

Mailing address : UL Lafayette
  Department of Biology
  P.O.Box 42451
  Lafayette, LA 70504-2451

Phone : 337 482 5304
Fax   : 337 482 5834
email : smd3...@louisiana.edu


This e-mail message (including any attachments) is for t...{{dropped:11}}

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


Re: [R] Error: level sets of factors are different?

2012-08-17 Thread Rui Barradas

Hello,

The message is not about lengths, it's about sets. It means that the two 
factors, compkey and armkey don't have the same levels, which you can 
see with


levels(compkey)
levels(armkey)

and test for equality.

Also, your post's prologue doesn't have a direct relation with the 
error, you could have skipped the lines up to, including, sink(). It's 
much better to provide an actual data example:


dput( head(outcome, 50) )   # paste the output of this in a post.

Hope this helps,

Rui Barradas
Em 17-08-2012 14:01, Sri krishna Devarayalu Balanagu escreveu:

Why the error is coming? even though the length of outcome.new$compkey and 
outcome.new$armkey were exactly same.
Can anyone help?

setwd(D:/AZ)
library(RODBC)
cdb_cnct - 
odbcConnectExcel(AZIF_DC_GVK_NSCLC_MSALL_287papers_02072012_141450_v1_4.xls)
outcomes - sqlFetch(cdb_cnct, Outcomes_info)
odbcClose(cdb_cnct)
rm(cdb_cnct)
sink(Dependency checks.log)
outcomes[(outcomes$Comparator != ), ] - outcome
compkey - paste(outcome$Comparator, outcome$Comparator_Subarm, sep='_')
armkey - paste(outcome$Arm_ID, outcome$SubArm_ID, sep='_')
outcome.new - cbind(outcome, compkey, armkey)
invalid.ids - outcome.new[outcome.new$compkey == outcome.new$armkey, 
c(Assessment_record_ID)]

Error in Ops.factor(outcome.new$compkey, outcome.new$armkey) :
   level sets of factors are different



Notice: The information contained in this electronic mail message is intended only 
for the use of the designated recipient. This message is privileged and confidential. 
and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this 
message is not the intended recipient or an agent responsible for delivering it to 
the intended recipient, you are hereby notified that you have received this message 
in error and that any review, dissemination, distribution, or copying of this message 
is strictly prohibited. If you have received this communication in error, please 
notify us immediately by telephone +91-40-6692tel:%2B91-40-6692 and 
destroy any and all copies of this message in your possession (whether hard copies or 
electronically stored copies).

[[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] Plot multiple variables: label points

2012-08-17 Thread cm256
I know about the text function,
it works well if I plot just 2 variables - I give the x and the y
coordinates,
but I doesn't work if i try to do this in this plot whith the multiple
variables:

*time1 plot plot
plot time2 plot
plot plot time3*

so what would the solution?

variable[,2:4] are the columns time1, time2 and time3

text(variable[,2:4],variable$group)

doesn't work - give me an error - unable to convert object to double.

What should be the x- and the y-values if every plot has its own x-y-scale?
text(variable$time1, variable$time2, variable$group) just doesn't appear on
the plot?




--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-multiple-variables-label-points-tp4640611p4640626.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] Plot multiple variables: label points

2012-08-17 Thread cm256
The provided solution is:

panel.text - function(x, y, text, ...)
  text (x, y, labels = text)

pairs(variable[,2:4], pch=19, text = variable$group, 
lower.panel = panel.text,
upper.panel = panel.text)



--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-multiple-variables-label-points-tp4640611p4640629.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] set working directory to current source directory

2012-08-17 Thread S Ellison
 

 Subject: Re: [R] set working directory to current source directory
A windows-centric work-round (assuming .Rdata files are 'associated' with the 
right R binary n installation) is to save an empty environment  in the relevant 
project directory with the source file you would normally run. Starting R by 
clicking on .Rdata file opens R in the right directory to start with. Using 
relative paths in scripts thereafter then keeps things within the project work 
area. Starting the first script with rm(list=ls()) guards against inadvertent 
inclusion of old data (and even apparently 'empty' environments aren't 
necessarily empty, so I clean up regardless if I start a session that way).

S Ellison

***
This email and any attachments are confidential. Any use...{{dropped:8}}

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


Re: [R] prevalence of R in publications and institutions

2012-08-17 Thread Martin Morgan

On 08/17/2012 09:25 AM, Douglas Bates wrote:

On Fri, Aug 17, 2012 at 6:46 AM, Travis Perry travis.pe...@furman.edu wrote:

Dr. Bates,
   Our department is considering replacing existing statistical
software packages in our curriculum with R, at my request.  To better inform
this decision we are interested to know the prevalence of R in the published
literature and its use across academic and research institutions.  I have so
far been unable to find satisfactory information on the subject.   Any
information you could provide would be much appreciated.

Thank you in advance for your time and consideration.

best,

--
Travis Perry
Associate Professor of Biology
Department of Biology
Furman University
3300 Poinsett Highway
Greenville, SC 29613

Senior Research Associate
Rhodes University
Grahamstown, South Africa
Cell (864)-561-4240



Because R is an Open Source system which is freely distributed and may
be freely redistributed there is no way of keeping track of the
downloads and its use in academic and research institutions.

Searching for R statistics at a book site such as amazon.com or
barnesandnoble.com should produce enough hits to convince your
colleagues of an active development community.

On scholar.google.com the system itself has been cited 3782 times and
the initial paper on the system by Ihaka and Gentleman has been cited
over 6000 times.

Others on the R-help list may be able to give more information
regarding the use of R in the biological sciences.


The Bioconductor annual report includes attempts to quantify scholarly 
citations


  http://bioconductor.org/about/annual-reports/

The July 2012 report section 1.4 indicates 4115 Google Scholar citations 
of Gentleman et al., 2004, which introduced the project. There were at 
least 321 PubMed citations with the term 'Bioconductor' in 2011. A fun 
game is to open your favourite high-profile science journal and play 
spot-the-R-or-Bioconductor figure or analysis; this is not a challenging 
game.


Martin



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




--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

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


Re: [R] Remove several numbers from a sequence

2012-08-17 Thread R. Michael Weylandt michael.weyla...@gmail.com
Take a look at ?setdiff

Michael

On Aug 17, 2012, at 12:18 PM, penguins cat...@bas.ac.uk wrote:

 Can anyone tell me how to remove several numbers for a sequence. For example:
 
 xx- c(1,5,7,10)
 yy-seq(1,10,1)
 
 how do I get take xx away from yy to get the new sequence 
 
 2,3,4,6,8,9
 
 Many thanks in advance
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Remove-several-numbers-from-a-sequence-tp4640630.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Plot multiple variables: label points

2012-08-17 Thread David L Carlson
When you call plot with more than two columns, uses the pairs() function.
That means you have to write a panel function. Here are a couple of 
relatively simple examples:

pairs(variable[,2:4], panel=function(x, y, ...) text(x, y, 
 variable$group))

pairs(variable[,2:4], panel=function(x, y, ...) points(x, y, 
 pch=as.numeric(variable$group)))

The first one plots the group instead of a point and the second
one plots a symbol for each group.

--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Bert Gunter
 Sent: Friday, August 17, 2012 9:18 AM
 To: cm256
 Cc: r-help@r-project.org
 Subject: Re: [R] Plot multiple variables: label points
 
 ?text
 
 Have you read the Introduction to R tutorial. If not, do so before
 further posting. If so, re-read section 12.2.
 
 -- Bert
 
 
 
 On Fri, Aug 17, 2012 at 6:33 AM, cm256 d-...@gmx.at wrote:
  Hello, I have a data.frame with 10-15 entries which looks like this:
 
  group time1 time2 time3
  1  F18  4394.500  21043.50 14949.00
  2  F25  4678.000  23727.65 15683.12
  3  F30  4909.775  23487.60 16724.40
 
  I plot this with:
  plot(variable[,2:4])
  so that a plot with 3 rows and 3 lines for time1, time2 and time3
 appears.
 
  Is it somehow possible to label the data points with the values
 stored in
  group (F18, F25...)?
 
 
 
  --
  View this message in context: http://r.789695.n4.nabble.com/Plot-
 multiple-variables-label-points-tp4640611.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.
 
 
 
 --
 
 Bert Gunter
 Genentech Nonclinical Biostatistics
 
 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-
 biostatistics/pdb-ncb-home.htm
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Remove several numbers from a sequence

2012-08-17 Thread arun
HI,
Try this:

  yy[is.na(match(yy,xx))]
#[1] 2 3 4 6 8 9
A.K.

- Original Message -
From: penguins cat...@bas.ac.uk
To: r-help@r-project.org
Cc: 
Sent: Friday, August 17, 2012 12:18 PM
Subject: [R] Remove several numbers from a sequence

Can anyone tell me how to remove several numbers for a sequence. For example:

xx- c(1,5,7,10)
yy-seq(1,10,1)

how do I get take xx away from yy to get the new sequence 

2,3,4,6,8,9

Many thanks in advance



--
View this message in context: 
http://r.789695.n4.nabble.com/Remove-several-numbers-from-a-sequence-tp4640630.html
Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] Remove several numbers from a sequence

2012-08-17 Thread Berend Hasselman

On 17-08-2012, at 18:18, penguins wrote:

 Can anyone tell me how to remove several numbers for a sequence. For example:
 
 xx- c(1,5,7,10)
 yy-seq(1,10,1)
 
 how do I get take xx away from yy to get the new sequence 
 
 2,3,4,6,8,9
 
You can also do this

yy[!(yy %in% xx)]

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] sample from a joint distribution of discrete continuous variables (survival analysis)

2012-08-17 Thread Jie
Dear All,

My question is from the simulation of survival time with censoring
indicator.
Suppose I have a person with:
1. exponential life time, h(t) = lambda* exp(- lambda* t), some
known lambda0.
2. a pre-determined event time, constant T;
3. a censoring indicator, delta=0 if the observed life time is greater than
T, =1 other wise.

I would like to sample (t, delta).
According to some textbooks in this field,  the joint distribution
f (t, delta) = h(t) ^ delta * S(t) ^ (1 - delta)
   = lambda ^ delta * S(t) , where S(t) = integrated h(s) from
0 to t.
   = lambda^ delta * exp (- lambda*t )

What I did earlier was to sample t from the h(t), compare it with T and
obtain delta,
But I am not confidient with this approach. Could anyone give an example or
idea, please?
And in general, how do solve this kind of problem? Inversing the uniform
random variable is only for continuous case?

Thank you for your time.

Best wishes,
Jie

[[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] Get the filename from the given path

2012-08-17 Thread William Dunlap
Q.
 Here i have a file path, for eg : - FPath - D:\\MyFolder\\MyFile.txt
 HOW IS POSSIBLE TO GET THE FILE NAME FROM THIS GIVEN PATH ?
A.
 x - substr(FPath,13,nchar(FPath)) should give you the desired output.

But this is much like saying
   x - MyFile.txt
will give you the desired output - where did the 13 come from?

Use basename() for a general solution.
   basename(FPath)
  [1] MyFile.txt
dirname(FPath) gives you the directory that FPath is in in.

(To other responders, those who don't know that all caps means shouting
probably don't know that the answer '?basename' means to type that into
R to look at the help file for the basename function.)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf
 Of Rantony
 Sent: Friday, August 17, 2012 4:56 AM
 To: r-help@r-project.org
 Subject: Re: [R] Get the filename from the given path
 
 Thanks pramod.
 
 
 
 From: Pramod [via R] [mailto:ml-node+s789695n4640600...@n4.nabble.com]
 Sent: Friday, August 17, 2012 5:24 PM
 To: Akkara, Antony (GE Energy, Non-GE)
 Subject: Re: Get the filename from the given path
 
 
 
 x - substr(FPath,13,nchar(FPath)) should give you the desired output.
 
 
 
 If you reply to this email, your message will be added to the discussion
 below:
 
 http://r.789695.n4.nabble.com/Get-the-filename-from-the-given-path-tp464
 0578p4640600.html
 
 To unsubscribe from Get the filename from the given path, click here
 http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscrib
 e_by_codenode=4640578code=YW50b255LmFra2FyYUBnZS5jb218NDY0MDU3OHwx
 NTUx
 OTQzMDI5 .
 NAML
 http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_view
 erid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.Bas
 icNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.tem
 plate.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml
 -instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemai
 l.naml
 
 
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Get-the-filename-from-
 the-given-path-tp4640578p4640601.html
 Sent from the R help mailing list archive at Nabble.com.
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] dimnames in an array(I'll be grateful if this message will be passed to all list users)

2012-08-17 Thread R. Michael Weylandt michael.weyla...@gmail.com


On Aug 17, 2012, at 9:25 AM, aleksandr shfets a_shf...@mail.ru wrote:

 
 Michael,
 Thank you for suggestions; 
 it seems to me that there's a fundamental lacuna with respect to names of a 
 three dimensional array:

A lacuna in the English language, not in R: though perhaps Prof Ripley's 
employer's dictionary's editors could help us out ;-) 

[that might be the closest I've ever gotten to chained pointers in a natural 
language]

 that is, rownames fits dimension 1, colnames fits another dimension(that is, 
 3, if I read it correctly),
 but there is no specific name for the third dimension. I've tried setnames 
 thinking that this would be appropriate 
 for naming the sets, but there is no such R function.
 
 On the other hand you're right, the suggestion
  dimnames(data11a)[[2]]=c(V,R)
 
 doesn't ameliorate the analysis: while now dimnames(data11a)[[2]]
 
 comes out as 
 [2]
 
 returning to the original analysis the same error comes up, that is, that the 
 length of dimnames[2] doesn't agree with thee.

I don't believe I made any prescriptions about length(dimnames[2]) so I have no 
idea what you mean here about it not agreeing with me.

Also, there's almost no chance that's valid syntax: it should throw a 'closure 
not subsettable' error unless you over-wrote the name of a very important 
function (which you should not do).

 And I believe I told you that you want double brackets here. 

 'array extent' -- that is, even though the boxcar contents are two in number, 
 it evaluates the analysis on the basis of the 
 dimnames(data11a)[2] value.

No! Double brackets. 

 
 I'm using colloc infer (available under R 2.14) and trying to do the 
 FHN(FitzHugh Nagumo) analysis in section 9.1 of the manual; it's very complex 
 work, but I doubt the program is in error.

I'm travelling currently so I can't track this down (no wifi) but I'll try 
later. In the meanwhile, see Bill Dunlap's suggestions. 

 
 It seems to me in any case that, if R demands that the length of 'dimnames[2] 
 must be equal to the array extent, then there must be a way to make the 
 length of the names equal to the extent of the array, am I right?

Again -- your code (dimnames[2]) looks like nonsense -- I think you've 
overwritten a function that you shouldn't have. 

 Otherwise R would be inconsistent with itself, like Nomad on Startrek, and 
 I've never seen a case where it was thus.

Really? Never thought about the S3 naming conventions then

 
 This is again why I ask if others with extensive experience with dimnames of 
 an array have seen anything similar.
 Certainly someone might know what is the significance of the dimnames of the 
 array, how much can the length of them be altered for use generally?

Dimnames must have lengths which correspond to the dimensions of the underlying 
array -- that is 

dim(a) == sapply(dimnames(a) length)

Nothing else really makes sense. The only way to change the lengths of the 
dimnames is to reshape the array. 

Michael

 
 regards,
 A
 Thu, 16 Aug 2012 00:00:35 -0400 от R. Michael Weylandt 
 michael.weyla...@gmail.com:
 On Wed, Aug 15, 2012 at 3:57 AM, aleksandr shfets a_shf...@mail.ru wrote:
  Hi Michael,
  Thanks for help on double brackets: I wasn't aware of this use of them.
 
  I went back to readjust my array so the dimnames(data11a)[[2]] would have
  two elements, and remade the array to include the new dimnames:
 
  dimnames(data11a)[[2]]=c(V,R)
 
  so that inside the second car of the train would
  be two items?
 
 Yes.
 
 
  There seems to be no way to define dimnames(data11a)[2] to be two elements
  rather than one[as you say we have no way to combine the elements of the
  train except using the train].
 
 You could do this:
 
 dimnames(data11a)[2] - list(c(V,R))
 
 but I'm not sure that's any clearer. To keep the metaphor rolling (get
 it!), list() puts your stuff in a boxcar so now you can put it
 directly on the train.
 
  So having tried to do what I can to make the
  middle element of the list to two rather than one, I rerun the analysis with
  the same result.
 
  if I read the thing right, regardless of how I define the inside of the
  boxcar, the analysis that I referred to
 
  res11a = inneropt(coefs, times=times, data=data11a,
  lik=lik,
  proc=proc, pars=spars, in.meth='nlminb',
  control.in=control.out)
 
 
 Where is this inneropt function from? It could be an error in that. If
 it's from a package, give me the name and I'll take a look at it and
 you can also contact the maintainer: get contact info using the
 maintainer() function.
 
 Also, some of the advice here will probably be helpful in seeking follow-up:
 
 http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 
 Cheers,
 Michael
 
  still won't look at the 'contents' of the car, but gives the same message:
 
  Error in `colnames-`(`*tmp*`, value = c(V, R)) :
  length of 'dimnames' [2] not equal to array extent
 
 
  I've tried a couple of other things like, after 

Re: [R] Error: level sets of factors are different?

2012-08-17 Thread Noia Raindrops
The cbind method to data.frame is just a wrapper for data.frame(...). So 
character columns are converted to factors.

dat - cbind(data.frame(x = 1:3), a = c(a, b, c), b = c(a, a, c))
str(dat)
## 'data.frame': 3 obs. of  3 variables:
##  $ x: int  1 2 3
##  $ a: Factor w/ 3 levels a,b,c: 1 2 3
##  $ b: Factor w/ 2 levels a,c: 1 1 2
dat$a == dat$b
## Error in Ops.factor(dat$a, dat$b) : level sets of factors are different

as.character(dat$a) == as.character(dat$b)
## [1]  TRUE FALSE  TRUE

dat - cbind(data.frame(x = 1:3), a = c(a, b, c), b = c(a, a, c), 
stringsAsFactors = FALSE)
str(dat)
## 'data.frame': 3 obs. of  3 variables:
##  $ x: int  1 2 3
##  $ a: chr  a b c
##  $ b: chr  a a c
dat$a == dat$b
## [1]  TRUE FALSE  TRUE

-- 
Noia Raindrops
noia.raindr...@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] Remove several numbers from a sequence

2012-08-17 Thread Clint Bowman

yy[!yy%in%xx]

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

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 17 Aug 2012, penguins wrote:


Can anyone tell me how to remove several numbers for a sequence. For example:

xx- c(1,5,7,10)
yy-seq(1,10,1)

how do I get take xx away from yy to get the new sequence

2,3,4,6,8,9

Many thanks in advance



--
View this message in context: 
http://r.789695.n4.nabble.com/Remove-several-numbers-from-a-sequence-tp4640630.html
Sent from the R help mailing list archive at Nabble.com.

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



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


Re: [R] Unequal splits from a column

2012-08-17 Thread David L Carlson
Here's a slightly different approach without regular expressions:

 dat1-data.frame(slope=c(slope (60/25/15),slope (90/10), 
 slope (40/35/15/10),slope (40/25/25/10) ))

 tmp - strsplit(as.character(dat1$slope), split=[/()])
 tmp2 - sapply(tmp, function(x) as.numeric(x[-1]))
 maxlen - max(sapply(tmp2, length))
 datnew - data.frame(t(sapply(tmp2, function(x) c(x, rep(0, 
 maxlen-length(x))
 datnew
  X1 X2 X3 X4
1 60 25 15  0
2 90 10  0  0
3 40 35 15 10
4 40 25 25 10

--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of arun
 Sent: Friday, August 17, 2012 6:56 AM
 To: Sapana Lohani
 Cc: R help
 Subject: Re: [R] Unequal splits from a column
 
 HI,
 Try this:
 dat1-data.frame(slope=c(slope (60/25/15),slope (90/10),slope
 (40/35/15/10),slope (40/25/25/10) ))
 dat1$slope-gsub(slope\\s+.*(\\(.*\\)),\\1,dat1$slope)
  dat1$slope-gsub(\\((.*)\\),\\1,dat1$slope)
 dat2-strsplit(dat1$slope,/)
 dat2[[1]][4]-0
 dat2[[2]][3:4]-0
 data.frame(do.call(rbind,dat2))
 #  X1 X2 X3 X4
 #1 60 25 15  0
 #2 90 10  0  0
 #3 40 35 15 10
 #4 40 25 25 10
 
 
 
 - Original Message -
 From: Sapana Lohani lohani.sap...@ymail.com
 To: r-help@r-project.org r-help@r-project.org
 Cc:
 Sent: Friday, August 17, 2012 1:05 AM
 Subject: [R] Unequal splits from a column
 
 Hi I am new to R so am struggling with the commands here
 
 I have one column in a table that looks like
 
 
 slope (60/25/15)
 slope (90/10)
 slope (40/35/15/10)
 slope (40/25/25/10)
 I want to have 4 columns with just the number inside the parenthesis.
 when there is no number that cell can have 0. I want the output like
 this
 
 60 25 15 0
 90 10 0 0
 40 35 15 10
 40 25 25 10
 
 Can somebody help me??
 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-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] mixed model in r

2012-08-17 Thread li li
Dear all,
   I am really confused with the syntax for mixed model using lmer in lme4
library.

My model is  Value = Sample + Run (nested with Sample )

Here sample is a fixed effect and Run is a random effect nested with
sample.
Can anyone give some hint on the correct syntex for this model.

Thanks very much in advance.
Hannah

[[alternative HTML version deleted]]

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


[R] Opinion: Why I find factors convenient to use

2012-08-17 Thread Bert Gunter
Folks:

Over the years, many people -- including some who I would consider
real expeRts -- have criticized factors and advocated the use
(sometimes exclusively) of character vectors instead. I would just
like to point out that, for me, factors provide one feature that I
find to be very convenient: ordering of levels. **

As an example, suppose one has a character vector of labels small,
medium, and large. Then most R functions (e.g. tapply()) will
display results involving this vector in alphabetical order, which I
think most would view as undesirable. By converting to a factor with
levels in the logical order, displays will automatically be logical.
For example:

 x - sample(c(small,medium,large),12,rep=TRUE)
 table(x)
x
 large medium  small
 2  3  7
 y - factor(x,lev=c(small,medium,large)) ##ordered() also would do, but 
 is not necessary for this
 table(y)
y
 small medium  large
 7  3  2

Naturally, this is just my opinion, and I understand why lots of smart
people find factors irritating (at least!). So contrary opinions
cheerily welcomed. But perhaps these comments might be helpful to
those who have been bitten by factors or just wonder what all the
fuss is about.

** Another advantage is reduced storage space, I believe. Please
correct if wrong.

Cheers,
Bert

-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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


Re: [R] Opinion: Why I find factors convenient to use

2012-08-17 Thread PIKAL Petr
I second to Bert's opinion, factors can be confusing, but they have quite nice 
features which can not be easily mimicked by plain character vectors. I find 
extremelly usefull possibility of manipulating its levels.

 fac-factor(sample(letters[1:5], 20, replace=TRUE))
 fac
 [1] e e d d e e c e a e a e b b d e c c d b
Levels: a b c d e
 levels(fac)[2:4]- new.level
 fac
 [1] e e new.level new.level e e new.level
 [8] e a e a e new.level new.level
[15] new.level e new.level new.level new.level new.level
Levels: a new.level e


Regards
Petr



Odesílate: r-help-boun...@r-project.org [r-help-boun...@r-project.org] za 
uživatele Bert Gunter [gunter.ber...@gene.com]
Odesláno: 17. srpna 2012 19:32
To: r-help@r-project.org
Předmět: [R] Opinion: Why I find factors convenient to use

Folks:

Over the years, many people -- including some who I would consider
real expeRts -- have criticized factors and advocated the use
(sometimes exclusively) of character vectors instead. I would just
like to point out that, for me, factors provide one feature that I
find to be very convenient: ordering of levels. **

As an example, suppose one has a character vector of labels small,
medium, and large. Then most R functions (e.g. tapply()) will
display results involving this vector in alphabetical order, which I
think most would view as undesirable. By converting to a factor with
levels in the logical order, displays will automatically be logical.
For example:

 x - sample(c(small,medium,large),12,rep=TRUE)
 table(x)
x
 large medium  small
 2  3  7
 y - factor(x,lev=c(small,medium,large)) ##ordered() also would do, but 
 is not necessary for this
 table(y)
y
 small medium  large
 7  3  2

Naturally, this is just my opinion, and I understand why lots of smart
people find factors irritating (at least!). So contrary opinions
cheerily welcomed. But perhaps these comments might be helpful to
those who have been bitten by factors or just wonder what all the
fuss is about.

** Another advantage is reduced storage space, I believe. Please
correct if wrong.

Cheers,
Bert

--

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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


Re: [R] Opinion: Why I find factors convenient to use

2012-08-17 Thread Jeff Newmiller
I don't know if my recent post on this prompted your post, but I don't see much 
to argue with in your discussion. I find factors to be useful for managing 
display and some kinds of analysis.  

However, I find them mostly a handicap when importing, merging, and handling 
data QC. Therefore I delay conversion until late in the game... but usually I 
do eventually convert in most cases.
---
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.



Bert Gunter gunter.ber...@gene.com wrote:

Folks:

Over the years, many people -- including some who I would consider
real expeRts -- have criticized factors and advocated the use
(sometimes exclusively) of character vectors instead. I would just
like to point out that, for me, factors provide one feature that I
find to be very convenient: ordering of levels. **

As an example, suppose one has a character vector of labels small,
medium, and large. Then most R functions (e.g. tapply()) will
display results involving this vector in alphabetical order, which I
think most would view as undesirable. By converting to a factor with
levels in the logical order, displays will automatically be logical.
For example:

 x - sample(c(small,medium,large),12,rep=TRUE)
 table(x)
x
 large medium  small
 2  3  7
 y - factor(x,lev=c(small,medium,large)) ##ordered() also would
do, but is not necessary for this
 table(y)
y
 small medium  large
 7  3  2

Naturally, this is just my opinion, and I understand why lots of smart
people find factors irritating (at least!). So contrary opinions
cheerily welcomed. But perhaps these comments might be helpful to
those who have been bitten by factors or just wonder what all the
fuss is about.

** Another advantage is reduced storage space, I believe. Please
correct if wrong.

Cheers,
Bert

-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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

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


Re: [R] Opinion: Why I find factors convenient to use

2012-08-17 Thread Steve Lianoglou
Hi,

On Fri, Aug 17, 2012 at 1:58 PM, Jeff Newmiller
jdnew...@dcn.davis.ca.us wrote:
 I don't know if my recent post on this prompted your post, but I don't see 
 much to argue with in your discussion. I find factors to be useful for 
 managing display and some kinds of analysis.

 However, I find them mostly a handicap when importing, merging, and handling 
 data QC. Therefore I delay conversion until late in the game... but usually I 
 do eventually convert in most cases.

Agreed here -- I actually haven't been tuned into any such recent
conversation (if there was one), but if I were a gambling man, I'd bet
that the majority of the problems people have with factors can
probably be boiled down to the fact that the default value for
stringsAsFactors is TRUE.

I like factors -- that said, I am annoyed by them at times, but I
still like them.

Also, Bert mentioned that he thinks they save space over characters --
I believe that this is no longer true, but I'm not certain.

-steve

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

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


Re: [R] Opinion: Why I find factors convenient to use

2012-08-17 Thread Bert Gunter
Steve, et. al:

Yes, if object.size() is to be believed, you're right:

 x -sample(c(small,medium,large),1e4,rep=TRUE)
 y - factor(x)
 object.size(x)
40120 bytes
 object.size(y)
40336 bytes

I stand (happily) corrected.

-- Bert

On Fri, Aug 17, 2012 at 11:09 AM, Steve Lianoglou
mailinglist.honey...@gmail.com wrote:
 Hi,

 On Fri, Aug 17, 2012 at 1:58 PM, Jeff Newmiller
 jdnew...@dcn.davis.ca.us wrote:
 I don't know if my recent post on this prompted your post, but I don't see 
 much to argue with in your discussion. I find factors to be useful for 
 managing display and some kinds of analysis.

 However, I find them mostly a handicap when importing, merging, and handling 
 data QC. Therefore I delay conversion until late in the game... but usually 
 I do eventually convert in most cases.

 Agreed here -- I actually haven't been tuned into any such recent
 conversation (if there was one), but if I were a gambling man, I'd bet
 that the majority of the problems people have with factors can
 probably be boiled down to the fact that the default value for
 stringsAsFactors is TRUE.

 I like factors -- that said, I am annoyed by them at times, but I
 still like them.

 Also, Bert mentioned that he thinks they save space over characters --
 I believe that this is no longer true, but I'm not certain.

 -steve

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



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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


[R] spatial auto-correlation structure in nlme

2012-08-17 Thread Gary Dong
Dear R users,

I'm estimating a mixed effects model in which the spatial correlation is
controlled for by the corGaus structure. I'm wondering if there is a
document or paper that explains how the spatial correlation structure (such
as corExp or corGaus) works.

Let me use the example and data posted on UCLA's R FAQ webpage to explain
my problems. The link for the webpage is:
http://www.ats.ucla.edu/stat/r/faq/spatial_regression.htm

install.packages(nlme)
library(nlme)

spdata - read.table(http://www.ats.ucla.edu/stat/R/faq/thick.csv;, header
= T, sep = ,)
dummy - rep(1, 75)
spdata - cbind(spdata, dummy)

### estimate the null model ###
soil.model - lme(fixed = thick ~ soil, data = spdata, random = ~ 1 |
dummy, method = ML)
summary(soil.model)
plot(Variogram(soil.model,form=~north+east))

### updated the model by the spatial correlation structure 
soil.gaus - update(soil.model, correlation=corGaus(1,form=~north+east))
summary(soil.gaus)
plot(Variogram(soil.gaus,form=~north+east))

My questions are:

1) Is there a way that I can tell, to what extent the spatial correlation
has been controlled for by the model, besides the improvements of AIC, BIC,
and Loglik?

2) where can I find the formulas for the corExp or corGaus?

Thanks!

Gary

[[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] Opinion: Why I find factors convenient to use

2012-08-17 Thread Rui Barradas

Hello,

No, factors may use less memory. System dependent?

 x -sample(c(small,medium,large),1e4,rep=TRUE)
 y - factor(x)
 object.size(x)
80184 bytes
 object.size(y)
40576 bytes

 sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Portuguese_Portugal.1252 LC_CTYPE=Portuguese_Portugal.1252
[3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Portugal.1252

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

other attached packages:
[1] Rcapture_1.2-0 xts_0.8-0  zoo_1.7-7

loaded via a namespace (and not attached):
[1] chron_2.3-39   fortunes_1.4-2 grid_2.15.1lattice_0.20-6 tools_2.15.1


And I agree with what Steve said, stringsAsFactors = FALSE saves hours 
of debuging time.


Rui Barradas

Em 17-08-2012 19:19, Bert Gunter escreveu:

Steve, et. al:

Yes, if object.size() is to be believed, you're right:


x -sample(c(small,medium,large),1e4,rep=TRUE)
y - factor(x)
object.size(x)

40120 bytes

object.size(y)

40336 bytes

I stand (happily) corrected.

-- Bert

On Fri, Aug 17, 2012 at 11:09 AM, Steve Lianoglou
mailinglist.honey...@gmail.com wrote:

Hi,

On Fri, Aug 17, 2012 at 1:58 PM, Jeff Newmiller
jdnew...@dcn.davis.ca.us wrote:

I don't know if my recent post on this prompted your post, but I don't see much 
to argue with in your discussion. I find factors to be useful for managing 
display and some kinds of analysis.

However, I find them mostly a handicap when importing, merging, and handling 
data QC. Therefore I delay conversion until late in the game... but usually I 
do eventually convert in most cases.

Agreed here -- I actually haven't been tuned into any such recent
conversation (if there was one), but if I were a gambling man, I'd bet
that the majority of the problems people have with factors can
probably be boiled down to the fact that the default value for
stringsAsFactors is TRUE.

I like factors -- that said, I am annoyed by them at times, but I
still like them.

Also, Bert mentioned that he thinks they save space over characters --
I believe that this is no longer true, but I'm not certain.

-steve

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





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


Re: [R] Opinion: Why I find factors convenient to use

2012-08-17 Thread Peter Langfelder
On Fri, Aug 17, 2012 at 11:34 AM, Rui Barradas ruipbarra...@sapo.pt wrote:
 Hello,

 No, factors may use less memory. System dependent?

I think it's a 32-bit vs. 64-bit distinction - I get Rui's results on
64-bit Windows and Linux installation, but Bert's result on a 32-bit
Linux machine.

Peter


 x -sample(c(small,medium,large),1e4,rep=TRUE)
 y - factor(x)
 object.size(x)
 80184 bytes
 object.size(y)
 40576 bytes

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


Re: [R] RGDAL OGRwrite question

2012-08-17 Thread MacQueen, Don
Are the output files already there?
In that case, try overwrite_layer=TRUE

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 8/17/12 9:28 AM, Scott Duke-Sylvester scottdukesylves...@gmail.com
wrote:

I have a quick question: It appears that in rgdal v0.7-12 (R version
2.15.1, OSX 10.6.8) writeOGR will not write a shapefile the the
current directory. Is this correct? An earlier version of rgdal must
have allowed this because I have a older script that used to work, but
doesn't now.

So, as an example, here is what I get today:

 shape = readOGR('.', layer='S20_G75_V00_HAASHP10_R00')
OGR data source with driver: ESRI Shapefile
Source: ., layer: S20_G75_V00_HAASHP10_R00
with 169 features and 23 fields
Feature type: wkbPolygon with 2 dimensions

 writeOGR(shape, '.', layer='temp', driver='ESRI Shapefile',
verbose=TRUE)
Error in writeOGR(shape, ., layer = temp, driver = ESRI Shapefile) :
  Creation of output file failed

 writeOGR(shape, '/tmp', layer='temp', driver='ESRI
Shapefile',verbose=TRUE)
$object_type
[1] SpatialPolygonsDataFrame

$output_dsn
[1] /tmp

$output_layer
[1] temp

$output_diver
[1] ESRI Shapefile

$output_n
[1] 169

$output_nfields
[1] 23

$output_fields
 [1] ID ANID   F_AREA Avg_z  Manning
 [6] IniWL  IniSal DispCoeff  HydRad veg1_DW
[11] veg2_IWveg3_SWveg4_DCveg5_ICveg6_SC
[16] veg7_Marsh veg8_Swamp Rain_StID  WetlandOpenwater
[21] iniBed_m   maxH_m BoxID

$output_fclasses
 [1] 0 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 4

$dataset_options
NULL

$layer_options
NULL


--
Scott M. Duke-Sylvester
Assistant Professor
Department of Biology

Office : 300 E. St. Mary Blvd
 Billeaud Hall, Room 141
 Lafayette, LA 70504

Mailing address : UL Lafayette
  Department of Biology
  P.O.Box 42451
  Lafayette, LA 70504-2451

Phone : 337 482 5304
Fax   : 337 482 5834
email : smd3...@louisiana.edu


This e-mail message (including any attachments) is for t...{{dropped:11}}

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

2012-08-17 Thread Scott Duke-Sylvester
In the example I gave, the temp.shp, 'temp.bdf, etc ... do not
exist in the current working directory (.) before I call:
writeOGR(shape, '.', layer='temp', driver='ESRI Shapefile', verbose=TRUE)

I should have specified this. Also, the working directory permissions
are set to owner read/write/execute (unix: drwxr-xr-x).



On Fri, Aug 17, 2012 at 2:17 PM, MacQueen, Don macque...@llnl.gov wrote:
 Are the output files already there?
 In that case, try overwrite_layer=TRUE

 -Don

 --
 Don MacQueen

 Lawrence Livermore National Laboratory
 7000 East Ave., L-627
 Livermore, CA 94550
 925-423-1062





 On 8/17/12 9:28 AM, Scott Duke-Sylvester scottdukesylves...@gmail.com
 wrote:

I have a quick question: It appears that in rgdal v0.7-12 (R version
2.15.1, OSX 10.6.8) writeOGR will not write a shapefile the the
current directory. Is this correct? An earlier version of rgdal must
have allowed this because I have a older script that used to work, but
doesn't now.

So, as an example, here is what I get today:

 shape = readOGR('.', layer='S20_G75_V00_HAASHP10_R00')
OGR data source with driver: ESRI Shapefile
Source: ., layer: S20_G75_V00_HAASHP10_R00
with 169 features and 23 fields
Feature type: wkbPolygon with 2 dimensions

 writeOGR(shape, '.', layer='temp', driver='ESRI Shapefile',
verbose=TRUE)
Error in writeOGR(shape, ., layer = temp, driver = ESRI Shapefile) :
  Creation of output file failed

 writeOGR(shape, '/tmp', layer='temp', driver='ESRI
Shapefile',verbose=TRUE)
$object_type
[1] SpatialPolygonsDataFrame

$output_dsn
[1] /tmp

$output_layer
[1] temp

$output_diver
[1] ESRI Shapefile

$output_n
[1] 169

$output_nfields
[1] 23

$output_fields
 [1] ID ANID   F_AREA Avg_z  Manning
 [6] IniWL  IniSal DispCoeff  HydRad veg1_DW
[11] veg2_IWveg3_SWveg4_DCveg5_ICveg6_SC
[16] veg7_Marsh veg8_Swamp Rain_StID  WetlandOpenwater
[21] iniBed_m   maxH_m BoxID

$output_fclasses
 [1] 0 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 4

$dataset_options
NULL

$layer_options
NULL


--
Scott M. Duke-Sylvester
Assistant Professor
Department of Biology

Office : 300 E. St. Mary Blvd
 Billeaud Hall, Room 141
 Lafayette, LA 70504

Mailing address : UL Lafayette
  Department of Biology
  P.O.Box 42451
  Lafayette, LA 70504-2451

Phone : 337 482 5304
Fax   : 337 482 5834
email : smd3...@louisiana.edu


This e-mail message (including any attachments) is for t...{{dropped:11}}

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




-- 
Scott M. Duke-Sylvester
Assistant Professor
Department of Biology

Office : 300 E. St. Mary Blvd
 Billeaud Hall, Room 141
 Lafayette, LA 70504

Mailing address : UL Lafayette
  Department of Biology
  P.O.Box 42451
  Lafayette, LA 70504-2451

Phone : 337 482 5304
Fax   : 337 482 5834
email : smd3...@louisiana.edu


This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information.  If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).

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


Re: [R] Trouble compiling package on Windows (64 bit)

2012-08-17 Thread Fg Nu
Uwe,

I did give you the output from R CMD INSTALL (or at least, what I thought was 
the relevant part). 

Here is the output in toto:

* installing to library 'C:/programming/r/revolutions/R-2.14.2/library'
* installing *source* package 'KernGPLM' ...
** libs

*** arch - i386
ERROR: compilation failed for package 'KernGPLM'
* removing 'C:/programming/r/revolutions/R-2.14.2/library/KernGPLM'

Any advice will be very useful.

Thanks.


- Original Message -
From: Uwe Ligges lig...@statistik.tu-dortmund.de
To: Fg Nu fgn...@yahoo.com
Cc: r-help@r-project.org r-help@r-project.org
Sent: Friday, August 17, 2012 4:45 AM
Subject: Re: [R] Trouble compiling package on Windows (64 bit)



On 17.08.2012 12:38, Fg Nu wrote:


 I am trying to compile the R package KernGPLM found here:
 http://www.marlenemueller.de/KernGPLM/KernGPLM_0.65.tar.gz


 since the binary available is for R 2.4.

 but the compilation ends with the error message:
 *** arch-i386
 ERROR: compilation failed for the package 'KernGPLM'


See the R Installation and Administration manual.
It tells you how to set up an environment under Windows to be able to 
install the package from sources.

We cannot say more without the actual output of R CMD INSTALL.

Best,
Uwe Ligges




 Here is my session info:

 R version 2.14.2 (2012-02-29)
 Platform: x86_64-pc-mingw32/x64 (64-bit)

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

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

 other attached packages:
 [1] Revobase_6.0.0   RevoMods_6.0.0   RevoScaleR_3.0-0 lattice_0.20-0

 loaded via a namespace (and not attached):
 [1] codetools_0.2-8 foreach_1.4.0   grid_2.14.2     iterators_1.0.6
 [5] tools_2.14.2



 Is it possible to diagnose the problem from this information?

 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.



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


Re: [R] prevalence of R in publications and institutions

2012-08-17 Thread Travis Perry
Thank you both for your time and assistance.

On Fri, Aug 17, 2012 at 12:25 PM, Douglas Bates ba...@stat.wisc.edu wrote:

 ** **
 On Fri, Aug 17, 2012 at 6:46 AM, Travis Perry travis.pe...@furman.edu
 wrote:
  Dr. Bates,
Our department is considering replacing existing statistical
  software packages in our curriculum with R, at my request.  To better
 inform
  this decision we are interested to know the prevalence of R in the
 published
  literature and its use across academic and research institutions.  I
 have so
  far been unable to find satisfactory information on the subject.   Any
  information you could provide would be much appreciated.
 
  Thank you in advance for your time and consideration.
 
  best,
 
  --
  Travis Perry
  Associate Professor of Biology
  Department of Biology
  Furman University
  3300 Poinsett Highway
  Greenville, SC 29613
 
  Senior Research Associate
  Rhodes University
  Grahamstown, South Africa
  Cell (864)-561-4240
 

 Because R is an Open Source system which is freely distributed and may
 be freely redistributed there is no way of keeping track of the
 downloads and its use in academic and research institutions.

 Searching for R statistics at a book site such as amazon.com or
 barnesandnoble.com should produce enough hits to convince your
 colleagues of an active development community.

 On scholar.google.com the system itself has been cited 3782 times and
 the initial paper on the system by Ihaka and Gentleman has been cited
 over 6000 times.

 Others on the R-help list may be able to give more information
 regarding the use of R in the biological sciences.




-- 
Travis Perry
Associate Professor of Biology
Department of Biology
Furman University
3300 Poinsett Highway
Greenville, SC 29613

Senior Research Associate
Rhodes University
Grahamstown, South Africa
Cell (864)-561-4240

[[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] Appending many different and separate Excel files using R

2012-08-17 Thread Amir Kasaeian
Dear all, 
Good day! 
I have a problem in reading Excel files in R and appending them to each other. 
Suppose we have several Excel files in a directory with headers and want to use 
R to append them in a single file with an additional variable in the final file 
indicating from which files the data come from. 
As I have many Excel files and their sizes are very big I should write a loop 
in R to do the work. 
I will be very happy if you guide and help me to write the codes. 
Thank you very much in advance. 

Kind regards, 
Amir Kasaeian




Amir Kasaeian, 
PhD Student in Biostatistics,
Dept. of Epidemiology and Biostatistics,
School of Public Health,
Tehran University of Medical Sciences (TUMS).
P.B. : 14155-6446
Cell Phone: +98-912-2063511
E-mail: akasae...@razi.tums.ac.ir
    amir_kasae...@yahoo.com   

[[alternative HTML version deleted]]

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


Re: [R] prevalence of R in publications and institutions

2012-08-17 Thread David L Carlson
From a blurb I wrote recently:

Publishing on R has accelerated over the last few years. Chapman and
Hall/CRC Press publish over 50 books on R and has recently issued a call for
new submissions. Springer has a growing series called Use R! (38 volumes).
Wiley has a series called Statistics Using R (28 volumes). 

--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352



 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Travis Perry
 Sent: Friday, August 17, 2012 3:14 PM
 To: Douglas Bates
 Cc: r-help
 Subject: Re: [R] prevalence of R in publications and institutions
 
 Thank you both for your time and assistance.
 
 On Fri, Aug 17, 2012 at 12:25 PM, Douglas Bates ba...@stat.wisc.edu
 wrote:
 
  ** **
  On Fri, Aug 17, 2012 at 6:46 AM, Travis Perry
 travis.pe...@furman.edu
  wrote:
   Dr. Bates,
 Our department is considering replacing existing
 statistical
   software packages in our curriculum with R, at my request.  To
 better
  inform
   this decision we are interested to know the prevalence of R in the
  published
   literature and its use across academic and research institutions.
 I
  have so
   far been unable to find satisfactory information on the subject.
 Any
   information you could provide would be much appreciated.
  
   Thank you in advance for your time and consideration.
  
   best,
  
   --
   Travis Perry
   Associate Professor of Biology
   Department of Biology
   Furman University
   3300 Poinsett Highway
   Greenville, SC 29613
  
   Senior Research Associate
   Rhodes University
   Grahamstown, South Africa
   Cell (864)-561-4240
  
 
  Because R is an Open Source system which is freely distributed and
 may
  be freely redistributed there is no way of keeping track of the
  downloads and its use in academic and research institutions.
 
  Searching for R statistics at a book site such as amazon.com or
  barnesandnoble.com should produce enough hits to convince your
  colleagues of an active development community.
 
  On scholar.google.com the system itself has been cited 3782 times and
  the initial paper on the system by Ihaka and Gentleman has been cited
  over 6000 times.
 
  Others on the R-help list may be able to give more information
  regarding the use of R in the biological sciences.
 
 
 
 
 --
 Travis Perry
 Associate Professor of Biology
 Department of Biology
 Furman University
 3300 Poinsett Highway
 Greenville, SC 29613
 
 Senior Research Associate
 Rhodes University
 Grahamstown, South Africa
 Cell (864)-561-4240
 
   [[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] REPOST: Need help interpreting output from rcorrp.cens with Cox regression

2012-08-17 Thread Peter Jepsen
I am reposting my message from April 8th because I never received a response to 
the original post:

Dear R-listers, 

I am an MD and clinical epidemiologist developing a measure of comorbidity 
severity for patients with liver disease. Having developed my comorbidity score 
as the linear predictor from a Cox regression model I want to compare the 
discriminative ability of my comorbidity measure with the old comorbidity 
measure, Charlson's Comorbidity Index. I have nearly 10,000 deaths and 36 
candidate comorbidities.
 
I wish to compare the discrimination of the two comorbidity measures, i.e. I 
have two non-nested Cox models. I get the following output with
 
 rcorrp.cens(myscore.lp, charlson.lp, Surv(time, dead), method=1): 


x1 = My comorbidity score, x2 = Charlson 
   [,1]
Dxy-0.0605
S.D.   0.00648
x1 more concordant 0.4697
x2 more concordant 0.5302
n  1.369e+04
missing0
uncensored 9411
Relevant Pairs 1.587e+08
Uncertain  2.861e+07
C X1   0.395
C X2   0.401
Dxy X1 -0.21
Dxy X2 -0.198

 
I am aware that because a high hazard means short survival I must subtract C X1 
and C X2 from 1, so my comorbidity score has marginally better discrimination 
than the Charlson score (C = 0.605 vs. 0.599). Question: Is it true that my 
score is more discriminative than the Charlson score in 53% of patient pairs?
 
I have done the same analysis with 'method = 2', i.e. 
 rcorrp.cens(myscore.lp, charlson.lp, Surv(time, dead), method=2): 


x1 = My comorbidity score, x2 = Charlson 
   [,1]
Dxy-0.006002
S.D.   0.001102
x1 more concordant 0.04018
x2 more concordant 0.04618
n  1.369e+04
missing0
uncensored 9411
Relevant Pairs 1.587e+08
Uncertain  2.861e+07
C X1   0.395
C X2   0.401
Dxy X1 -0.21
Dxy X2 -0.198

 
Question: How do I interpret the 'x1/x2 more concordant' numbers in a Cox 
regression setting? My guess: My comorbidity score concordant in 4.6% of pairs 
in which Charlson's score is not. And Charlson's score is concordant in 4.0% of 
pairs in which my comorbidity score is not.
 
Thank you in advance for your insight and help. 

Best regards, 
Peter Jepsen 
Aarhus, Denmark

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


Re: [R] Appending many different and separate Excel files using R

2012-08-17 Thread R. Michael Weylandt michael.weyla...@gmail.com


On Aug 17, 2012, at 4:19 PM, Amir Kasaeian amir_kasae...@yahoo.com wrote:

 Dear all, 
 Good day! 
 I have a problem in reading Excel files in R and appending them to each 
 other. Suppose we have several Excel files in a directory with headers and 
 want to use R to append them in a single file with an additional variable in 
 the final file indicating from which files the data come from. 
 As I have many Excel files and their sizes are very big I should write a loop 
 in R to do the work. 
 I will be very happy if you guide and help me to write the codes. 
 Thank you very much in advance. 
 

Given the overhead of most R/Excel interfaces, I think you might want to look 
into doing this within Excel only using some basic VBA. 

That said,

do.call(rbind, lapply(dir(pattern = xls), function(n) read.xls(n)))

should get you started. You can find read.xls in either the gdata or or 
xlsReadWrite packages. For more advanced control, look at the XLConnect 
package, which is, unfortunately, not currently available on OS X.

Cheers,
Michael


 Kind regards, 
 Amir Kasaeian
 
 
 
 
 Amir Kasaeian, 
 PhD Student in Biostatistics,
 Dept. of Epidemiology and Biostatistics,
 School of Public Health,
 Tehran University of Medical Sciences (TUMS).
 P.B. : 14155-6446
 Cell Phone: +98-912-2063511
 E-mail: akasae...@razi.tums.ac.ir
 ��� amir_kasae...@yahoo.com�� 
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Opinion: Why I find factors convenient to use

2012-08-17 Thread Rui Barradas

Hello,

Em 17-08-2012 20:27, Bert Gunter escreveu:

... so it may be just the way object.size() counts in the two cases, right?


Or maybe the way character vectors and factors are coded.
(64 bit Windows 7 or ubuntu 12.04) 80k for the character vector seems to 
be 8 * 1e4 for pointers plus room for the strings themselves, and 40k 
for the factor seems more like 32 bit ints * 1e4 in consecutive memory 
locations. I confess to being too lazy to go check the sources, but if 
this is the case then it's an other point to factors, they are indeed 
more efficient memory-wise.
And 64 bit OSs are to become more and more used, processors aren't 
becoming worse.


There is also the statistical side of it. Factors are the natural way of 
coding nominal or categorical variables. The small/medium/large example 
is a good one. Or seasons, we like to see Fall or Autumn after Spring 
and Summer, not before. (btw, does anyone know why M/F?) And this has 
nothing to do with the usefullness of charaters, I like persons' names 
to be names, alphabetic.


I've also made a simple check, apparently, character vectors are kept as 
a vector of pointers and a vector of unique strings. If we change one of 
the strings, even for something smaller, occupying less bytes, 
object.size will report an increase in size. Try x[1] - a and see the 
new size of x. It's bigger and the number of pointers to strings is the 
same.


For 32 and 64 bit Windows 7 and for 64 bit ubuntu 12.04, R was:
 R.version
[...]
version.string R version 2.15.1 (2012-06-22)
nickname   Roasted Marshmallows

Rui Barradas


-- Bert

On Fri, Aug 17, 2012 at 11:42 AM, Peter Langfelder
peter.langfel...@gmail.com wrote:

On Fri, Aug 17, 2012 at 11:34 AM, Rui Barradas ruipbarra...@sapo.pt wrote:

Hello,

No, factors may use less memory. System dependent?

I think it's a 32-bit vs. 64-bit distinction - I get Rui's results on
64-bit Windows and Linux installation, but Bert's result on a 32-bit
Linux machine.

Peter


x -sample(c(small,medium,large),1e4,rep=TRUE)
y - factor(x)
object.size(x)

80184 bytes

object.size(y)

40576 bytes





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


[R] R utilizing 25% of CPU for Dual core i3 370M processor

2012-08-17 Thread Shantanu MULLICK
Hello Everyone

I have a dual-core Intel i3-370M processor and Windows 64 operating system.
I have a 3GB RAM and my processor can support a maximum of 8GB RAM.

I have virtual memory enabled on my computer.

I am running a program in the 64 bit R which implements a MCMC on a large
dataset and involves around 8 iterations.

The processor estimates that it will take around 1000 minutes to complete
running the program.

However when I check the CPU usage it shows only 25% usage.

I have read on threads that R runs on only 1 core - and thus was expecting
a CPU usage of around 50%.

It would be great if anyone can point out a way by which I can make the
processor use 50% of the CPU which I believe would allow the program to be
run quicker.

Best
Shantanu

[[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] Get the filename from the given path

2012-08-17 Thread William Dunlap
Yes, basename(filepath) assumes that filepath represents
path to a file on the OS that R is running on.  Hence, on
Windows we get
   basename(dir\\path)
  [1] path
   basename(dir/path)
  [1] path
because both / and \ are valid separators (and invalid in file names)

Linux allows \ in a file name so we get
   basename(dir\\file)
  [1] dir\\file
   basename(dir/file)
  [1] file

The same goes for dirname():
  Windows dirname(c:/file) # c: is not  a directory but c:/ is
  [1] c:/
  Linux dirname(c:/file)
  [1] c:
 
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: arun [mailto:smartpink...@yahoo.com]
 Sent: Friday, August 17, 2012 1:20 PM
 To: William Dunlap
 Cc: Rantony; R help
 Subject: Re: [R] Get the filename from the given path
 
 
 
 Hi,
 
 I guess basename() output depends on the system.
  basename(getwd())
 #[1] BehaviorStudy
 
 So, if I wanted to get the filename from the FPPath, I have to replace \\ 
 to //.
 FPath - D:\\MyFolder\\MyFile.txt
  basename(FPath)
 #[1] D:\\MyFolder\\MyFile.txt
  FPath1-D://MyFolder//MyFile.txt
  basename(FPath1)
 #[1] MyFile.txt
 gsub(.*.*(.*),\\1,FPath)
 #[1] MyFile.txt
  gsub(.*\\//.*\\//(.*),\\1,FPath1)
 #[1] MyFile.txt
 A.K.
 
 
 
 
 - Original Message -
 From: William Dunlap wdun...@tibco.com
 To: Rantony antony.akk...@ge.com; r-help@r-project.org 
 r-help@r-project.org
 Cc:
 Sent: Friday, August 17, 2012 11:41 AM
 Subject: Re: [R] Get the filename from the given path
 
 Q.
  Here i have a file path, for eg : - FPath - D:\\MyFolder\\MyFile.txt
  HOW IS POSSIBLE TO GET THE FILE NAME FROM THIS GIVEN PATH ?
 A.
  x - substr(FPath,13,nchar(FPath)) should give you the desired output.
 
 But this is much like saying
    x - MyFile.txt
 will give you the desired output - where did the 13 come from?
 
 Use basename() for a general solution.
    basename(FPath)
   [1] MyFile.txt
 dirname(FPath) gives you the directory that FPath is in in.
 
 (To other responders, those who don't know that all caps means shouting
 probably don't know that the answer '?basename' means to type that into
 R to look at the help file for the basename function.)
 
 Bill Dunlap
 Spotfire, TIBCO Software
 wdunlap tibco.com
 
 
  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
  Behalf
  Of Rantony
  Sent: Friday, August 17, 2012 4:56 AM
  To: r-help@r-project.org
  Subject: Re: [R] Get the filename from the given path
 
  Thanks pramod.
 
 
 
  From: Pramod [via R] [mailto:ml-node+s789695n4640600...@n4.nabble.com]
  Sent: Friday, August 17, 2012 5:24 PM
  To: Akkara, Antony (GE Energy, Non-GE)
  Subject: Re: Get the filename from the given path
 
 
 
  x - substr(FPath,13,nchar(FPath)) should give you the desired output.
 
  
 
  If you reply to this email, your message will be added to the discussion
  below:
 
  http://r.789695.n4.nabble.com/Get-the-filename-from-the-given-path-tp464
  0578p4640600.html
 
  To unsubscribe from Get the filename from the given path, click here
  http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscrib
 
 e_by_codenode=4640578code=YW50b255LmFra2FyYUBnZS5jb218NDY0MDU3OHwx
  NTUx
  OTQzMDI5 .
  NAML
  http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_view
  erid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.Bas
  icNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.tem
  plate.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml
  -instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemai
  l.naml
 
 
 
 
 
  --
  View this message in context: 
  http://r.789695.n4.nabble.com/Get-the-filename-from-
  the-given-path-tp4640578p4640601.html
  Sent from the R help mailing list archive at Nabble.com.
      [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] R utilizing 25% of CPU for Dual core i3 370M processor

2012-08-17 Thread Joshua Wiley
You probably have hyper threading so even though you only have two
physical cores, there are 4 logical cores, hence 25%.  Google can lead
you to how to adjust this, if possible.

Cheers,

Josh

On Fri, Aug 17, 2012 at 2:41 PM, Shantanu MULLICK b00295...@essec.edu wrote:
 Hello Everyone

 I have a dual-core Intel i3-370M processor and Windows 64 operating system.
 I have a 3GB RAM and my processor can support a maximum of 8GB RAM.

 I have virtual memory enabled on my computer.

 I am running a program in the 64 bit R which implements a MCMC on a large
 dataset and involves around 8 iterations.

 The processor estimates that it will take around 1000 minutes to complete
 running the program.

 However when I check the CPU usage it shows only 25% usage.

 I have read on threads that R runs on only 1 core - and thus was expecting
 a CPU usage of around 50%.

 It would be great if anyone can point out a way by which I can make the
 processor use 50% of the CPU which I believe would allow the program to be
 run quicker.

 Best
 Shantanu

 [[alternative HTML version deleted]]

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



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/

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


[R] Making data in R available to Rcmdr

2012-08-17 Thread ToddE
I'm an R newbie.  I'm trying to use Rcmdr to make a 3-D scatterplot of data
from a two-independent-variable regression and of the regression plane.

The object dat in R contains the data:
 print(dat[1:20,])
 y x1 x2
1   431.69  76.40 132.80

Rcmdr knows about dat.  If I click Data, New data set, and enter the name
dat, Rcmdr won't let me use that name.  I get this message: Data set dat
already exists. Overwrite data set?

However, I don't know how to make dat the active data set in Rcmdr.  Is that
possible?

Sorry if this is too basic.  Can't find an answer in Getting Started With
the R Commander or on this list.

Todd





--
View this message in context: 
http://r.789695.n4.nabble.com/Making-data-in-R-available-to-Rcmdr-tp4640672.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] Appending many different and separate Excel files using R

2012-08-17 Thread Rui Barradas
Hello,

You need to provide us with a bit more information:
Do all the files have the same structure, i.e., tables with the same 
columns? Are they xls, xlsx or csv files? Do their names share something 
in common such as a preffix or are they alone in the directory, or...? 
When you  write in the final file does this mean that you want to 
output two files, one with the data and the other with the filenames?

It would be nice if (a) the files were csv files, (b) if you answer to 
some or all of the rest, (c) anything that I might have forgotten and 
you find usefull.

Rui Barradas

Em 17-08-2012 22:19, Amir Kasaeian escreveu:
 Dear all,
 Good day!
 I have a problem in reading Excel files in R and appending them to each 
 other. Suppose we have several Excel files in a directory with headers and 
 want to use R to append them in a single file with an additional variable in 
 the final file indicating from which files the data come from.
 As I have many Excel files and their sizes are very big I should write a loop 
 in R to do the work.
 I will be very happy if you guide and help me to write the codes.
 Thank you very much in advance.

 Kind regards,
 Amir Kasaeian




 Amir Kasaeian,
 PhD Student in Biostatistics,
 Dept. of Epidemiology and Biostatistics,
 School of Public Health,
 Tehran University of Medical Sciences (TUMS).
 P.B. : 14155-6446
 Cell Phone: +98-912-2063511
 E-mail: akasae...@razi.tums.ac.ir
  amir_kasae...@yahoo.com

   [[alternative HTML version deleted]]



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


[[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] Making data in R available to Rcmdr

2012-08-17 Thread John Fox
Dear Todd,

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of ToddE
 Sent: Friday, August 17, 2012 5:57 PM
 To: r-help@r-project.org
 Subject: [R] Making data in R available to Rcmdr
 
 I'm an R newbie.  I'm trying to use Rcmdr to make a 3-D scatterplot of
 data from a two-independent-variable regression and of the regression
 plane.
 
 The object dat in R contains the data:
  print(dat[1:20,])
  y x1 x2
 1   431.69  76.40 132.80
 
 Rcmdr knows about dat.  If I click Data, New data set, and enter the
 name dat, Rcmdr won't let me use that name.  I get this message: Data
 set dat already exists. Overwrite data set?
 
 However, I don't know how to make dat the active data set in Rcmdr.  Is
 that possible?
 

Data - New data set allows you to enter a new data set in the R data
editor; it doesn't give you access to a data set that's currently in memory.
Assuming that dat is a data frame (and that it really has more than just one
line), you can access it either via Data - Active data set - Select
active data set, or by clicking the No active dataset button in the Rcmdr
toolbar.

I hope this helps,
 John

---
John Fox
Senator McMaster Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada


 Sorry if this is too basic.  Can't find an answer in Getting Started
 With the R Commander or on this list.
 
 Todd
 
 
 
 
 
 --
 View this message in context: http://r.789695.n4.nabble.com/Making-data-
 in-R-available-to-Rcmdr-tp4640672.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] Row means of matrix.

2012-08-17 Thread Yingwei Lee
 Hi all,
  I'm just having trouble getting row means of a matrix which
contain zero.
For example.

m=matrix(c(1:4, c(0, 0, 0, 0), c(1, 0, 1, 1)), nc=4, byrow=TRUE)

I want to be able to calculate means for non-zero elements for each row.

## what i have is this
apply((m[apply(m != 0, MARGIN=1, any),]), 1, mean)
## which returns
[1]  2.50  0.75

### what i want to get returned is this
[1] 2.50  *1

*meaning that the last row calculated the mean ignoring the zero. Anyone
got any ideas?

[[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] specific matrix element tranformation

2012-08-17 Thread bantex
Thanks David. I have actually 1 more question. How do I assign a name to the
output created by this function?

Cheers,
B



--
View this message in context: 
http://r.789695.n4.nabble.com/specific-matrix-element-tranformation-tp4640550p4640680.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] Row means of matrix.

2012-08-17 Thread David Winsemius


On Aug 17, 2012, at 8:28 PM, Yingwei Lee wrote:


m=matrix(c(1:4, c(0, 0, 0, 0), c(1, 0, 1, 1)), nc=4, byrow=TRUE)


is.na(m) - m==0
rowMeans(m, na.rm=T)
#[1] 2.5 NaN 1.0

--
David Winsemius, MD
Alameda, CA, USA

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


Re: [R] no true negative data, need roc curve

2012-08-17 Thread vjyns
This is not a typo error, in feature detection when it was not able to
calculate 'tn' then they are using this formula and there are more papers
(referred journal) which quote same formula. In the same manner i had also
got the tp, fp and fn. Based on it can some one suggest me to plot the ROC
curve for  all the 6 data.

http://r.789695.n4.nabble.com/file/n4640683/tpr2.jpg 



--
View this message in context: 
http://r.789695.n4.nabble.com/no-true-negative-data-need-roc-curve-tp4640474p4640683.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.