[R] help needed

2008-11-23 Thread gauravbhatti

hi I have a matrix (10x10) and I have to perform t tests on each row by
considering first 5 elements as data set A and next 5 as data set B. This
part is easy, However after one t test on each row, I have to randomly
permute each column to get new values for each row and then perform another
t.test. I can permute the column randomly using the function sample(x) but i
am having problem in fitting this into the matrix to perform t test on the
row. I would appreciate if someone can help me with this. 
Or is there a function to randomly get different  matrix from one original
matrix  without having to deal with different columns?
-- 
View this message in context: 
http://www.nabble.com/help-needed-tp20648304p20648304.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 needed

2008-12-05 Thread gauravbhatti

 I need some help in comparing t values avalaible from two data frames. I
have two data frames with each containing a column for t valuse
For example one data frame looks like as follows
  IDlogFCt   P.Value  adj.P.Val
B
39   a39 -1.737037118 -2.861784118 0.004212637 0.3120295 -2.504407
1 a1 -1.66000 -2.734864780 0.006240591 0.3120295 -2.729203
53   a53  1.443725119  2.378549988 0.017380880 0.4517324 -3.305806
52   a52 -1.323602459 -2.180646836 0.029209548 0.4517324 -3.591351
14   a14 -1.288769209 -2.123258747 0.033732176 0.4517324 -3.669516
58   a58  1.286212422  2.119046418 0.034086544 0.4517324 -3.675172
75   a75 -1.268523811 -2.089904273 0.036626400 0.4517324 -3.713989

I have another one like it but the order of the ID column is different as
shown below
  IDlogFCt   P.Value  adj.P.Val
B
76   a1   0.157096693 -0.258818201 0.795775514 0.9146845 -5.075035
63   a53 -0.146205781 -0.240875326 0.809651746 0.9200588 -5.077872
88   a58  0.108707988  0.179097379 0.857861240 0.9638890 -5.086083
23   a52 -0.086871304 -0.143121247 0.886194425 0.9757266 -5.089752
98   a53  0.085552023  0.140947720 0.887911243 0.9757266 -5.089947
90   a14  0.068456451  0.112782613 0.910202903 0.9868965 -5.092209
91   a75 -0.052087970 -0.085815394 0.931613169 0.9868965 -5.093904

I have to plot the t values  obtained for each id against each other. Since
the order of the IDs in the two data frames is different , I am finding it
difficult to plot the t values. Can anyone help in arranging the t values in
the increasing order of the ID values like 
1 a1 ..
2 a2 ..
2 a3 .. 
Thank you
-- 
View this message in context: 
http://www.nabble.com/help-needed-tp20849087p20849087.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 Needed

2009-06-04 Thread Angshuman Bagchi
HI,
I am Angshuman a postdoc in Buck Institute, Novato, CA. I am using random 
forest in R. I have a problem.  I have a training file and a test file. I need 
to generate model file to classify a set of data of the test file. I need to 
know the command for that. Please let me know. 
Thank you.
Angshuman

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

2008-05-13 Thread TEBBI FATIMA
HI
  I have a data to test its normality and simulate after how with R.
  thanks in advance 

 __



[[alternative HTML version deleted]]

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


[R] R help needed

2008-05-20 Thread Kamlesh Kumar
Dear Sir/Madam,
 I have tried to upload data in R but it showing some error
  in command window. It's should be noted that I am using Mac version of
  R. I am using Mac-text for writing my data. I am getting following
  message on the command window.

  > source("/Users/kamleshkumar/Desktop/DS1.txt")
  Error in source("/Users/kamleshkumar/Desktop/DS1.txt") :
/Users/kamleshkumar/Desktop/DS1.txt: unexpected symbol at
  1: x y
I am attaching the the DS1.txt file also with this mail.
  Please go through it and guide me about this. I am waiting for a reply
  from your side. Thanking you.
  Yours Sincerely,
  Kamlesh Kumar


-- 
Kamlesh kumar
QEM1, Universität Bielefeld
Appt. No.- 313A,
29, Morganbreede,
33615 Bielefeld,
Germany.
x y
 0.43678295 -3.28526227
 0.13718621 -4.92480568
 0.17818460 -4.05188084
 0.16101891 -4.67132656
 0.07748958 -4.57308386
 0.07665154 -4.65652237
 0.93462605 -2.43577939
 0.08393081 -4.77342552
 0.21957806 -4.30777061
 0.72091525 -2.40654408
 0.78820620 -2.48382294
 0.03020949 -5.13427708
 0.68054097 -3.29446962
 0.30986188 -4.27261703
 0.95362188 -1.95420377
 0.55720882 -2.97490588
 0.43290669 -3.89988872
 0.70655859 -2.80856040
 0.27899269 -4.53354360
 0.86257070 -2.01097646
 0.05536443 -5.25322277
 0.63851330 -3.29444349
 0.61166177 -3.16909365
 0.53661890 -3.47439468
 0.04897602 -4.94514890
 0.40846848 -3.55536513
 0.48529544 -3.33571965
 0.62426309 -3.15729236
 0.51640396 -3.52697121
 0.48633149 -3.48081848
 0.56278950 -3.21171279
 0.84846483 -2.84878605
 0.78607647 -2.49938705
 0.08552248 -4.66611865
 0.27222455 -3.68753951
 0.52786212 -3.18143578
 0.42516159 -3.52162673
 0.79234991 -2.31155140
 0.84189899 -2.45189562
 0.23900177 -4.47138986
 0.91564840 -2.09537746
 0.67030122 -2.52637849
 0.94819300 -1.98333241
 0.18291447 -4.89865053
 0.52996478 -3.87409080
 0.50593282 -3.79463028
 0.73293227 -2.53096580
 0.47889233 -3.83944563
 0.10962530 -5.09931633
 0.28968145 -3.91778725
 0.51736481 -4.18277038
 0.51200367 -3.47252783
 0.69443868 -2.93954049
 0.85456938 -2.66937293
 0.85227096 -2.00744394
 0.39924035 -3.81892375
 0.76328850 -2.97426388
 0.26705593 -4.64157081
 0.78798635 -2.52137869
 0.08613956 -4.91270415
 0.50749160 -3.41245218
 0.88808879 -2.31015263
 0.93046255 -1.91780699
 0.61369620 -3.20740210
 0.62948767 -3.12272095
 0.14147349 -4.09641126
 0.46920070 -3.66767757
 0.35005896 -3.78436370
 0.55357248 -3.22255576
 0.04723303 -4.60194879
 0.52039850 -3.51374627
 0.06786648 -5.10241809
 0.98168950 -1.97958974
 0.01757815 -5.06735833
 0.36243887 -3.84462984
 0.42420613 -3.13386319
 0.22285663 -4.71020127
 0.08062803 -4.36007637
 0.36207742 -4.06609100
 0.13193842 -5.10268694
 0.69752291 -3.03723431
 0.22458552 -3.76104542
 0.76745054 -2.51812578
 0.58135253 -2.69485523
 0.90282985 -2.11135506
 0.96344637 -2.13711582
 0.74533493 -3.14761947
 0.41475951 -4.37647029
 0.80989250 -2.44450728
 0.18761541 -4.28119680
 0.86392396 -2.75540153
 0.86466167 -2.45686213
 0.03874840 -4.62795990
 0.70687607 -2.89780500
 0.36910319 -4.2300
 0.04626376 -5.21006098
 0.32207711 -4.36650935
 0.18580701 -5.27752600
 0.65028098 -3.37388899
 0.66456437 -3.07719445
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help needed

2008-11-23 Thread stephen sefick
would you post reproducible code with dummy data so that we have
something to start with.
thanks

On Sun, Nov 23, 2008 at 12:08 PM, gauravbhatti <[EMAIL PROTECTED]> wrote:
>
> hi I have a matrix (10x10) and I have to perform t tests on each row by
> considering first 5 elements as data set A and next 5 as data set B. This
> part is easy, However after one t test on each row, I have to randomly
> permute each column to get new values for each row and then perform another
> t.test. I can permute the column randomly using the function sample(x) but i
> am having problem in fitting this into the matrix to perform t test on the
> row. I would appreciate if someone can help me with this.
> Or is there a function to randomly get different  matrix from one original
> matrix  without having to deal with different columns?
> --
> View this message in context: 
> http://www.nabble.com/help-needed-tp20648304p20648304.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.
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

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


Re: [R] help needed

2008-11-23 Thread gauravbhatti

Thankyou for the quick reply 
p <- array( 0, dim =c(5,100))  
porig <- array( 0, dim =c(5,1))
x1 <- array( rnorm(990,mean=0,sd=1), dim =c(4,10)) 

x <- rbind(c(1,1.5,1.4,3,1.9,4,4.9,2.6,3.2,2.4),x1)
i = 1; j=1;
for ( i in (1:5) )
{
 xorig1 = x[1,(1:5)];
 xorig2 = x[1,(6:10)];
 yorig = t.test(x1,x2,var.equal=TRUE);
 porig[i,1] = yo[[1]];
 for ( j in (1:100))
 {
  z = array( sample(x), dim =c(5,10))
 x1 = z[1,(1:5)];
 x2 = z[1,(6:10)];
 y = t.test(x1,x2,var.equal=TRUE);
 p[i,j] = y[[1]];
 
 j = j + 1;
 }
 i = i + 1;

}

This is the code i have been able to write so far. In this case i calculate
the t values for each row initiallay and then store it in porg matrix.In
order to randomize the matrix, I use sample(x) where x is the vector
containing all elements of the matrix. I create a new matrix of same
dimensions with the ranmdomized data and then perform t tests on each row
and store t values in p. this is done 100 times.
Please comment if you think there is better way.


gauravbhatti wrote:
> 
> hi I have a matrix (10x10) and I have to perform t tests on each row by
> considering first 5 elements as data set A and next 5 as data set B. This
> part is easy, However after one t test on each row, I have to randomly
> permute each column to get new values for each row and then perform
> another t.test. I can permute the column randomly using the function
> sample(x) but i am having problem in fitting this into the matrix to
> perform t test on the row. I would appreciate if someone can help me with
> this. 
> Or is there a function to randomly get different  matrix from one original
> matrix  without having to deal with different columns?
> 

-- 
View this message in context: 
http://www.nabble.com/help-needed-tp20648304p20649213.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] help needed

2008-11-23 Thread stephen sefick
 p <- array( 0, dim =c(5,100))
porig <- array( 0, dim =c(5,1))
x1 <- array( rnorm(990,mean=0,sd=1), dim =c(4,10))
x <- rbind(c(1,1.5,1.4,3,1.9,4,4.9,2.6,3.2,2.4),x1)

#this randomizes each column
apply(x, MARGIN=2, FUN=sample)

I will try and think about it more, but I am not a great programer.
What is it exactly that you want to do?

On Sun, Nov 23, 2008 at 1:31 PM, gauravbhatti <[EMAIL PROTECTED]> wrote:
>
> Thankyou for the quick reply
> p <- array( 0, dim =c(5,100))
> porig <- array( 0, dim =c(5,1))
> x1 <- array( rnorm(990,mean=0,sd=1), dim =c(4,10))
>
> x <- rbind(c(1,1.5,1.4,3,1.9,4,4.9,2.6,3.2,2.4),x1)
> i = 1; j=1;
> for ( i in (1:5) )
> {
>  xorig1 = x[1,(1:5)];
>  xorig2 = x[1,(6:10)];
>  yorig = t.test(x1,x2,var.equal=TRUE);
>  porig[i,1] = yo[[1]];
>  for ( j in (1:100))
>  {
>  z = array( sample(x), dim =c(5,10))
>  x1 = z[1,(1:5)];
>  x2 = z[1,(6:10)];
>  y = t.test(x1,x2,var.equal=TRUE);
>  p[i,j] = y[[1]];
>
>  j = j + 1;
>  }
>  i = i + 1;
>
> }
>
> This is the code i have been able to write so far. In this case i calculate
> the t values for each row initiallay and then store it in porg matrix.In
> order to randomize the matrix, I use sample(x) where x is the vector
> containing all elements of the matrix. I create a new matrix of same
> dimensions with the ranmdomized data and then perform t tests on each row
> and store t values in p. this is done 100 times.
> Please comment if you think there is better way.
>
>
> gauravbhatti wrote:
>>
>> hi I have a matrix (10x10) and I have to perform t tests on each row by
>> considering first 5 elements as data set A and next 5 as data set B. This
>> part is easy, However after one t test on each row, I have to randomly
>> permute each column to get new values for each row and then perform
>> another t.test. I can permute the column randomly using the function
>> sample(x) but i am having problem in fitting this into the matrix to
>> perform t test on the row. I would appreciate if someone can help me with
>> this.
>> Or is there a function to randomly get different  matrix from one original
>> matrix  without having to deal with different columns?
>>
>
> --
> View this message in context: 
> http://www.nabble.com/help-needed-tp20648304p20649213.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.
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

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


Re: [R] help needed

2008-12-05 Thread Jim Lemon

gauravbhatti wrote:

...
I have to plot the t values  obtained for each id against each other. Since
the order of the IDs in the two data frames is different , I am finding it
difficult to plot the t values. Can anyone help in arranging the t values in
the increasing order of the ID values like 
1 a1 ..

2 a2 ..
2 a3 .. 
  


Hi gauravbhatti,
Try this (assuming your data frame is named "gvb"):

gvb[order(as.character(gvb[,1])),]

Jim

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


[R] help needed with rbftrain

2008-05-10 Thread Invernomuto

Hello everybody,

I'm new to R. I'm trying to set up a Rbf network using the rbftrain function
but I get an error I can't understand.

this is what I type:

rbftrain(input,3,output,visual=F)

where input is a matrix with 198 rows and 6 columns and output is a matrix
with 198 rows and one column. Both matrices are missing values free. This is
what I get from R:

Error in kmeans(inp[, i], neurons) : 
  more cluster centers than distinct data points.

I don't understand this. Moreover, I can actually train a rbf network with 2
neurons but not with 3 neurons. I'm sure I have far more than 3 distinct
data point both in "input" and in "output" so I don't get the meaning.

Can you please help me? Thank you so much everybody.

Invernomuto
-- 
View this message in context: 
http://www.nabble.com/help-needed-with-rbftrain-tp17161948p17161948.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] R help needed

2008-05-21 Thread Simon Blomberg
Try:

dat <- read.table("/Users/kamleshkumar/Desktop/DS1.txt", header=TRUE)

Please also read the F documentation. The use of read.table is in "An
Introduction to R" for example.

Simon.

On Wed, 2008-05-21 at 08:13 +0200, Kamlesh Kumar wrote:
> Dear Sir/Madam,
>  I have tried to upload data in R but it showing some error
>   in command window. It's should be noted that I am using Mac version of
>   R. I am using Mac-text for writing my data. I am getting following
>   message on the command window.
> 
>   > source("/Users/kamleshkumar/Desktop/DS1.txt")
>   Error in source("/Users/kamleshkumar/Desktop/DS1.txt") :
> /Users/kamleshkumar/Desktop/DS1.txt: unexpected symbol at
>   1: x y
> I am attaching the the DS1.txt file also with this mail.
>   Please go through it and guide me about this. I am waiting for a reply
>   from your side. Thanking you.
>   Yours Sincerely,
>   Kamlesh Kumar
> 
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
Simon Blomberg, BSc (Hons), PhD, MAppStat. 
Lecturer and Consultant Statistician 
Faculty of Biological and Chemical Sciences 
The University of Queensland 
St. Lucia Queensland 4072 
Australia
Room 320 Goddard Building (8)
T: +61 7 3365 2506
http://www.uq.edu.au/~uqsblomb
email: S.Blomberg1_at_uq.edu.au

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

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

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

2008-03-01 Thread AbouEl-Makarim Aboueissa
Dear ALL:

I have two quick questions about how to perform some steps in R. Could you 
please see the attached MS file if the data not clean enough in this email.

Thank you so much for all your helps.


Abou



Here it is:
=

Consider the following matrix:

data<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
  4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
  
0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2)


  [,1] [,2]
 [1,]20
 [2,]20
 [3,]   120
 [4,]20
 [5,]10
 [6,]   101
 [7,]   101
 [8,]40
 [9,]   101
[10,]11
[11,]10
[12,]21
[13,]21
[14,]10
[15,]20
[16,]   101
[17,]30
[18,]11
[19,]10
[20,]10
[21,]30
[22,]51
[23,]   170
[24,]   230
[25,]90
[26,]90
[27,]30
[28,]30
[29,]   151
[30,]51
[31,]40
[32,]51
[33,]51
[34,]51
[35,]40
[36,]80
[37,]10
[38,]   150
[39,]30
[40,]30
[41,]10
[42,]60
[43,]30
[44,]60
[45,]30
[46,]40
[47,]50
[48,]   140
[49,]40





Q1. Column one is the data set, and column two is an indicator of 1 and 0. Some 
values 
 in column one corresponding to indicator 1 in column two are 
different, and some 
 are the same. There are 5 different groups of values in column one 
with indicator 1 
 in column two.

(a) How I can choose only one value (only one observation) from each of these 
groups to 
 develop a vector of length 5 as: (1   25   10  15).




(b) How I can find number of observations in each of these groups as a vector 
as: 
(2 254   1).











These are the values with indicator 1.

[,1] [,2]
 [1,]11
 [2,]11
 [3,]21
 [4,]21
 [5,]51
 [6,]51
 [7,]51
 [8,]51
 [9,]51
[10,]   101
[11,]   101
[12,]   101
[13,]   101
[14,]   151

=





==
AbouEl-Makarim Aboueissa, Ph.D.
Assistant Professor of Statistics
Department of Mathematics & Statistics
University of Southern Maine
96 Falmouth Street
P.O. Box 9300
Portland, ME 04104-9300

Tel: (207) 228-8389
Fax: (207) 780-5607
Email: [EMAIL PROTECTED]
  [EMAIL PROTECTED]
Office: 301C Payson Smith


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

2008-03-03 Thread AbouEl-Makarim Aboueissa
Dear ALL:


How I can find the number of observations less than each value in column one 
with indicator 1 in column two. Please see the data below.


For example: number of observations less than 1 with indicator 1 (including 
those 1 with indicator 1) =2
number of observations less than 2 with indicator 1 
(including those 2 with indicator 1) =11
number of observations less than 5 with indicator 1 
(including those 5 with indicator 1) =33
number of observations less than 10 with indicator 1 
(including those 10 with indicator 1) =43
number of observations less than 15 with indicator 1 
(including those 15 with indicator 1) =46

(1, 2,5,10,15) are the values in column one with indicator 1 in column two.


which means I need to create a vector(2,11,33,43,46) for the data in column one.

With many thanks.

Abou

Here is the data:
===

Consider the following matrix:

data<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
  4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
  
0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2)


  [,1] [,2]
 [1,]20
 [2,]20
 [3,]   120
 [4,]20
 [5,]10
 [6,]   101
 [7,]   101
 [8,]40
 [9,]   101
[10,]11
[11,]10
[12,]21
[13,]21
[14,]10
[15,]20
[16,]   101
[17,]30
[18,]11
[19,]10
[20,]10
[21,]30
[22,]51
[23,]   170
[24,]   230
[25,]90
[26,]90
[27,]30
[28,]30
[29,]   151
[30,]51
[31,]40
[32,]51
[33,]51
[34,]51
[35,]40
[36,]80
[37,]10
[38,]   150
[39,]30
[40,]30
[41,]10
[42,]60
[43,]30
[44,]60
[45,]30
[46,]40
[47,]50
[48,]   140
[49,]40




==
AbouEl-Makarim Aboueissa, Ph.D.
Assistant Professor of Statistics
Department of Mathematics & Statistics
University of Southern Maine
96 Falmouth Street
P.O. Box 9300
Portland, ME 04104-9300

Tel: (207) 228-8389
Fax: (207) 780-5607
Email: [EMAIL PROTECTED]
  [EMAIL PROTECTED]
Office: 301C Payson Smith

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

2008-01-29 Thread Megh Dal
Hi all T gurus,
   
  I would like to test if my dataset is indeed from N(0, 0.011908969).
   
  K.S. test gives following result:
   
  > ks.test(data, "pnorm", 0, 0.011908969)
  One-sample Kolmogorov-Smirnov test
  data:  data 
D = 0.1092, p-value = 1.318e-05
alternative hypothesis: two-sided 

  How ever "Shapiro-Wilk" test give following :
  > shapiro.test(data)
  Shapiro-Wilk normality test
  data:  data 
W = 0.9946, p-value = 0.07562

  also, 
   
  > sd(data)
[1] 0.01625074

  2nd test saying data is from normal however 1st isnot. Which one is correct? 
Am I missing something?
   
  Regards,

   
-

[[alternative HTML version deleted]]

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


Re: [R] Help needed in R

2008-03-01 Thread Henrique Dallazuanna
Try this:

data <- as.data.frame(data)
names(data) <- c('Data', 'Indicator')

a)
sort(unique(subset(data, Indicator == 1))[,1])

b)  with(subset(data, Indicator == 1),
  tapply(Indicator, Data, sum))



On 01/03/2008, AbouEl-Makarim Aboueissa <[EMAIL PROTECTED]> wrote:
> Dear ALL:
>
> I have two quick questions about how to perform some steps in R. Could you
> please see the attached MS file if the data not clean enough in this email.
>
> Thank you so much for all your helps.
>
>
> Abou
>
>
>
> Here it is:
> =
>
> Consider the following matrix:
>
> data<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
> 4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
> 
> 0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,
> 0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2)
>
>
>   [,1] [,2]
>  [1,]20
>  [2,]20
>  [3,]   120
>  [4,]20
>  [5,]10
>  [6,]   101
>  [7,]   101
>  [8,]40
>  [9,]   101
> [10,]11
> [11,]10
> [12,]21
> [13,]21
> [14,]10
> [15,]20
> [16,]   101
> [17,]30
> [18,]11
> [19,]10
> [20,]10
> [21,]30
> [22,]51
> [23,]   170
> [24,]   230
> [25,]90
> [26,]90
> [27,]30
> [28,]30
> [29,]   151
> [30,]51
> [31,]40
> [32,]51
> [33,]51
> [34,]51
> [35,]40
> [36,]80
> [37,]10
> [38,]   150
> [39,]30
> [40,]30
> [41,]10
> [42,]60
> [43,]30
> [44,]60
> [45,]30
> [46,]40
> [47,]50
> [48,]   140
> [49,]40
>
>
>
>
>
> Q1. Column one is the data set, and column two is an indicator of 1 and 0.
> Some values
>  in column one corresponding to indicator 1 in column two are
> different, and some
>  are the same. There are 5 different groups of values in column one
> with indicator 1
>  in column two.
>
> (a) How I can choose only one value (only one observation) from each of
> these groups to
>  develop a vector of length 5 as: (1   25   10  15).
>
>
>
>
> (b) How I can find number of observations in each of these groups as a
> vector as:
> (2 254   1).
>
>
>
>
>
>
>
>
>
>
>
> These are the values with indicator 1.
>
> [,1] [,2]
>  [1,]11
>  [2,]11
>  [3,]21
>  [4,]21
>  [5,]51
>  [6,]51
>  [7,]51
>  [8,]51
>  [9,]51
> [10,]   101
> [11,]   101
> [12,]   101
> [13,]   101
> [14,]   151
>
> =
>
>
>
>
>
> ==
> AbouEl-Makarim Aboueissa, Ph.D.
> Assistant Professor of Statistics
> Department of Mathematics & Statistics
> University of Southern Maine
> 96 Falmouth Street
> P.O. Box 9300
> Portland, ME 04104-9300
>
> Tel: (207) 228-8389
> Fax: (207) 780-5607
> Email: [EMAIL PROTECTED]
>   [EMAIL PROTECTED]
> Office: 301C Payson Smith
>
>
>


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

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


Re: [R] Help needed in R

2008-03-01 Thread Heinz Tuechler
At 23:07 01.03.2008, AbouEl-Makarim Aboueissa wrote:
>Dear ALL:
>
>I have two quick questions about how to perform some steps in R. 
>Could you please see the attached MS file if the data not clean 
>enough in this email.
>
>Thank you so much for all your helps.
>
>
>Abou
>
>
>
>Here it is:
>=
>
>Consider the following matrix:
>
>data<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
>   4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
> 
>0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,
>   0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2)
>
>
>   [,1] [,2]
>  [1,]20
>  [2,]20
>  [3,]   120
>  [4,]20
>  [5,]10
>  [6,]   101
>  [7,]   101
>  [8,]40
>  [9,]   101
>[10,]11
>[11,]10
>[12,]21
>[13,]21
>[14,]10
>[15,]20
>[16,]   101
>[17,]30
>[18,]11
>[19,]10
>[20,]10
>[21,]30
>[22,]51
>[23,]   170
>[24,]   230
>[25,]90
>[26,]90
>[27,]30
>[28,]30
>[29,]   151
>[30,]51
>[31,]40
>[32,]51
>[33,]51
>[34,]51
>[35,]40
>[36,]80
>[37,]10
>[38,]   150
>[39,]30
>[40,]30
>[41,]10
>[42,]60
>[43,]30
>[44,]60
>[45,]30
>[46,]40
>[47,]50
>[48,]   140
>[49,]40
>
>
>
>
>
>Q1. Column one is the data set, and column two is an indicator of 1 
>and 0. Some values
>  in column one corresponding to indicator 1 in column two 
> are different, and some
>  are the same. There are 5 different groups of values in 
> column one with indicator 1
>  in column two.
>
>(a) How I can choose only one value (only one observation) from each 
>of these groups to
>  develop a vector of length 5 as: (1   25   10  15).
>

table1 <- table(data[data[, 2]==1, 1])

as.numeric(dimnames(table1)[[1]])

[1]  1  2  5 10 15



>(b) How I can find number of observations in each of these groups as 
>a vector as:
> (2 254   1).
>

as.vector(table1)

[1] 2 2 5 4 1

greetings

Heinz










>These are the values with indicator 1.
>
> [,1] [,2]
>  [1,]11
>  [2,]11
>  [3,]21
>  [4,]21
>  [5,]51
>  [6,]51
>  [7,]51
>  [8,]51
>  [9,]51
>[10,]   101
>[11,]   101
>[12,]   101
>[13,]   101
>[14,]   151
>
>=
>
>
>
>
>
>==
>AbouEl-Makarim Aboueissa, Ph.D.
>Assistant Professor of Statistics
>Department of Mathematics & Statistics
>University of Southern Maine
>96 Falmouth Street
>P.O. Box 9300
>Portland, ME 04104-9300
>
>Tel: (207) 228-8389
>Fax: (207) 780-5607
>Email: [EMAIL PROTECTED]
>   [EMAIL PROTECTED]
>Office: 301C Payson Smith
>
>
>
>__
>R-help@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Help needed in R

2008-03-03 Thread AbouEl-Makarim Aboueissa
Dear Ellison:

it did not do it.

I edited my previous email to make my question more clear.


The out put should be: (2,11,33,43,46)

For example: 

number of all observations less than 1 with indicator 1 (including those 1 with 
indicator 1  but not 1 with indicator 0) =2

number of all observations less than 2 with indicator 1 (including those 2 with 
indicator 1 but not 2 with indicator 0) =11
   
 number of all observations less than 5 with indicator 1 (including those 5 
with indicator 1 but not 5 with indicator 0) =33

number of all observations less than 10 with indicator 1 (including those 10 
with indicator 1 but not 10 with indicator 0) =43

number of all observations less than 15 with indicator 1 (including those 15 
with indicator 1 but not 15 with indicator 0) =46


(1, 2,5,10,15) are the values in column one with indicator 1 in column two.


which means I need to create a vector(2,11,33,43,46) for the data in column one.




==
AbouEl-Makarim Aboueissa, Ph.D.
Assistant Professor of Statistics
Department of Mathematics & Statistics
University of Southern Maine
96 Falmouth Street
P.O. Box 9300
Portland, ME 04104-9300

Tel: (207) 228-8389
Fax: (207) 780-5607
Email: [EMAIL PROTECTED]
  [EMAIL PROTECTED]
Office: 301C Payson Smith


>>> "S Ellison" <[EMAIL PROTECTED]> 3/3/2008 10:36 AM >>>
table(data[data[,2]==1,1])


>>> "AbouEl-Makarim Aboueissa" <[EMAIL PROTECTED]> 03/03/2008
15:20:21 >>>
Dear ALL:


How I can find the number of observations less than each value in
column one with indicator 1 in column two. Please see the data below.


For example: number of observations less than 1 with indicator 1
(including those 1 with indicator 1) =2
number of observations less than 2 with indicator 1
(including those 2 with indicator 1) =11
number of observations less than 5 with indicator 1
(including those 5 with indicator 1) =33
number of observations less than 10 with indicator
1 (including those 10 with indicator 1) =43
number of observations less than 15 with indicator
1 (including those 15 with indicator 1) =46

(1, 2,5,10,15) are the values in column one with indicator 1 in column
two.


which means I need to create a vector(2,11,33,43,46) for the data in
column one.

With many thanks.

Abou

Here is the data:
===

Consider the following matrix:

data<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
  4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
 
0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2)


  [,1] [,2]
 [1,]20
 [2,]20
 [3,]   120
 [4,]20
 [5,]10
 [6,]   101
 [7,]   101
 [8,]40
 [9,]   101
[10,]11
[11,]10
[12,]21
[13,]21
[14,]10
[15,]20
[16,]   101
[17,]30
[18,]11
[19,]10
[20,]10
[21,]30
[22,]51
[23,]   170
[24,]   230
[25,]90
[26,]90
[27,]30
[28,]30
[29,]   151
[30,]51
[31,]40
[32,]51
[33,]51
[34,]51
[35,]40
[36,]80
[37,]10
[38,]   150
[39,]30
[40,]30
[41,]10
[42,]60
[43,]30
[44,]60
[45,]30
[46,]40
[47,]50
[48,]   140
[49,]40




==
AbouEl-Makarim Aboueissa, Ph.D.
Assistant Professor of Statistics
Department of Mathematics & Statistics
University of Southern Maine
96 Falmouth Street
P.O. Box 9300
Portland, ME 04104-9300

Tel: (207) 228-8389
Fax: (207) 780-5607
Email: [EMAIL PROTECTED] 
  [EMAIL PROTECTED] 
Office: 301C Payson Smith

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

***
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] Help needed in R

2008-03-03 Thread Henrique Dallazuanna
For me is not very clear, but if I understand:

sapply(sort(unique(data[data[,2]==1,1])),
   function(x)sum(data[data[,2]==1 & data[,1] <= x, 1]))

But the output is:
2  6 31 71 86



On 03/03/2008, AbouEl-Makarim Aboueissa <[EMAIL PROTECTED]> wrote:
> Dear Ellison:
>
>  it did not do it.
>
>  I edited my previous email to make my question more clear.
>
>
>  The out put should be: (2,11,33,43,46)
>
>  For example:
>
>  number of all observations less than 1 with indicator 1 (including those 1 
> with indicator 1  but not 1 with indicator 0) =2
>
>  number of all observations less than 2 with indicator 1 (including those 2 
> with indicator 1 but not 2 with indicator 0) =11
>
>   number of all observations less than 5 with indicator 1 (including those 5 
> with indicator 1 but not 5 with indicator 0) =33
>
>  number of all observations less than 10 with indicator 1 (including those 10 
> with indicator 1 but not 10 with indicator 0) =43
>
>  number of all observations less than 15 with indicator 1 (including those 15 
> with indicator 1 but not 15 with indicator 0) =46
>
>
>
>  (1, 2,5,10,15) are the values in column one with indicator 1 in column two.
>
>
>  which means I need to create a vector(2,11,33,43,46) for the data in column 
> one.
>
>
>
>
>
> ==
>  AbouEl-Makarim Aboueissa, Ph.D.
>  Assistant Professor of Statistics
>  Department of Mathematics & Statistics
>  University of Southern Maine
>  96 Falmouth Street
>  P.O. Box 9300
>  Portland, ME 04104-9300
>
>  Tel: (207) 228-8389
>  Fax: (207) 780-5607
>  Email: [EMAIL PROTECTED]
>   [EMAIL PROTECTED]
>  Office: 301C Payson Smith
>
>
>
> >>> "S Ellison" <[EMAIL PROTECTED]> 3/3/2008 10:36 AM >>>
>  table(data[data[,2]==1,1])
>
>
>  >>> "AbouEl-Makarim Aboueissa" <[EMAIL PROTECTED]> 03/03/2008
>  15:20:21 >>>
>
> Dear ALL:
>
>
>  How I can find the number of observations less than each value in
>  column one with indicator 1 in column two. Please see the data below.
>
>
>  For example: number of observations less than 1 with indicator 1
>  (including those 1 with indicator 1) =2
> number of observations less than 2 with indicator 1
>  (including those 2 with indicator 1) =11
> number of observations less than 5 with indicator 1
>  (including those 5 with indicator 1) =33
> number of observations less than 10 with indicator
>  1 (including those 10 with indicator 1) =43
> number of observations less than 15 with indicator
>  1 (including those 15 with indicator 1) =46
>
>  (1, 2,5,10,15) are the values in column one with indicator 1 in column
>  two.
>
>
>  which means I need to create a vector(2,11,33,43,46) for the data in
>  column one.
>
>  With many thanks.
>
>  Abou
>
>  Here is the data:
>  ===
>
>  Consider the following matrix:
>
>  
> data<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
>   4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
>
>  0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,
>   0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2)
>
>
>   [,1] [,2]
>   [1,]20
>   [2,]20
>   [3,]   120
>   [4,]20
>   [5,]10
>   [6,]   101
>   [7,]   101
>   [8,]40
>   [9,]   101
>  [10,]11
>  [11,]10
>  [12,]21
>  [13,]21
>  [14,]10
>  [15,]20
>  [16,]   101
>  [17,]30
>  [18,]11
>  [19,]10
>  [20,]10
>  [21,]30
>  [22,]51
>  [23,]   170
>  [24,]   230
>  [25,]90
>  [26,]90
>  [27,]30
>  [28,]30
>  [29,]   151
>  [30,]51
>  [31,]40
>  [32,]51
>  [33,]51
>  [34,]51
>  [35,]40
>  [36,]80
>  [37,]10
>  [38,]   150
>  [39,]30
>  [40,]30
>  [41,]10
>  [42,]60
>  [43,]30
>  [44,]60
>  [45,]30
>  [46,]40
>  [47,]50
>  [48,]   140
>  [49,]40
>
>
>
>
>  ==
>  AbouEl-Makarim Aboueissa, Ph.D.
>  Assistant Professor of Statistics
>  Department of Mathematics & Statistics
>  University of Southern Maine
>  96 Falmouth Street
>  P.O. Box 9300
>  Portland, ME 04104-9300
>
>  Tel: (207) 228-8389
>  Fax: (207) 780-5607
>  Email: [EMAIL PROTECTED]
>   [EMAIL PROTECTED]
>  Office: 301C Payson Smith
>
>  __
>  R-help@r-project.org mailing list
>  https://stat.ethz.ch/mailman/listinfo/r-help
>  PLEASE do read the posting guide
>  http://www.R-project.org/posting-guide.html
>  and provide commented, minimal, self-contained, reproducible code.
>
>
> ***
>  This email and any attachments are confidential. Any use...{{dropped:8}}
>
>
>  __
>  R-help@

Re: [R] Help needed in R

2008-03-03 Thread AbouEl-Makarim Aboueissa
Dear ALL:


Please see below. I hope this will make it more clear.

[1,]11
 [2,]11  number of all observations less than 1 with
indicator 1 (including those 1 with indicator 1  but not 1 with
indicator 0)=2 
[3,]10
 [4,]10
 [5,]10
 [6,]10
 [7,]10
 [8,]10
 [9,]10
[10,]21
[11,]21number of all observations less than 2 with
indicator 1 (including those 2 with indicator 1  but not 2 with
indicator 0)=11
[12,]20
[13,]20
[14,]20
[15,]20
[16,]30
[17,]30
[18,]30
[19,]30
[20,]30
[21,]30
[22,]30
[23,]30
[24,]40
[25,]40
[26,]40
[27,]40
[28,]40
[29,]51
[30,]51
[31,]51
[32,]51
[33,]51   number of all observations less than 5 with indicator
1 (including those 5 with indicator 1  but not 5 with indicator 0)=33
[34,]50
[35,]60
[36,]60
[37,]80
[38,]90
[39,]90
[40,]   101
[41,]   101
[42,]   101
[43,]   101  number of all observations less than 10 with indicator
1 (including those 10 with indicator 1  but not 10 with indicator 0)=43
[44,]   120
[45,]   140
[46,]   151 number of all observations less than 15 with
indicator 1 (including those 15 with indicator 1  but not 15 with
indicator 0)=46
[47,]   150
[48,]   170
[49,]   230


How I can write an R code to do this.

Thanks

Abou


==
AbouEl-Makarim Aboueissa, Ph.D.
Assistant Professor of Statistics
Department of Mathematics & Statistics
University of Southern Maine
96 Falmouth Street
P.O. Box 9300
Portland, ME 04104-9300

Tel: (207) 228-8389
Fax: (207) 780-5607
Email: [EMAIL PROTECTED]
  [EMAIL PROTECTED]
Office: 301C Payson Smith


>>> "Henrique Dallazuanna" <[EMAIL PROTECTED]> 3/3/2008 11:38 AM >>>
For me is not very clear, but if I understand:

sapply(sort(unique(data[data[,2]==1,1])),
   function(x)sum(data[data[,2]==1 & data[,1] <= x, 1]))

But the output is:
2  6 31 71 86



On 03/03/2008, AbouEl-Makarim Aboueissa <[EMAIL PROTECTED]>
wrote:
> Dear Ellison:
>
>  it did not do it.
>
>  I edited my previous email to make my question more clear.
>
>
>  The out put should be: (2,11,33,43,46)
>
>  For example:
>
>  number of all observations less than 1 with indicator 1 (including
those 1 with indicator 1  but not 1 with indicator 0) =2
>
>  number of all observations less than 2 with indicator 1 (including
those 2 with indicator 1 but not 2 with indicator 0) =11
>
>   number of all observations less than 5 with indicator 1 (including
those 5 with indicator 1 but not 5 with indicator 0) =33
>
>  number of all observations less than 10 with indicator 1 (including
those 10 with indicator 1 but not 10 with indicator 0) =43
>
>  number of all observations less than 15 with indicator 1 (including
those 15 with indicator 1 but not 15 with indicator 0) =46
>
>
>
>  (1, 2,5,10,15) are the values in column one with indicator 1 in
column two.
>
>
>  which means I need to create a vector(2,11,33,43,46) for the data in
column one.
>
>
>
>
>
> ==
>  AbouEl-Makarim Aboueissa, Ph.D.
>  Assistant Professor of Statistics
>  Department of Mathematics & Statistics
>  University of Southern Maine
>  96 Falmouth Street
>  P.O. Box 9300
>  Portland, ME 04104-9300
>
>  Tel: (207) 228-8389
>  Fax: (207) 780-5607
>  Email: [EMAIL PROTECTED] 
>   [EMAIL PROTECTED] 
>  Office: 301C Payson Smith
>
>
>
> >>> "S Ellison" <[EMAIL PROTECTED]> 3/3/2008 10:36 AM >>>
>  table(data[data[,2]==1,1])
>
>
>  >>> "AbouEl-Makarim Aboueissa" <[EMAIL PROTECTED]>
03/03/2008
>  15:20:21 >>>
>
> Dear ALL:
>
>
>  How I can find the number of observations less than each value in
>  column one with indicator 1 in column two. Please see the data
below.
>
>
>  For example: number of observations less than 1 with indicator 1
>  (including those 1 with indicator 1) =2
> number of observations less than 2 with indicator
1
>  (including those 2 with indicator 1) =11
> number of observations less than 5 with indicator
1
>  (including those 5 with indicator 1) =33
> number of observations less than 10 with
indicator
>  1 (including those 10 with indicator 1) =43
> number of observations less than 15 with
indicator
>  1 (including those 15 with indicator 1) =46
>
>  (1, 2,5,10,15) are the values in column one with indicator 1 in
column
>  two.
>
>
>  which means I need to create a vector(2,11,33,43,46) for the data
in
>  column one.
>
>  With many thanks.
>
>  Abou
>
>  Here is the data:
>  ===
>
>  Consider the following matrix:
>
> 
data<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
>   4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
>
> 
0,0,0,0,0,1,1,0,1,1,0,1

Re: [R] Help needed in R

2008-03-03 Thread Charles Annis, P.E.
perhaps you need something like sum(X[X < 1])



Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of AbouEl-Makarim Aboueissa
Sent: Monday, March 03, 2008 11:55 AM
To: Henrique Dallazuanna
Cc: r-help@r-project.org; S Ellison
Subject: Re: [R] Help needed in R

Dear ALL:


Please see below. I hope this will make it more clear.

[1,]11
 [2,]11  number of all observations less than 1 with
indicator 1 (including those 1 with indicator 1  but not 1 with
indicator 0)=2 
[3,]10
 [4,]10
 [5,]10
 [6,]10
 [7,]10
 [8,]10
 [9,]10
[10,]21
[11,]21number of all observations less than 2 with
indicator 1 (including those 2 with indicator 1  but not 2 with
indicator 0)=11
[12,]20
[13,]20
[14,]20
[15,]20
[16,]30
[17,]30
[18,]30
[19,]30
[20,]30
[21,]30
[22,]30
[23,]30
[24,]40
[25,]40
[26,]40
[27,]40
[28,]40
[29,]51
[30,]51
[31,]51
[32,]51
[33,]51   number of all observations less than 5 with indicator
1 (including those 5 with indicator 1  but not 5 with indicator 0)=33
[34,]50
[35,]60
[36,]60
[37,]80
[38,]90
[39,]90
[40,]   101
[41,]   101
[42,]   101
[43,]   101  number of all observations less than 10 with indicator
1 (including those 10 with indicator 1  but not 10 with indicator 0)=43
[44,]   120
[45,]   140
[46,]   151 number of all observations less than 15 with
indicator 1 (including those 15 with indicator 1  but not 15 with
indicator 0)=46
[47,]   150
[48,]   170
[49,]   230


How I can write an R code to do this.

Thanks

Abou


==
AbouEl-Makarim Aboueissa, Ph.D.
Assistant Professor of Statistics
Department of Mathematics & Statistics
University of Southern Maine
96 Falmouth Street
P.O. Box 9300
Portland, ME 04104-9300

Tel: (207) 228-8389
Fax: (207) 780-5607
Email: [EMAIL PROTECTED]
  [EMAIL PROTECTED]
Office: 301C Payson Smith


>>> "Henrique Dallazuanna" <[EMAIL PROTECTED]> 3/3/2008 11:38 AM >>>
For me is not very clear, but if I understand:

sapply(sort(unique(data[data[,2]==1,1])),
   function(x)sum(data[data[,2]==1 & data[,1] <= x, 1]))

But the output is:
2  6 31 71 86



On 03/03/2008, AbouEl-Makarim Aboueissa <[EMAIL PROTECTED]>
wrote:
> Dear Ellison:
>
>  it did not do it.
>
>  I edited my previous email to make my question more clear.
>
>
>  The out put should be: (2,11,33,43,46)
>
>  For example:
>
>  number of all observations less than 1 with indicator 1 (including
those 1 with indicator 1  but not 1 with indicator 0) =2
>
>  number of all observations less than 2 with indicator 1 (including
those 2 with indicator 1 but not 2 with indicator 0) =11
>
>   number of all observations less than 5 with indicator 1 (including
those 5 with indicator 1 but not 5 with indicator 0) =33
>
>  number of all observations less than 10 with indicator 1 (including
those 10 with indicator 1 but not 10 with indicator 0) =43
>
>  number of all observations less than 15 with indicator 1 (including
those 15 with indicator 1 but not 15 with indicator 0) =46
>
>
>
>  (1, 2,5,10,15) are the values in column one with indicator 1 in
column two.
>
>
>  which means I need to create a vector(2,11,33,43,46) for the data in
column one.
>
>
>
>
>
> ==
>  AbouEl-Makarim Aboueissa, Ph.D.
>  Assistant Professor of Statistics
>  Department of Mathematics & Statistics
>  University of Southern Maine
>  96 Falmouth Street
>  P.O. Box 9300
>  Portland, ME 04104-9300
>
>  Tel: (207) 228-8389
>  Fax: (207) 780-5607
>  Email: [EMAIL PROTECTED] 
>   [EMAIL PROTECTED] 
>  Office: 301C Payson Smith
>
>
>
> >>> "S Ellison" <[EMAIL PROTECTED]> 3/3/2008 10:36 AM >>>
>  table(data[data[,2]==1,1])
>
>
>  >>> "AbouEl-Makarim Aboueissa" <[EMAIL PROTECTED]>
03/03/2008
>  15:20:21 >>>
>
> Dear ALL:
>
>
>  How I can find the number of observations less than each value in
>  column one with indicator 1 in column two. Please see the data
below.
>
>
>  For example: number of observations less than 1 with indicator 1
>  (including those 1 with indicator 1) =2
> number of observations less than 2 with indicator
1
>  (including those 2 with indicator 1) =11
> number of observations less than 5 with ind

Re: [R] Help needed in R

2008-03-03 Thread Charles Annis, P.E.
I believe I wrote too hastily and that what you want is sum(X < 1) which
will sum the indicator (T/F) function.

Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of AbouEl-Makarim Aboueissa
Sent: Monday, March 03, 2008 11:55 AM
To: Henrique Dallazuanna
Cc: r-help@r-project.org; S Ellison
Subject: Re: [R] Help needed in R

Dear ALL:


Please see below. I hope this will make it more clear.

[1,]11
 [2,]11  number of all observations less than 1 with
indicator 1 (including those 1 with indicator 1  but not 1 with
indicator 0)=2 
[3,]10
 [4,]10
 [5,]10
 [6,]10
 [7,]10
 [8,]10
 [9,]10
[10,]21
[11,]21number of all observations less than 2 with
indicator 1 (including those 2 with indicator 1  but not 2 with
indicator 0)=11
[12,]20
[13,]20
[14,]20
[15,]20
[16,]30
[17,]30
[18,]30
[19,]30
[20,]30
[21,]30
[22,]30
[23,]30
[24,]40
[25,]40
[26,]40
[27,]40
[28,]40
[29,]51
[30,]51
[31,]51
[32,]51
[33,]51   number of all observations less than 5 with indicator
1 (including those 5 with indicator 1  but not 5 with indicator 0)=33
[34,]50
[35,]60
[36,]60
[37,]80
[38,]90
[39,]90
[40,]   101
[41,]   101
[42,]   101
[43,]   101  number of all observations less than 10 with indicator
1 (including those 10 with indicator 1  but not 10 with indicator 0)=43
[44,]   120
[45,]   140
[46,]   151 number of all observations less than 15 with
indicator 1 (including those 15 with indicator 1  but not 15 with
indicator 0)=46
[47,]   150
[48,]   170
[49,]   230


How I can write an R code to do this.

Thanks

Abou


==
AbouEl-Makarim Aboueissa, Ph.D.
Assistant Professor of Statistics
Department of Mathematics & Statistics
University of Southern Maine
96 Falmouth Street
P.O. Box 9300
Portland, ME 04104-9300

Tel: (207) 228-8389
Fax: (207) 780-5607
Email: [EMAIL PROTECTED]
  [EMAIL PROTECTED]
Office: 301C Payson Smith


>>> "Henrique Dallazuanna" <[EMAIL PROTECTED]> 3/3/2008 11:38 AM >>>
For me is not very clear, but if I understand:

sapply(sort(unique(data[data[,2]==1,1])),
   function(x)sum(data[data[,2]==1 & data[,1] <= x, 1]))

But the output is:
2  6 31 71 86



On 03/03/2008, AbouEl-Makarim Aboueissa <[EMAIL PROTECTED]>
wrote:
> Dear Ellison:
>
>  it did not do it.
>
>  I edited my previous email to make my question more clear.
>
>
>  The out put should be: (2,11,33,43,46)
>
>  For example:
>
>  number of all observations less than 1 with indicator 1 (including
those 1 with indicator 1  but not 1 with indicator 0) =2
>
>  number of all observations less than 2 with indicator 1 (including
those 2 with indicator 1 but not 2 with indicator 0) =11
>
>   number of all observations less than 5 with indicator 1 (including
those 5 with indicator 1 but not 5 with indicator 0) =33
>
>  number of all observations less than 10 with indicator 1 (including
those 10 with indicator 1 but not 10 with indicator 0) =43
>
>  number of all observations less than 15 with indicator 1 (including
those 15 with indicator 1 but not 15 with indicator 0) =46
>
>
>
>  (1, 2,5,10,15) are the values in column one with indicator 1 in
column two.
>
>
>  which means I need to create a vector(2,11,33,43,46) for the data in
column one.
>
>
>
>
>
> ==
>  AbouEl-Makarim Aboueissa, Ph.D.
>  Assistant Professor of Statistics
>  Department of Mathematics & Statistics
>  University of Southern Maine
>  96 Falmouth Street
>  P.O. Box 9300
>  Portland, ME 04104-9300
>
>  Tel: (207) 228-8389
>  Fax: (207) 780-5607
>  Email: [EMAIL PROTECTED] 
>   [EMAIL PROTECTED] 
>  Office: 301C Payson Smith
>
>
>
> >>> "S Ellison" <[EMAIL PROTECTED]> 3/3/2008 10:36 AM >>>
>  table(data[data[,2]==1,1])
>
>
>  >>> "AbouEl-Makarim Aboueissa" <[EMAIL PROTECTED]>
03/03/2008
>  15:20:21 >>>
>
> Dear ALL:
>
>
>  How I can find the number of observations less than each value in
>  column one with indicator 1 in column two. Please see the data
below.
>
>
>  For example: number of observations less than 1 with indicator 1
>  (including those 1 with indicator 1) =2
> number of observations less than 2 with indicator
1
>  (including those 2 with indicator 1) =11
>

Re: [R] Help needed in R

2008-03-03 Thread T.K.
I guess you are looking for the number of rows satisfying the following
condition.
Assuming that you have a cutoff k = 1, 2, 5, 10, 15
1) x[i,1] < k regardless of the value of x[i,2], OR
2) x[i,1] == k and x[i,2] == 1

Here is my take on this problem. It is not elegant but it seems to do the
job.

> ## Data
> data1
<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
+  4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
+
0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2)
>
> ## Function definition
> find.n <- function(cutoff, x=data1){
+ x1 <- x[,1]
+ x2 <- x[,2]
+ sum(x1 < cutoff | ((x1 == cutoff )& (x2==1)))
+ }
>
> ## Use the function
> sapply(c(1, 2, 5, 10, 15), find.n)
[1]  2 11 33 43 46

-- 
==
T.K. (Tae-kyun) Kim
Ph.D. student
Department of Marketing
Marshall School of Business
University of Southern California
==

[[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] Help needed in R

2008-03-03 Thread AbouEl-Makarim Aboueissa
It works.

Thank you so much.

Abou



==
AbouEl-Makarim Aboueissa, Ph.D.
Assistant Professor of Statistics
Department of Mathematics & Statistics
University of Southern Maine
96 Falmouth Street
P.O. Box 9300
Portland, ME 04104-9300

Tel: (207) 228-8389
Fax: (207) 780-5607
Email: [EMAIL PROTECTED]
  [EMAIL PROTECTED]
Office: 301C Payson Smith


>>> T.K. <[EMAIL PROTECTED]> 3/3/2008 3:25 PM >>>
I guess you are looking for the number of rows satisfying the following
condition.
Assuming that you have a cutoff k = 1, 2, 5, 10, 15
1) x[i,1] < k regardless of the value of x[i,2], OR
2) x[i,1] == k and x[i,2] == 1

Here is my take on this problem. It is not elegant but it seems to do the
job.

> ## Data
> data1
<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
+  4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
+
0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2)
>
> ## Function definition
> find.n <- function(cutoff, x=data1){
+ x1 <- x[,1]
+ x2 <- x[,2]
+ sum(x1 < cutoff | ((x1 == cutoff )& (x2==1)))
+ }
>
> ## Use the function
> sapply(c(1, 2, 5, 10, 15), find.n)
[1]  2 11 33 43 46

-- 
==
T.K. (Tae-kyun) Kim
Ph.D. student
Department of Marketing
Marshall School of Business
University of Southern California
==

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

2008-03-04 Thread rmail ye
Hi there,

I am confused about fucntion call. After defining a function, I called it
within another function.

dt<-cars;  #a copy of R internal dataset "cars" created;
dt$cat1<-ifelse(dt$speed<20,0,1);
dt$ind<-ifelse(dt$speed<15,1,2);  #group variable;

freqtot <- function(data,var){
  attach(data,warn.conflicts=FALSE)
  x1 <- data.frame(table(var))
  names(x1) <- c("Group","cnt")
  x1$pct<-round(x1$cnt/nrow(data)*100,1)
  return(x1)
}

freqgrp <- function(dt,var,grp,grpcnt){
  xx<-freqtot(dt,var)
  for(i in 1:grpcnt) {
assign(paste("x",i,sep=""),subset(dt,grp==i))
df<-eval(parse(text=paste("x",i,sep="")))
yy <- freqtot(df,cat1);

names(yy)<-c("Group",paste("grp_",i,"_cnt",sep=""),paste("grp_",i,"_pct",sep=""))
xx<-merge(xx,yy,by.x="Group",all=TRUE)
  }
  print(xx)
}

The output is
> xyz <- freqgrp(dt,cat1,ind,2)
  Group cnt pct grp_1_cnt grp_1_pct grp_2_cnt grp_2_pct
1 0  38  7623   10015  55.6
2 1  12  24NANA12  44.4
>
But if I substitue the variable "cat1" in line {yy <- freqtot(df,cat1)}, it
doesn't output the correct results.

The motivation to write the 2 functions is putting the count and percentage
for overall & each individual group together, and write the data frame into
a .csv file.

Thanks,
Sean

[[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 needed with Waterfall plot

2008-10-31 Thread Philip Twumasi-Ankrah
Hi friends,
I need suggestions/directions on how to producing a waterfall plot for present 
extend of change in tumour size for a set of respondents in a study.  Example 
of use of waterfall plot is in the following slides presented at ASCO 2007 by 
Axel Grothey. Link is 

http://media.asco.org/player/default.aspx?LectureID=AG265&conferenceFolder=GI2007&SessionFolder=Poster&slideonly=yes&TrackID=N929&LectureTitle=Waterfall%20plots%20provide%20detailed%20information%20on%20magnitude%20of%20response%20to%20conventional%20chemotherapy%20in%20colorectal%20cancer%3a%20Lessons%20learned%20from%20N9741.&Key=vm_45_3_26_265&SpeakerName=%3b%20Presenter%3a%20Axel%20Grothey%2c%20MD&mediaURL=%2fmedia&ServerName=media.asco.org&max=12&ext=jpg&useASX=false&playtype=&playtype=&playtype=,

The link is pretty long but it takes you right to the presentation.



A Smile costs Nothing  
 But Rewards Everything

Happiness is not perfected until it is shared
  -Jane Porter  
  



  
[[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 needed on R output

2009-05-25 Thread peng chen
Hi, R experts:

I am trying to generate data output in the following format:

rom_array := (
"",
"01001001011011101100",
"1001001011010101",
"1101110100000011",
"000100100101001001011001",
"000101101101101001101001")

I have all the necessary data line, however, I am having trouble generating
the double quotation marks along with the trailing comma for each line.

Anyone can help?

Thanks.

[[alternative HTML version deleted]]

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


Re: [R] Help needed on Normality test

2008-01-29 Thread Greg Snow
The 2 tests are testing different hypotheses.  The KS test is testing
the null that the data comes from a normal with mean 0 and sd
0.11908969, this can be false if the data is not normal or if the mean
is not 0 or if the sd is not 0.0119 or any combination of the 3.

The Shapiro test was not given a specific mean and sd so it is just
testing normality, not mean or sd.

You should really be asking the question of why do you want to know if
the data is normal?  If your sample size is small then these tests don't
have enough power to truly distinguish between distributions (and 1
outlier can cause you to falsly reject normality if it is true).  If
your sample size is large then the CLT comes into play in many common
analyses and it does not matter if the population is normal or not.  In
many cases the better question is "Is this data close enough to normal?"
and that question is often better answered by a qq normal plot than a
p-value.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Megh Dal
> Sent: Tuesday, January 29, 2008 7:57 AM
> To: [EMAIL PROTECTED]
> Subject: [R] Help needed on Normality test
> 
> Hi all T gurus,
>
>   I would like to test if my dataset is indeed from N(0, 0.011908969).
>
>   K.S. test gives following result:
>
>   > ks.test(data, "pnorm", 0, 0.011908969)
>   One-sample Kolmogorov-Smirnov test
>   data:  data
> D = 0.1092, p-value = 1.318e-05
> alternative hypothesis: two-sided 
> 
>   How ever "Shapiro-Wilk" test give following :
>   > shapiro.test(data)
>   Shapiro-Wilk normality test
>   data:  data
> W = 0.9946, p-value = 0.07562
> 
>   also, 
>
>   > sd(data)
> [1] 0.01625074
> 
>   2nd test saying data is from normal however 1st isnot. 
> Which one is correct? Am I missing something?
>
>   Regards,
> 
>
> -
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

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

2009-01-10 Thread Kum-Hoe Hwang
Howdy Gurus again

Thanks to  Tony.Breyal, I was able to writing the following script for
analyzing a text document.
But I got an error with "tm' package. I don't why I got the error from the R
script below. I think I followed proccess of R tm manual.

I use R v2.8.1. and tm_0.3-3.zip under Win XP.

Thanks in advance,

Kum Hwang

> # setting directory
> my.path <-'C:\\_work\\Daddy"s\\myProjects\\2009
defaultProject\\R\\textfile\\'
>
> # text miner pakacge
> library(tm)
Loading required package: Snowball
Loading required package: RWeka
-
Error in .jinit(system.file("jar", c("weka.jar", "RWeka.jar"), package =
pkgname,  :
  Cannot create Java virtual machine (-1)
Error : .onLoad failed in 'loadNamespace' for 'RWeka'
Error: package 'RWeka' could not be loaded
> my.corpurs <-Corpus(DirSource(my.path), readerControl =
list(reader=readPlain))
Error: could not find function "Corpus"
> my.tdm <- TermDocMatrix(my.corpus)
Error: could not find function "TermDocMatrix"
> my.tdm[1,]
Error: object "my.tdm" not found


-- 
Kum-Hoe Hwang, Ph.D.

Phone : 82-31-250-3516
Email : phdhw...@gmail.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 needed: Plotting step by step.

2008-04-23 Thread Atul Kulkarni
Hello,

I have generated 2 Poisson processes and want to plot them on a single graph
in a step by step manner in order to be able to compare them. I tried plot
and biplot but it does not help, I could connect two points by hand for
point graph if they were 5 or 10 I have more than 200 such point to be
connected and Poisson cluster makes it difficult for me to even read them
properly.

Can anyone tell me which is the function that can plot a stepwise graph for
me? I did google over the plot for step fun but did not understand much of
it. A simpler help would be more useful to me, as I am not a expert either
in Statistics or R.

Regards,
Atul.

-- 
Atul S. Kulkarni
Graduate Student,
Department of Computer Science,
University Of Minnesota,
Duluth, MN 55812.
www.d.umn.edu/~kulka053
-
"Before you start some work, always ask yourself three questions - Why am I
doing it, What the results might be and Will I be successful. Only when you
think deeply and find satisfactory answers to these questions, go ahead."
Chanakya quotes (Indian politician, strategist and writer, 350 BC-275 BC)

[[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] help needed on function call

2008-03-04 Thread Erik Iverson
It isn't clear to me what output you would like to have by your 
description.

However, there certainly is a clearer way of getting there than your 
functions.  If you better define what output you'd like to have (i.e., 
what your table should look like), I may be able to offer some suggestions.

You may want to look at ?prop.table to see if it helps you though.

Best,
Erik Iverson

rmail ye wrote:
> Hi there,
> 
> I am confused about fucntion call. After defining a function, I called it
> within another function.
> 
> dt<-cars;  #a copy of R internal dataset "cars" created;
> dt$cat1<-ifelse(dt$speed<20,0,1);
> dt$ind<-ifelse(dt$speed<15,1,2);  #group variable;
> 
> freqtot <- function(data,var){
>   attach(data,warn.conflicts=FALSE)
>   x1 <- data.frame(table(var))
>   names(x1) <- c("Group","cnt")
>   x1$pct<-round(x1$cnt/nrow(data)*100,1)
>   return(x1)
> }
> 
> freqgrp <- function(dt,var,grp,grpcnt){
>   xx<-freqtot(dt,var)
>   for(i in 1:grpcnt) {
> assign(paste("x",i,sep=""),subset(dt,grp==i))
> df<-eval(parse(text=paste("x",i,sep="")))
> yy <- freqtot(df,cat1);
> 
> names(yy)<-c("Group",paste("grp_",i,"_cnt",sep=""),paste("grp_",i,"_pct",sep=""))
> xx<-merge(xx,yy,by.x="Group",all=TRUE)
>   }
>   print(xx)
> }
> 
> The output is
>> xyz <- freqgrp(dt,cat1,ind,2)
>   Group cnt pct grp_1_cnt grp_1_pct grp_2_cnt grp_2_pct
> 1 0  38  7623   10015  55.6
> 2 1  12  24NANA12  44.4
> But if I substitue the variable "cat1" in line {yy <- freqtot(df,cat1)}, it
> doesn't output the correct results.
> 
> The motivation to write the 2 functions is putting the count and percentage
> for overall & each individual group together, and write the data frame into
> a .csv file.
> 
> Thanks,
> Sean
> 
>   [[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] help needed on function call

2008-03-04 Thread rmail ye
Thanks for your help.

By adding { eval(substitute(var)) }, it works for me. Patrick advise me not
attaching a dataset in a function. I will try to avoid this.

Best,
Sean

On Tue, Mar 4, 2008 at 11:15 AM, Erik Iverson <[EMAIL PROTECTED]>
wrote:

> It isn't clear to me what output you would like to have by your
> description.
>
> However, there certainly is a clearer way of getting there than your
> functions.  If you better define what output you'd like to have (i.e.,
> what your table should look like), I may be able to offer some
> suggestions.
>
> You may want to look at ?prop.table to see if it helps you though.
>
> Best,
> Erik Iverson
>
> rmail ye wrote:
> > Hi there,
> >
> > I am confused about fucntion call. After defining a function, I called
> it
> > within another function.
> >
> > dt<-cars;  #a copy of R internal dataset "cars" created;
> > dt$cat1<-ifelse(dt$speed<20,0,1);
> > dt$ind<-ifelse(dt$speed<15,1,2);  #group variable;
> >
> > freqtot <- function(data,var){
> >   attach(data,warn.conflicts=FALSE)
> >   x1 <- data.frame(table(var))
> >   names(x1) <- c("Group","cnt")
> >   x1$pct<-round(x1$cnt/nrow(data)*100,1)
> >   return(x1)
> > }
> >
> > freqgrp <- function(dt,var,grp,grpcnt){
> >   xx<-freqtot(dt,var)
> >   for(i in 1:grpcnt) {
> > assign(paste("x",i,sep=""),subset(dt,grp==i))
> > df<-eval(parse(text=paste("x",i,sep="")))
> > yy <- freqtot(df,cat1);
> >
> >
> names(yy)<-c("Group",paste("grp_",i,"_cnt",sep=""),paste("grp_",i,"_pct",sep=""))
> > xx<-merge(xx,yy,by.x="Group",all=TRUE)
> >   }
> >   print(xx)
> > }
> >
> > The output is
> >> xyz <- freqgrp(dt,cat1,ind,2)
> >   Group cnt pct grp_1_cnt grp_1_pct grp_2_cnt grp_2_pct
> > 1 0  38  7623   10015  55.6
> > 2 1  12  24NANA12  44.4
> > But if I substitue the variable "cat1" in line {yy <- freqtot(df,cat1)},
> it
> > doesn't output the correct results.
> >
> > The motivation to write the 2 functions is putting the count and
> percentage
> > for overall & each individual group together, and write the data frame
> into
> > a .csv file.
> >
> > Thanks,
> > Sean
> >
>  >   [[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] Help needed with Waterfall plot

2008-10-31 Thread Thomas Petzoldt

Philip Twumasi-Ankrah schrieb:

Hi friends,
I need suggestions/directions on how to producing a waterfall plot for present extend of change in tumour size for a set of respondents in a study.  Example of use of waterfall plot is in the following slides presented at ASCO 2007 by Axel Grothey. Link is 


http://media.asco.org/player/default.aspx?LectureID=AG265&conferenceFolder=GI2007&SessionFolder=Poster&slideonly=yes&TrackID=N929&LectureTitle=Waterfall%20plots%20provide%20detailed%20information%20on%20magnitude%20of%20response%20to%20conventional%20chemotherapy%20in%20colorectal%20cancer%3a%20Lessons%20learned%20from%20N9741.&Key=vm_45_3_26_265&SpeakerName=%3b%20Presenter%3a%20Axel%20Grothey%2c%20MD&mediaURL=%2fmedia&ServerName=media.asco.org&max=12&ext=jpg&useASX=false&playtype=&playtype=&playtype=,

The link is pretty long but it takes you right to the presentation.


Hi Phillip,

is this a "waterfall plot":

## a few data
x <- 0:99
y <- sort(rnorm(100), decreasing=TRUE)

# the plot
plot(y, type="n")
polygon(c(min(x), x, max(x), 0), c(0, y, 0, 0), col="green")

Thomas P.

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


Re: [R] Help needed with Waterfall plot

2008-11-01 Thread Jim Lemon

Philip Twumasi-Ankrah wrote:

Hi friends,
I need suggestions/directions on how to producing a waterfall plot for present extend of change in tumour size for a set of respondents in a study.  Example of use of waterfall plot is in the following slides presented at ASCO 2007 by Axel Grothey. 

Hi Philip,
The stackpoly function in the plotrix package almost does what you want. 
I think I can knock it into a waterfall plot function without too much 
trouble. I'll get back to you by tomorrow evening (in Australia).


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] Help needed with Waterfall plot

2008-11-01 Thread Jim Lemon

Thomas Petzoldt wrote:

Philip Twumasi-Ankrah schrieb:

Hi friends,
I need suggestions/directions on how to producing a waterfall plot 
for present extend of change in tumour size for a set of respondents 
in a study.  Example of use of waterfall plot is in the following 
slides presented at ASCO 2007 by Axel Grothey. Link is
http://media.asco.org/player/default.aspx?LectureID=AG265&conferenceFolder=GI2007&SessionFolder=Poster&slideonly=yes&TrackID=N929&LectureTitle=Waterfall%20plots%20provide%20detailed%20information%20on%20magnitude%20of%20response%20to%20conventional%20chemotherapy%20in%20colorectal%20cancer%3a%20Lessons%20learned%20from%20N9741.&Key=vm_45_3_26_265&SpeakerName=%3b%20Presenter%3a%20Axel%20Grothey%2c%20MD&mediaURL=%2fmedia&ServerName=media.asco.org&max=12&ext=jpg&useASX=false&playtype=&playtype=&playtype=, 



The link is pretty long but it takes you right to the presentation.


Hi Phillip,

is this a "waterfall plot":

## a few data
x <- 0:99
y <- sort(rnorm(100), decreasing=TRUE)

# the plot
plot(y, type="n")
polygon(c(min(x), x, max(x), 0), c(0, y, 0, 0), col="green")


Hi Thomas (and Philip again),
Very nice - Ijust read your email and tested it with a non-monotonic y 
and it works. I guess there isn't any point in writing a "waterfall 
plot" function after all.


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] Help needed with Waterfall plot

2008-11-01 Thread Gabor Grothendieck
Here is one possibility:


# random data
set.seed(1)
growth <- sort(runif(215, -100, 100), decreasing = TRUE)

col <- factor(1 + (growth < -25) + (growth < 25),
lab = c("black", "grey50", "grey80"))
barplot(growth, col = levels(col)[col], ylab = "% Growth",
main = "Random Data", xlab = "", space = 0, border = 0,
ylim = c(-100, 100))
legend("topright", legend = c("> 25%", "25% > . > -25%", "< 25%"),
cex = 0.8, bty = "n", fill = levels(col))
legend("bottomleft", "Random data with style of: Ratain et al, JCO,
2006, Fig 2", cex = 0.6, bty = "n")


On Fri, Oct 31, 2008 at 12:25 PM, Philip Twumasi-Ankrah
<[EMAIL PROTECTED]> wrote:
> Hi friends,
> I need suggestions/directions on how to producing a waterfall plot for 
> present extend of change in tumour size for a set of respondents in a study.  
> Example of use of waterfall plot is in the following slides presented at ASCO 
> 2007 by Axel Grothey. Link is
>
> http://media.asco.org/player/default.aspx?LectureID=AG265&conferenceFolder=GI2007&SessionFolder=Poster&slideonly=yes&TrackID=N929&LectureTitle=Waterfall%20plots%20provide%20detailed%20information%20on%20magnitude%20of%20response%20to%20conventional%20chemotherapy%20in%20colorectal%20cancer%3a%20Lessons%20learned%20from%20N9741.&Key=vm_45_3_26_265&SpeakerName=%3b%20Presenter%3a%20Axel%20Grothey%2c%20MD&mediaURL=%2fmedia&ServerName=media.asco.org&max=12&ext=jpg&useASX=false&playtype=&playtype=&playtype=,
>
> The link is pretty long but it takes you right to the presentation.
>
>
>
> A Smile costs Nothing
>  But Rewards Everything
>
> Happiness is not perfected until it is shared
>   -Jane Porter
>
>
>
>
>[[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] Help needed with Waterfall plot

2008-11-01 Thread hadley wickham
On Fri, Oct 31, 2008 at 11:25 AM, Philip Twumasi-Ankrah
<[EMAIL PROTECTED]> wrote:
> Hi friends,
> I need suggestions/directions on how to producing a waterfall plot for 
> present extend of change in tumour size for a set of respondents in a study.  
> Example of use of waterfall plot is in the following slides presented at ASCO 
> 2007 by Axel Grothey. Link is
>
> http://media.asco.org/player/default.aspx?LectureID=AG265&conferenceFolder=GI2007&SessionFolder=Poster&slideonly=yes&TrackID=N929&LectureTitle=Waterfall%20plots%20provide%20detailed%20information%20on%20magnitude%20of%20response%20to%20conventional%20chemotherapy%20in%20colorectal%20cancer%3a%20Lessons%20learned%20from%20N9741.&Key=vm_45_3_26_265&SpeakerName=%3b%20Presenter%3a%20Axel%20Grothey%2c%20MD&mediaURL=%2fmedia&ServerName=media.asco.org&max=12&ext=jpg&useASX=false&playtype=&playtype=&playtype=,
>
> The link is pretty long but it takes you right to the presentation.

Is this really an effective means of describing the distribution of
percent change in tumour size?  Wouldn't a histogram display the
distribution more effectively?

Hadley

-- 
http://had.co.nz/

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


Re: [R] Help needed with Waterfall plot

2008-11-01 Thread Gabor Grothendieck
On Sat, Nov 1, 2008 at 10:32 AM, hadley wickham <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 31, 2008 at 11:25 AM, Philip Twumasi-Ankrah
> <[EMAIL PROTECTED]> wrote:
>> Hi friends,
>> I need suggestions/directions on how to producing a waterfall plot for 
>> present extend of change in tumour size for a set of respondents in a study. 
>>  Example of use of waterfall plot is in the following slides presented at 
>> ASCO 2007 by Axel Grothey. Link is
>>
>> http://media.asco.org/player/default.aspx?LectureID=AG265&conferenceFolder=GI2007&SessionFolder=Poster&slideonly=yes&TrackID=N929&LectureTitle=Waterfall%20plots%20provide%20detailed%20information%20on%20magnitude%20of%20response%20to%20conventional%20chemotherapy%20in%20colorectal%20cancer%3a%20Lessons%20learned%20from%20N9741.&Key=vm_45_3_26_265&SpeakerName=%3b%20Presenter%3a%20Axel%20Grothey%2c%20MD&mediaURL=%2fmedia&ServerName=media.asco.org&max=12&ext=jpg&useASX=false&playtype=&playtype=&playtype=,
>>
>> The link is pretty long but it takes you right to the presentation.
>
> Is this really an effective means of describing the distribution of
> percent change in tumour size?  Wouldn't a histogram display the
> distribution more effectively?

The waterfall does have the advantage of displaying the raw data whereas
a histogram involves summarization.  If you meant displaying the raw
data using histogram style then that would not be as pretty but does show
the individual raw data points more distinctly.

My prior post can be adapted to that by replacing the barplot
line with plot(..., type = "h").  (Also used a better scheme for the
gray shades and corrected the legend.)

# random data
set.seed(1)
growth <- sort(runif(215, -100, 100), decreasing = TRUE)

col <- factor(1 + (growth < -25) + (growth < 25), lab = gray(1:3/5))
plot(growth, type = "h", col = levels(col)[col], ylab = "% Growth",
   main = "Random Data", xlab = "", ylim = c(-100, 100))
legend("topright", legend = c("> 25%", "25% > . > -25%", "< -25%"),
   cex = 0.8, bty = "n", fill = levels(col))

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


Re: [R] Help needed with Waterfall plot

2008-11-01 Thread David Winsemius


On Nov 1, 2008, at 10:32 AM, hadley wickham wrote:


On Fri, Oct 31, 2008 at 11:25 AM, Philip Twumasi-Ankrah
<[EMAIL PROTECTED]> wrote:

Hi friends,
I need suggestions/directions on how to producing a waterfall plot  
for present extend of change in tumour size for a set of  
respondents in a study.  Example of use of waterfall plot is in the  
following slides presented at ASCO 2007 by Axel Grothey. Link is


http://media.asco.org/player/default.aspx?LectureID=AG265&conferenceFolder=GI2007&SessionFolder=Poster&slideonly=yes&TrackID=N929&LectureTitle=Waterfall%20plots%20provide%20detailed%20information%20on%20magnitude%20of%20response%20to%20conventional%20chemotherapy%20in%20colorectal%20cancer%3a%20Lessons%20learned%20from%20N9741.&Key=vm_45_3_26_265&SpeakerName=%3b%20Presenter%3a%20Axel%20Grothey%2c%20MD&mediaURL=%2fmedia&ServerName=media.asco.org&max=12&ext=jpg&useASX=false&playtype=&playtype=&playtype= 
,


The link is pretty long but it takes you right to the presentation.


Is this really an effective means of describing the distribution of
percent change in tumour size?  Wouldn't a histogram display the
distribution more effectively?




Isn't it just a CDF rotated 90 degrees to clockwise?

--
DavidWinsemius



Hadley

--
http://had.co.nz/

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


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


Re: [R] Help needed on R output

2009-05-25 Thread Linlin Yan
> t <- c(
+ "",
+ "01001001011011101100",
+ "1001001011010101",
+ "1101110100000011",
+ "000100100101001001011001",
+ "000101101101101001101001")
> {
+ cat ('rom_array := (\n');
+ for (i in 1:length(t)) {
+   cat('"', t[i], '"',
+ ifelse(i == length(t), '', ',\n'), sep='')
+ };
+ cat(')\n');
+ }
rom_array := (
"",
"01001001011011101100",
"1001001011010101",
"1101110100000011",
"000100100101001001011001",
"000101101101101001101001")
>

On Tue, May 26, 2009 at 12:30 PM, peng chen  wrote:
> Hi, R experts:
>
> I am trying to generate data output in the following format:
>
> rom_array := (
> "",
> "01001001011011101100",
> "1001001011010101",
> "1101110100000011",
> "000100100101001001011001",
> "000101101101101001101001")
>
> I have all the necessary data line, however, I am having trouble generating
> the double quotation marks along with the trailing comma for each line.
>
> Anyone can help?
>
> 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.


Re: [R] Help needed on R output

2009-05-26 Thread Jim Lemon

peng chen wrote:

Hi, R experts:

I am trying to generate data output in the following format:

rom_array := (
"",
"01001001011011101100",
"1001001011010101",
"1101110100000011",
"000100100101001001011001",
"000101101101101001101001")

I have all the necessary data line, however, I am having trouble generating
the double quotation marks along with the trailing comma for each line.

  

Hi Peng and others,
I assumed that you wanted to generate that (Pascal?) expression and you 
have a character or binary numeric vector of the six elements. Say that 
vector is named "binaryvector".


cat("rom_array := (\n")
ends<-c(rep("\",\n",5),"\")\n")
for(i in 1:length(binaryvector))
cat("\"",binaryvector[i],ends[i],sep="")

should do what you want. However, I have two questions:

1) Why does cat put a newline at the end of a call with a sep argument 
with a newline in it? It doesn't put the sep argument after the last 
element of the vector, even though the help page says that it does.


2) The help page reads:

sep   a character vector of strings to append after each element.

but cat clearly uses only the first string of the vector. Am I reading 
this wrongly?


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] Help needed on R output

2009-05-26 Thread Adrian Dusa


A simpler solution:
my.string <- c("",
"01001001011011101100",
"1001001011010101",
"1101110100000011",
"000100100101001001011001",
"000101101101101001101001")

my.string <- paste(my.string, collapse="\",\n\"")

cat(paste("rom_array := (\n\"", my.string, "\")\n", sep=""))

Which produces:
rom_array := (
"",
"01001001011011101100",
"1001001011010101",
"1101110100000011",
"000100100101001001011001",
"000101101101101001101001")

Search in the archives for character escaping to understand the syntax.

A simple example (notice the gradual additions):
aa <- "010"
cat(aa) # 010

bb <- "\"010"
cat(bb) # "010

cc <- "\"010\""
cat(cc) # "010"

Also read the help for ?paste, and notice the difference between the "sep"
and "collapse" arguments.

Hth,
Adrian



Linlin Yan wrote:
> 
>> t <- c(
> + "",
> + "01001001011011101100",
> + "1001001011010101",
> + "1101110100000011",
> + "000100100101001001011001",
> + "000101101101101001101001")
>> {
> + cat ('rom_array := (\n');
> + for (i in 1:length(t)) {
> +   cat('"', t[i], '"',
> + ifelse(i == length(t), '', ',\n'), sep='')
> + };
> + cat(')\n');
> + }
> rom_array := (
> "",
> "01001001011011101100",
> "1001001011010101",
> "1101110100000011",
> "000100100101001001011001",
> "000101101101101001101001")
>>
> 
> On Tue, May 26, 2009 at 12:30 PM, peng chen 
> wrote:
>> Hi, R experts:
>>
>> I am trying to generate data output in the following format:
>>
>> rom_array := (
>> "",
>> "01001001011011101100",
>> "1001001011010101",
>> "1101110100000011",
>> "000100100101001001011001",
>> "000101101101101001101001")
>>
>> I have all the necessary data line, however, I am having trouble
>> generating
>> the double quotation marks along with the trailing comma for each line.
>>
>> Anyone can help?
>>
>> 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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Help-needed-on-R-output-tp23716736p23720449.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help needed on R output

2009-05-26 Thread peng chen
Thanks.

I am sorry that I did not clearly put my question.

I need to output the array like
 t <- c(
+ "",
+ "01001001011011101100",
+ "1001001011010101",
+ "1101110100000011",
+ "000100100101001001011001",
+ "000101101101101001101001")

to a datafile(e.g., .txt file) where each line is for a binary number in
this format:
"",
"01001001011011101100",


I was trying to use R-function write.table, however, I wasn't able to get
the trailing comma for each line(although I can get the double quotation
marks).

Thanks.





On Tue, May 26, 2009 at 12:46 AM, Linlin Yan  wrote:

> > t <- c(
> + "",
> + "01001001011011101100",
> + "1001001011010101",
> + "1101110100000011",
> + "000100100101001001011001",
> + "000101101101101001101001")
> > {
> + cat ('rom_array := (\n');
> + for (i in 1:length(t)) {
> +   cat('"', t[i], '"',
> + ifelse(i == length(t), '', ',\n'), sep='')
> + };
> + cat(')\n');
> + }
> rom_array := (
> "",
> "01001001011011101100",
> "1001001011010101",
> "1101110100000011",
> "000100100101001001011001",
> "000101101101101001101001")
> >
>
>  On Tue, May 26, 2009 at 12:30 PM, peng chen 
> wrote:
> > Hi, R experts:
> >
> > I am trying to generate data output in the following format:
> >
> > rom_array := (
> > "",
> > "01001001011011101100",
> > "1001001011010101",
> > "1101110100000011",
> > "000100100101001001011001",
> > "000101101101101001101001")
> >
> > I have all the necessary data line, however, I am having trouble
> generating
> > the double quotation marks along with the trailing comma for each line.
> >
> > Anyone can help?
> >
> > 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.
> >
>

[[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] Help needed on R output

2009-05-26 Thread jim holtman
If you want to create that output in a file, then create one long string and
use 'cat' to output; here is an example with the output to the console:

> t <- c(
+ "",
+ "01001001011011101100",
+ "1001001011010101",
+ "1101110100000011",
+ "000100100101001001011001",
+ "000101101101101001101001")
> # create one long string and then use 'cat' to write it out
> long <- paste('"', paste(t, collapse='",\n"'), '"', sep='')
>
>
> cat(long)
"",
"01001001011011101100",
"1001001011010101",
"1101110100000011",
"000100100101001001011001",
"000101101101101001101001">

On Tue, May 26, 2009 at 9:33 AM, peng chen  wrote:

> Thanks.
>
> I am sorry that I did not clearly put my question.
>
> I need to output the array like
>  t <- c(
> + "",
> + "01001001011011101100",
> + "1001001011010101",
> + "1101110100000011",
> + "000100100101001001011001",
> + "000101101101101001101001")
>
> to a datafile(e.g., .txt file) where each line is for a binary number in
> this format:
> "",
> "01001001011011101100",
> 
>
> I was trying to use R-function write.table, however, I wasn't able to get
> the trailing comma for each line(although I can get the double quotation
> marks).
>
> Thanks.
>
>
>
>
>
> On Tue, May 26, 2009 at 12:46 AM, Linlin Yan 
> wrote:
>
> > > t <- c(
> > + "",
> > + "01001001011011101100",
> > + "1001001011010101",
> > + "1101110100000011",
> > + "000100100101001001011001",
> > + "000101101101101001101001")
> > > {
> > + cat ('rom_array := (\n');
> > + for (i in 1:length(t)) {
> > +   cat('"', t[i], '"',
> > + ifelse(i == length(t), '', ',\n'), sep='')
> > + };
> > + cat(')\n');
> > + }
> > rom_array := (
> > "",
> > "01001001011011101100",
> > "1001001011010101",
> > "1101110100000011",
> > "000100100101001001011001",
> > "000101101101101001101001")
> > >
> >
> >  On Tue, May 26, 2009 at 12:30 PM, peng chen 
> > wrote:
> > > Hi, R experts:
> > >
> > > I am trying to generate data output in the following format:
> > >
> > > rom_array := (
> > > "",
> > > "01001001011011101100",
> > > "1001001011010101",
> > > "1101110100000011",
> > > "000100100101001001011001",
> > > "000101101101101001101001")
> > >
> > > I have all the necessary data line, however, I am having trouble
> > generating
> > > the double quotation marks along with the trailing comma for each line.
> > >
> > > Anyone can help?
> > >
> > > 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.
> > >
> >
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

What is the problem that you are trying to solve?

[[alternative HTML version deleted]]

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


Re: [R] Help needed on R output

2009-05-26 Thread Linlin Yan
Did you mean this:

> write.table(t, eol=",\n", row.names=FALSE, col.names=FALSE)
"",
"01001001011011101100",
"1001001011010101",
"1101110100000011",
"000100100101001001011001",
"000101101101101001101001",

Try ?write.table to get the detail of the function please.

On Tue, May 26, 2009 at 9:33 PM, peng chen  wrote:
> Thanks.
>
> I am sorry that I did not clearly put my question.
>
> I need to output the array like
>  t <- c(
> + "",
> + "01001001011011101100",
> + "1001001011010101",
> + "1101110100000011",
> + "000100100101001001011001",
> + "000101101101101001101001")
>
> to a datafile(e.g., .txt file) where each line is for a binary number in
> this format:
> "",
> "01001001011011101100",
> 
>
> I was trying to use R-function write.table, however, I wasn't able to get
> the trailing comma for each line(although I can get the double quotation
> marks).
>
> 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 needed: Fraction for Histogram > 1 ???

2009-06-22 Thread charles78

I have been trying to draw histogram for my manscript and found some strange
things that I could not figure out why.

Using the same code listed below I have successfully draw histograms for a
few figures with fraction labeled on Y axis less than 1 (acturally between 0
to 0.1).  But one dataset gives the Y axis label 0 to 5 as fraction.  This
is not true, as fraction are less than 1, although the value distribution on
the figure seems to me is right.

The only difference between the first few datasets and last dataset is:

All values for the first few data sets > 1.

The values for the last data sets between 0 and <1.

Any idea why this happens.

Your help is highly appreciated.  

Charles

===
postscript("Figure.eps", paper="letter", horizontal=FALSE)
par(mfrow=c(3,3))
par(omi=c(2,0.2,1.8,0.2), mai=c(0.4, 0.4, 0.5, 0.1) )

my.input <- read.table("input.data", header=FALSE, sep="\t")
my.input.exp <- read.table("exp.data", header=FALSE, sep="\t")

hist(my.input.exp[,2], breaks=40,freq = FALSE,xlab="", border = "grey30",
ylab="", main="")
hist(my.input[,2], breaks=40,freq = FALSE,xlab="", ylab="", main="", border
= "red",add =TRUE)
mtext("Fraction", side=2, line=2, cex=0.7)
box()
==
-- 
View this message in context: 
http://www.nabble.com/Help-needed%3A-Fraction-for-Histogram-%3E-1-tp24150345p24150345.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 needed for HWE.exact in library "genetics"

2008-08-21 Thread Sun, Ying [BSD] - HGD
Hi,

I have a genotype data for both case and controls and would like to calculate 
the HW p-value.  However, since the number of one genotype is 0, I got wired 
result.  Would someone help me to figure it out?  Or confirm it's right?  
Thanks a lot.


> library( "genetics" )
NOTE: THIS PACKAGE IS NOW OBSOLETE.
  The R-Genetics project has developed an set of enhanced genetics
  packages to replace 'genetics'. Please visit the project homepage
  at http://rgenetics.org for informtion.
> case.data  <- 
> c("G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","A/G","A/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G
/G","G/G","A/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","A/G","G/G","A/G","G/G","G/G
","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","A/G","G/G","G/G","G/G","A/G","G/G","G/G","G/G","A/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","A/G","G/G","G/G",
"G/G","G/G","G/G")
> g1 <- genotype(case.data)
> g1
 [1] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/A" "G/A"
[13] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
[25] "G/G" "G/G" "G/G" "G/G" "G/A" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
[37] "G/G" "G/G" "G/G" "G/A" "G/G" "G/A" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
[49] "G/G" "G/G" "G/G" "G/G" "G/A" "G/G" "G/G" "G/G" "G/A" "G/G" "G/G" "G/G"
[61] "G/A" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
[73] "G/G" "G/G" "G/A" "G/G" "G/G" "G/G" "G/G" "G/G"
Alleles: G A 
> HWE.exact(g1)
Exact Test for Hardy-Weinberg Equilibrium
data:  g1 
N11 = 71, N12 = 9, N22 = 0, N1 = 151, N2 = 9, p-value = 1
> control.data  <- 
c("G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","A/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","A/G"
,"G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","
G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","A/G","G/G","G/
G","G/G","G/G","G/G","G/G","A/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","A/G","G/G","G/G"
,"G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","G/G","
G/G","G/G","G/G","G/G","G+ /G","G/G","G/G","G/G","G/G","G/G")
> g2 <- genotype(control.data)
> g2
  [1] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
 [13] "G/G" "G/G" "G/G" "G/A" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
 [25] "G/G" "G/G" "G/G" "G/G" "G/G" "G/A" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
 [37] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
 [49] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
 [61] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
 [73] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
 [85] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/A" "G/G"
 [97] "G/G" "G/G" "G/G" "G/G" "G/G" "G/A" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
[109] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
[121] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/A" "G/G" "G/G" "G/G" "G/G"
[133] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
[145] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
[157] "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G" "G/G"
[169] "G/G" "G/G" "G/G" "G/G" "G/G"
Alleles: G A 
> HWE.exact(g2)
Exact Test for Hardy-Weinberg Equilibrium
data:  g2 
N11 = 168, N12 = 5, N22 = 0, N1 = 341, N2 = 5, p-value = 1


Becky




This email is intended only for the use of the individua...{{dropped:12}}

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

2008-01-03 Thread jeevitesh
Dear all,
I'm using friedman rank test in R. I need to know which P value
is used default and procedure to change the threshold P value.
With regards
jeevitesh

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


Re: [R] Help needed for Loading "tm" package

2009-01-10 Thread Prof Brian Ripley

On Sat, 10 Jan 2009, Kum-Hoe Hwang wrote:


Howdy Gurus again

Thanks to  Tony.Breyal, I was able to writing the following script for
analyzing a text document.
But I got an error with "tm' package. I don't why I got the error from the R
script below. I think I followed proccess of R tm manual.


Please do read the messages you got.  I see


Error in .jinit(system.file("jar", c("weka.jar", "RWeka.jar"), package =
pkgname,  :
 Cannot create Java virtual machine (-1)


so the problem is with your Java installation and RWeka, not 'tm'.

First make sure you have a working installation of RWeka -- I suspect 
you do not even have Java installed, but it could be a version or path 
issue (but very unlikely to be an R issue).




I use R v2.8.1. and tm_0.3-3.zip under Win XP.

Thanks in advance,

Kum Hwang


# setting directory
my.path <-'C:\\_work\\Daddy"s\\myProjects\\2009

defaultProject\\R\\textfile\\'


# text miner pakacge
library(tm)

Loading required package: Snowball
Loading required package: RWeka
-
Error in .jinit(system.file("jar", c("weka.jar", "RWeka.jar"), package =
pkgname,  :
 Cannot create Java virtual machine (-1)
Error : .onLoad failed in 'loadNamespace' for 'RWeka'
Error: package 'RWeka' could not be loaded

my.corpurs <-Corpus(DirSource(my.path), readerControl =

list(reader=readPlain))
Error: could not find function "Corpus"

my.tdm <- TermDocMatrix(my.corpus)

Error: could not find function "TermDocMatrix"

my.tdm[1,]

Error: object "my.tdm" not found


--
Kum-Hoe Hwang, Ph.D.

Phone : 82-31-250-3516
Email : phdhw...@gmail.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.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] Help needed for Loading "tm" package

2009-01-11 Thread Kum-Hoe Hwang
Thank Prof. Brian Ripley for your comments.

Based on Prof Brian Ripley's comments, I checked Java environments in
my PC. But I have not solved a "tm" package problem in Win R software.
I am not sure but my current conclusion is that the Win-based R binary
software has definitely a problem with Rweka package or subpackage.

Should I wait for another upgraded R binary version under the window
XP, "tm' package or Rweka ets?
Or I'd better migrate to non-window OS such as Linux, etc?

Kum Hwang, Ph.D.

On Sat, Jan 10, 2009 at 8:06 PM, Prof Brian Ripley
 wrote:
> On Sat, 10 Jan 2009, Kum-Hoe Hwang wrote:
>
>> Howdy Gurus again
>>
>> Thanks to  Tony.Breyal, I was able to writing the following script for
>> analyzing a text document.
>> But I got an error with "tm' package. I don't why I got the error from the
>> R
>> script below. I think I followed proccess of R tm manual.
>
> Please do read the messages you got.  I see
>
>> Error in .jinit(system.file("jar", c("weka.jar", "RWeka.jar"), package =
>> pkgname,  :
>>  Cannot create Java virtual machine (-1)
>
> so the problem is with your Java installation and RWeka, not 'tm'.
>
> First make sure you have a working installation of RWeka -- I suspect you do
> not even have Java installed, but it could be a version or path issue (but
> very unlikely to be an R issue).
>
>>
>> I use R v2.8.1. and tm_0.3-3.zip under Win XP.
>>
>> Thanks in advance,
>>
>> Kum Hwang
>>
>>> # setting directory
>>> my.path <-'C:\\_work\\Daddy"s\\myProjects\\2009
>>
>> defaultProject\\R\\textfile\\'
>>>
>>> # text miner pakacge
>>> library(tm)
>>
>> Loading required package: Snowball
>> Loading required package: RWeka
>> -
>> Error in .jinit(system.file("jar", c("weka.jar", "RWeka.jar"), package =
>> pkgname,  :
>>  Cannot create Java virtual machine (-1)
>> Error : .onLoad failed in 'loadNamespace' for 'RWeka'
>> Error: package 'RWeka' could not be loaded
>>>
>>> my.corpurs <-Corpus(DirSource(my.path), readerControl =
>>
>> list(reader=readPlain))
>> Error: could not find function "Corpus"
>>>
>>> my.tdm <- TermDocMatrix(my.corpus)
>>
>> Error: could not find function "TermDocMatrix"
>>>
>>> my.tdm[1,]
>>
>> Error: object "my.tdm" not found
>>
>>
>> --
>> Kum-Hoe Hwang, Ph.D.
>>
>> Phone : 82-31-250-3516
>> Email : phdhw...@gmail.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.
>>
>
> --
> Brian D. Ripley,  rip...@stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
>



-- 
Kum-Hoe Hwang, Ph.D.

Phone : 82-31-250-3516
Email : phdhw...@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] Help needed for Loading "tm" package

2009-01-12 Thread Prof Brian Ripley
How do you account for the fact that the package passed its checks on 
the build machine, e.g.


http://cran.r-project.org/bin/windows/contrib/2.8/check/RWeka-check.log

and no one else is reporting this?  (And it does work for me.)

Blaming your tools is easy, but doing so on a public forum is 
disrespectful and against the rw-FAQ


http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Can-I-install-packages-into-libraries-in-this-version_003f

(note the word 'unsupported').

Uwe Ligges does a great job helping Windows' users by building binary 
packages, and deserves your thanks, not vague and unsubstantiated 
blame.


On Mon, 12 Jan 2009, Kum-Hoe Hwang wrote:


Thank Prof. Brian Ripley for your comments.

Based on Prof Brian Ripley's comments, I checked Java environments in
my PC. But I have not solved a "tm" package problem in Win R software.
I am not sure but my current conclusion is that the Win-based R binary
software has definitely a problem with Rweka package or subpackage.



Should I wait for another upgraded R binary version under the window
XP, "tm' package or Rweka ets?
Or I'd better migrate to non-window OS such as Linux, etc?


You definitely shou;d read and follow the FAQ, as this could well be a 
Java incompatibility with the binary package.



Kum Hwang, Ph.D.

On Sat, Jan 10, 2009 at 8:06 PM, Prof Brian Ripley
 wrote:

On Sat, 10 Jan 2009, Kum-Hoe Hwang wrote:


Howdy Gurus again

Thanks to  Tony.Breyal, I was able to writing the following script for
analyzing a text document.
But I got an error with "tm' package. I don't why I got the error from the
R
script below. I think I followed proccess of R tm manual.


Please do read the messages you got.  I see


Error in .jinit(system.file("jar", c("weka.jar", "RWeka.jar"), package =
pkgname,  :
 Cannot create Java virtual machine (-1)


so the problem is with your Java installation and RWeka, not 'tm'.

First make sure you have a working installation of RWeka -- I suspect you do
not even have Java installed, but it could be a version or path issue (but
very unlikely to be an R issue).



I use R v2.8.1. and tm_0.3-3.zip under Win XP.

Thanks in advance,

Kum Hwang


# setting directory
my.path <-'C:\\_work\\Daddy"s\\myProjects\\2009


defaultProject\\R\\textfile\\'


# text miner pakacge
library(tm)


Loading required package: Snowball
Loading required package: RWeka
-
Error in .jinit(system.file("jar", c("weka.jar", "RWeka.jar"), package =
pkgname,  :
 Cannot create Java virtual machine (-1)
Error : .onLoad failed in 'loadNamespace' for 'RWeka'
Error: package 'RWeka' could not be loaded


my.corpurs <-Corpus(DirSource(my.path), readerControl =


list(reader=readPlain))
Error: could not find function "Corpus"


my.tdm <- TermDocMatrix(my.corpus)


Error: could not find function "TermDocMatrix"


my.tdm[1,]


Error: object "my.tdm" not found


--
Kum-Hoe Hwang, Ph.D.

Phone : 82-31-250-3516
Email : phdhw...@gmail.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.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595





--
Kum-Hoe Hwang, Ph.D.

Phone : 82-31-250-3516
Email : phdhw...@gmail.com



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] Help needed for Loading "tm" package

2009-01-12 Thread Kum-Hoe Hwang
I appreciate alll helpers for R.

I have struggled with Rweka problem related with "tm" text mining package in R.

My problem was solved when I replaced RWeka_0.3-15.zip with
RWeka_0.3-13.zip under the OS of Win XP.
Now my tm package works fine in R. I don't know why it works.

Thanks all who gave me good help

Kum Hwang Ph.D.

On Mon, Jan 12, 2009 at 5:19 PM, Prof Brian Ripley
 wrote:
> How do you account for the fact that the package passed its checks on the
> build machine, e.g.
>
> http://cran.r-project.org/bin/windows/contrib/2.8/check/RWeka-check.log
>
> and no one else is reporting this?  (And it does work for me.)
>
> Blaming your tools is easy, but doing so on a public forum is disrespectful
> and against the rw-FAQ
>
> http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Can-I-install-packages-into-libraries-in-this-version_003f
>
> (note the word 'unsupported').
>
> Uwe Ligges does a great job helping Windows' users by building binary
> packages, and deserves your thanks, not vague and unsubstantiated blame.
>
> On Mon, 12 Jan 2009, Kum-Hoe Hwang wrote:
>
>> Thank Prof. Brian Ripley for your comments.
>>
>> Based on Prof Brian Ripley's comments, I checked Java environments in
>> my PC. But I have not solved a "tm" package problem in Win R software.
>> I am not sure but my current conclusion is that the Win-based R binary
>> software has definitely a problem with Rweka package or subpackage.
>
>> Should I wait for another upgraded R binary version under the window
>> XP, "tm' package or Rweka ets?
>> Or I'd better migrate to non-window OS such as Linux, etc?
>
> You definitely shou;d read and follow the FAQ, as this could well be a Java
> incompatibility with the binary package.
>
>> Kum Hwang, Ph.D.
>>
>> On Sat, Jan 10, 2009 at 8:06 PM, Prof Brian Ripley
>>  wrote:
>>>
>>> On Sat, 10 Jan 2009, Kum-Hoe Hwang wrote:
>>>
 Howdy Gurus again

 Thanks to  Tony.Breyal, I was able to writing the following script for
 analyzing a text document.
 But I got an error with "tm' package. I don't why I got the error from
 the
 R
 script below. I think I followed proccess of R tm manual.
>>>
>>> Please do read the messages you got.  I see
>>>
 Error in .jinit(system.file("jar", c("weka.jar", "RWeka.jar"), package =
 pkgname,  :
  Cannot create Java virtual machine (-1)
>>>
>>> so the problem is with your Java installation and RWeka, not 'tm'.
>>>
>>> First make sure you have a working installation of RWeka -- I suspect you
>>> do
>>> not even have Java installed, but it could be a version or path issue
>>> (but
>>> very unlikely to be an R issue).
>>>

 I use R v2.8.1. and tm_0.3-3.zip under Win XP.

 Thanks in advance,

 Kum Hwang

> # setting directory
> my.path <-'C:\\_work\\Daddy"s\\myProjects\\2009

 defaultProject\\R\\textfile\\'
>
> # text miner pakacge
> library(tm)

 Loading required package: Snowball
 Loading required package: RWeka
 -
 Error in .jinit(system.file("jar", c("weka.jar", "RWeka.jar"), package =
 pkgname,  :
  Cannot create Java virtual machine (-1)
 Error : .onLoad failed in 'loadNamespace' for 'RWeka'
 Error: package 'RWeka' could not be loaded
>
> my.corpurs <-Corpus(DirSource(my.path), readerControl =

 list(reader=readPlain))
 Error: could not find function "Corpus"
>
> my.tdm <- TermDocMatrix(my.corpus)

 Error: could not find function "TermDocMatrix"
>
> my.tdm[1,]

 Error: object "my.tdm" not found


 --
 Kum-Hoe Hwang, Ph.D.

 Phone : 82-31-250-3516
 Email : phdhw...@gmail.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.

>>>
>>> --
>>> Brian D. Ripley,  rip...@stats.ox.ac.uk
>>> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
>>> University of Oxford, Tel:  +44 1865 272861 (self)
>>> 1 South Parks Road, +44 1865 272866 (PA)
>>> Oxford OX1 3TG, UKFax:  +44 1865 272595
>>>
>>
>>
>>
>> --
>> Kum-Hoe Hwang, Ph.D.
>>
>> Phone : 82-31-250-3516
>> Email : phdhw...@gmail.com
>>
>
> --
> Brian D. Ripley,  rip...@stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
>



-- 
Kum-Hoe Hwang, Ph.D.

Phone : 82-31-250-3516
Email : phdhw...@gmail.com

__
R-

Re: [R] help needed: Plotting step by step.

2008-04-23 Thread Greg Snow
Can you show us the code you used for the 5 to 10 points? (either
generate some random data, or use a sample dataset).

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Atul Kulkarni
> Sent: Wednesday, April 23, 2008 9:07 AM
> To: r-help@r-project.org
> Subject: [R] help needed: Plotting step by step.
> 
> Hello,
> 
> I have generated 2 Poisson processes and want to plot them on 
> a single graph in a step by step manner in order to be able 
> to compare them. I tried plot and biplot but it does not 
> help, I could connect two points by hand for point graph if 
> they were 5 or 10 I have more than 200 such point to be 
> connected and Poisson cluster makes it difficult for me to 
> even read them properly.
> 
> Can anyone tell me which is the function that can plot a 
> stepwise graph for me? I did google over the plot for step 
> fun but did not understand much of it. A simpler help would 
> be more useful to me, as I am not a expert either in Statistics or R.
> 
> Regards,
> Atul.
> 
> --
> Atul S. Kulkarni
> Graduate Student,
> Department of Computer Science,
> University Of Minnesota,
> Duluth, MN 55812.
> www.d.umn.edu/~kulka053
> -
> "Before you start some work, always ask yourself three 
> questions - Why am I doing it, What the results might be and 
> Will I be successful. Only when you think deeply and find 
> satisfactory answers to these questions, go ahead."
> Chanakya quotes (Indian politician, strategist and writer, 
> 350 BC-275 BC)
> 
>   [[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] help needed: Plotting step by step.

2008-04-23 Thread Charles C. Berry

Maybe like this?

> proc.1 <- rexp(200,1)
> proc.2 <- rexp(200,2)
> plot( ecdf( proc.1 ), xlim=range( proc.1, proc.2 ) )
> plot( ecdf( proc.2 ), add=T, col.points='red' )
>

See

?ecdf
?plot.stepfun


HTH,

Chuck

On Wed, 23 Apr 2008, Greg Snow wrote:

> Can you show us the code you used for the 5 to 10 points? (either
> generate some random data, or use a sample dataset).
>
> -- 
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> [EMAIL PROTECTED]
> (801) 408-8111
>
>
>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Atul Kulkarni
>> Sent: Wednesday, April 23, 2008 9:07 AM
>> To: r-help@r-project.org
>> Subject: [R] help needed: Plotting step by step.
>>
>> Hello,
>>
>> I have generated 2 Poisson processes and want to plot them on
>> a single graph in a step by step manner in order to be able
>> to compare them. I tried plot and biplot but it does not
>> help, I could connect two points by hand for point graph if
>> they were 5 or 10 I have more than 200 such point to be
>> connected and Poisson cluster makes it difficult for me to
>> even read them properly.
>>
>> Can anyone tell me which is the function that can plot a
>> stepwise graph for me? I did google over the plot for step
>> fun but did not understand much of it. A simpler help would
>> be more useful to me, as I am not a expert either in Statistics or R.
>>
>> Regards,
>> Atul.
>>
>> --
>> Atul S. Kulkarni
>> Graduate Student,
>> Department of Computer Science,
>> University Of Minnesota,
>> Duluth, MN 55812.
>> www.d.umn.edu/~kulka053
>> -
>> "Before you start some work, always ask yourself three
>> questions - Why am I doing it, What the results might be and
>> Will I be successful. Only when you think deeply and find
>> satisfactory answers to these questions, go ahead."
>> Chanakya quotes (Indian politician, strategist and writer,
>> 350 BC-275 BC)
>>
>>  [[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.
>

Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

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


Re: [R] help needed: Plotting step by step.

2008-04-24 Thread Charles C. Berry
On Thu, 24 Apr 2008, Atul Kulkarni wrote:

> Hi,
>
> Thanks for help.
>
> The ecdf has jumps of 1/n but I need jumps of 1. How do I do this? if I can

See
?stepfun

HTH,

Chuck
> do this then I think Ic an plot the data properly. I am plotting epidemic
> simulation and want to plot my 2 processes Infection and Symptoms (after
> incubation) on the same chart to compare them.
>
> Atul.
>
> On Wed, Apr 23, 2008 at 12:35 PM, Charles C. Berry <[EMAIL PROTECTED]>
> wrote:
>
>>
>> Maybe like this?
>>
>>  proc.1 <- rexp(200,1)
>>> proc.2 <- rexp(200,2)
>>> plot( ecdf( proc.1 ), xlim=range( proc.1, proc.2 ) )
>>> plot( ecdf( proc.2 ), add=T, col.points='red' )
>>>
>>>
>> See
>>
>>?ecdf
>>?plot.stepfun
>>
>>
>> HTH,
>>
>> Chuck
>>
>>
>> On Wed, 23 Apr 2008, Greg Snow wrote:
>>
>>  Can you show us the code you used for the 5 to 10 points? (either
>>> generate some random data, or use a sample dataset).
>>>
>>> --
>>> Gregory (Greg) L. Snow Ph.D.
>>> Statistical Data Center
>>> Intermountain Healthcare
>>> [EMAIL PROTECTED]
>>> (801) 408-8111
>>>
>>>
>>>
>>>  -Original Message-
>>>> From: [EMAIL PROTECTED]
>>>> [mailto:[EMAIL PROTECTED] On Behalf Of Atul Kulkarni
>>>> Sent: Wednesday, April 23, 2008 9:07 AM
>>>> To: r-help@r-project.org
>>>> Subject: [R] help needed: Plotting step by step.
>>>>
>>>> Hello,
>>>>
>>>> I have generated 2 Poisson processes and want to plot them on
>>>> a single graph in a step by step manner in order to be able
>>>> to compare them. I tried plot and biplot but it does not
>>>> help, I could connect two points by hand for point graph if
>>>> they were 5 or 10 I have more than 200 such point to be
>>>> connected and Poisson cluster makes it difficult for me to
>>>> even read them properly.
>>>>
>>>> Can anyone tell me which is the function that can plot a
>>>> stepwise graph for me? I did google over the plot for step
>>>> fun but did not understand much of it. A simpler help would
>>>> be more useful to me, as I am not a expert either in Statistics or R.
>>>>
>>>> Regards,
>>>> Atul.
>>>>
>>>> --
>>>> Atul S. Kulkarni
>>>> Graduate Student,
>>>> Department of Computer Science,
>>>> University Of Minnesota,
>>>> Duluth, MN 55812.
>>>> www.d.umn.edu/~kulka053 <http://www.d.umn.edu/%7Ekulka053>
>>>> -
>>>> "Before you start some work, always ask yourself three
>>>> questions - Why am I doing it, What the results might be and
>>>> Will I be successful. Only when you think deeply and find
>>>> satisfactory answers to these questions, go ahead."
>>>> Chanakya quotes (Indian politician, strategist and writer,
>>>> 350 BC-275 BC)
>>>>
>>>>[[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.
>>>
>>>
>> Charles C. Berry(858) 534-2098
>>Dept of Family/Preventive
>> Medicine
>> E mailto:[EMAIL PROTECTED]   UC San Diego
>> http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901
>>
>>
>>
>
>
> -- 
> Atul S. Kulkarni
> Graduate Student,
> Department of Computer Science,
> University Of Minnesota,
> Duluth, MN 55812.
> www.d.umn.edu/~kulka053
> -
> "Before you start some work, always ask yourself three questions - Why am I
> doing it, What the results might be and Will I be successful. Only when you
> think deeply and find satisfactory answers to these questions, go ahead."
> Chanakya quotes (Indian politician, strategist and writer, 350 BC-275 BC)
>

Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

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


Re: [R] help needed: Plotting step by step.

2008-04-24 Thread Atul Kulkarni
Hi,

Thanks for help.

The ecdf has jumps of 1/n but I need jumps of 1. How do I do this? if I can
do this then I think Ic an plot the data properly. I am plotting epidemic
simulation and want to plot my 2 processes Infection and Symptoms (after
incubation) on the same chart to compare them.

Atul.

On Wed, Apr 23, 2008 at 12:35 PM, Charles C. Berry <[EMAIL PROTECTED]>
wrote:

>
> Maybe like this?
>
>  proc.1 <- rexp(200,1)
> > proc.2 <- rexp(200,2)
> > plot( ecdf( proc.1 ), xlim=range( proc.1, proc.2 ) )
> > plot( ecdf( proc.2 ), add=T, col.points='red' )
> >
> >
> See
>
>?ecdf
>?plot.stepfun
>
>
> HTH,
>
> Chuck
>
>
> On Wed, 23 Apr 2008, Greg Snow wrote:
>
>  Can you show us the code you used for the 5 to 10 points? (either
> > generate some random data, or use a sample dataset).
> >
> > --
> > Gregory (Greg) L. Snow Ph.D.
> > Statistical Data Center
> > Intermountain Healthcare
> > [EMAIL PROTECTED]
> > (801) 408-8111
> >
> >
> >
> >  -Original Message-
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On Behalf Of Atul Kulkarni
> > > Sent: Wednesday, April 23, 2008 9:07 AM
> > > To: r-help@r-project.org
> > > Subject: [R] help needed: Plotting step by step.
> > >
> > > Hello,
> > >
> > > I have generated 2 Poisson processes and want to plot them on
> > > a single graph in a step by step manner in order to be able
> > > to compare them. I tried plot and biplot but it does not
> > > help, I could connect two points by hand for point graph if
> > > they were 5 or 10 I have more than 200 such point to be
> > > connected and Poisson cluster makes it difficult for me to
> > > even read them properly.
> > >
> > > Can anyone tell me which is the function that can plot a
> > > stepwise graph for me? I did google over the plot for step
> > > fun but did not understand much of it. A simpler help would
> > > be more useful to me, as I am not a expert either in Statistics or R.
> > >
> > > Regards,
> > > Atul.
> > >
> > > --
> > > Atul S. Kulkarni
> > > Graduate Student,
> > > Department of Computer Science,
> > > University Of Minnesota,
> > > Duluth, MN 55812.
> > > www.d.umn.edu/~kulka053 <http://www.d.umn.edu/%7Ekulka053>
> > > -
> > > "Before you start some work, always ask yourself three
> > > questions - Why am I doing it, What the results might be and
> > > Will I be successful. Only when you think deeply and find
> > > satisfactory answers to these questions, go ahead."
> > > Chanakya quotes (Indian politician, strategist and writer,
> > > 350 BC-275 BC)
> > >
> > >[[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.
> >
> >
> Charles C. Berry(858) 534-2098
>Dept of Family/Preventive
> Medicine
> E mailto:[EMAIL PROTECTED]   UC San Diego
> http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901
>
>
>


-- 
Atul S. Kulkarni
Graduate Student,
Department of Computer Science,
University Of Minnesota,
Duluth, MN 55812.
www.d.umn.edu/~kulka053
-
"Before you start some work, always ask yourself three questions - Why am I
doing it, What the results might be and Will I be successful. Only when you
think deeply and find satisfactory answers to these questions, go ahead."
Chanakya quotes (Indian politician, strategist and writer, 350 BC-275 BC)

[[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 needed on calculation of Moran's I

2007-10-26 Thread Geertje Van der Heijden
Hi,

I am trying to calculate Moran's I test for the residuals for a
regression equation, but I have trouble converting my  coordinates into
nb format.

I have used the dnearneigh() funtion now with an arbitrarily high upper
distance to make it include all plots. However, when I do the
lm.morantest() I get a Moran's I value which is the same as the expected
value and a P-value of 1.

I have used the following code:
>attach(lowland)
>coords <- as.matrix(cbind(long, $lat))
>coord.nb <- dnearneigh(coords, 0, 1 longlat=TRUE)
>coord.list <- nb2listw(coord.nb, style="W")
>lianasp.lm <- lm(lianasprich ~ log(averdist) + dsl + lianadens +
wooddens)
>lm.morantest(lianasp.lm, coord.list, alternative="two.sided")

And get the following result

Global Moran's I for regression residuals

data:  
model: lm(formula = lianasprich ~ log(averdist) + dsl + lianadens +
wooddens)
weights: coord.list
 
Moran I statistic standard deviate = 0, p-value = 1
alternative hypothesis: two.sided 
sample estimates:
Observed Moran's IExpectation   Variance 
 -1.754386e-02  -1.754386e-02   2.125706e-16 

Can anyone tell me where I went wrong or if there is another way to
generate a nb list? 

Many thanks,
Geertje


Geertje van der Heijden
PhD student
Tropical Ecology
School of Geography
University of Leeds
Leeds LS2 9JT

Tel: (+44)(0)113 3433345 
Email: [EMAIL PROTECTED]



[[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] Help needed: Fraction for Histogram > 1 ???

2009-06-22 Thread Greg Snow
When freq=FALSE then the y axis is not the proportion in each group (what I am 
assuming you mean by fraction), but rather is scaled so that the total area of 
the histogram is 1 (making comparing to theoretical densities easier).  If all 
the data values are between 0 and 1, then the height of at least one bar needs 
to be >= 1 for the total area to equal 1.

If you want the y-axis to show relative frequency (proportion, fraction, etc.), 
then you either need to plot the y-axis yourself or use a different function 
than 'hist'.

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


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of charles78
> Sent: Monday, June 22, 2009 10:08 AM
> To: r-help@r-project.org
> Subject: [R] Help needed: Fraction for Histogram > 1 ???
> 
> 
> I have been trying to draw histogram for my manscript and found some
> strange
> things that I could not figure out why.
> 
> Using the same code listed below I have successfully draw histograms
> for a
> few figures with fraction labeled on Y axis less than 1 (acturally
> between 0
> to 0.1).  But one dataset gives the Y axis label 0 to 5 as fraction.
> This
> is not true, as fraction are less than 1, although the value
> distribution on
> the figure seems to me is right.
> 
> The only difference between the first few datasets and last dataset is:
> 
> All values for the first few data sets > 1.
> 
> The values for the last data sets between 0 and <1.
> 
> Any idea why this happens.
> 
> Your help is highly appreciated.
> 
> Charles
> 
> ===
> postscript("Figure.eps", paper="letter", horizontal=FALSE)
> par(mfrow=c(3,3))
> par(omi=c(2,0.2,1.8,0.2), mai=c(0.4, 0.4, 0.5, 0.1) )
> 
> my.input <- read.table("input.data", header=FALSE, sep="\t")
> my.input.exp <- read.table("exp.data", header=FALSE, sep="\t")
> 
> hist(my.input.exp[,2], breaks=40,freq = FALSE,xlab="", border =
> "grey30",
> ylab="", main="")
> hist(my.input[,2], breaks=40,freq = FALSE,xlab="", ylab="", main="",
> border
> = "red",add =TRUE)
> mtext("Fraction", side=2, line=2, cex=0.7)
> box()
> ==
> --
> View this message in context: http://www.nabble.com/Help-needed%3A-
> Fraction-for-Histogram-%3E-1-tp24150345p24150345.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] Help needed: Fraction for Histogram > 1 ???

2009-06-22 Thread charles78

It is not the case as you described.  In any case, the total area should be 1
and labeled fraction on y axis should be far less than 1, since I have more
than 1 data points.  I also test differerent bin size by change the
break.

I draw the graph using only 1 group, the same result was obtained.

Any othe suggestion?

Charles.  

Greg Snow-2 wrote:
> 
> When freq=FALSE then the y axis is not the proportion in each group (what
> I am assuming you mean by fraction), but rather is scaled so that the
> total area of the histogram is 1 (making comparing to theoretical
> densities easier).  If all the data values are between 0 and 1, then the
> height of at least one bar needs to be >= 1 for the total area to equal 1.
> 
> If you want the y-axis to show relative frequency (proportion, fraction,
> etc.), then you either need to plot the y-axis yourself or use a different
> function than 'hist'.
> 
> -- 
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.s...@imail.org
> 801.408.8111
> 
> 
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
>> project.org] On Behalf Of charles78
>> Sent: Monday, June 22, 2009 10:08 AM
>> To: r-help@r-project.org
>> Subject: [R] Help needed: Fraction for Histogram > 1 ???
>> 
>> 
>> I have been trying to draw histogram for my manscript and found some
>> strange
>> things that I could not figure out why.
>> 
>> Using the same code listed below I have successfully draw histograms
>> for a
>> few figures with fraction labeled on Y axis less than 1 (acturally
>> between 0
>> to 0.1).  But one dataset gives the Y axis label 0 to 5 as fraction.
>> This
>> is not true, as fraction are less than 1, although the value
>> distribution on
>> the figure seems to me is right.
>> 
>> The only difference between the first few datasets and last dataset is:
>> 
>> All values for the first few data sets > 1.
>> 
>> The values for the last data sets between 0 and <1.
>> 
>> Any idea why this happens.
>> 
>> Your help is highly appreciated.
>> 
>> Charles
>> 
>> ===
>> postscript("Figure.eps", paper="letter", horizontal=FALSE)
>> par(mfrow=c(3,3))
>> par(omi=c(2,0.2,1.8,0.2), mai=c(0.4, 0.4, 0.5, 0.1) )
>> 
>> my.input <- read.table("input.data", header=FALSE, sep="\t")
>> my.input.exp <- read.table("exp.data", header=FALSE, sep="\t")
>> 
>> hist(my.input.exp[,2], breaks=40,freq = FALSE,xlab="", border =
>> "grey30",
>> ylab="", main="")
>> hist(my.input[,2], breaks=40,freq = FALSE,xlab="", ylab="", main="",
>> border
>> = "red",add =TRUE)
>> mtext("Fraction", side=2, line=2, cex=0.7)
>> box()
>> ==
>> --
>> View this message in context: http://www.nabble.com/Help-needed%3A-
>> Fraction-for-Histogram-%3E-1-tp24150345p24150345.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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Help-needed%3A-Fraction-for-Histogram-%3E-1-tp24150345p24154095.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help needed: Fraction for Histogram > 1 ???

2009-06-22 Thread Thomas Lumley

On Mon, 22 Jun 2009, charles78 wrote:



It is not the case as you described.  In any case, the total area should be 1
and labeled fraction on y axis should be far less than 1, since I have more
than 1 data points.  I also test differerent bin size by change the
break.


Try reading Greg's response again.  Then calculate the area of one of the bars 
in your histogram, remembering that the area of a rectangle is not the same as 
its height, but is the width times height.  If the area of the bar is greater than 
1, then you can report a problem.


  -thomas



I draw the graph using only 1 group, the same result was obtained.

Any othe suggestion?

Charles.

Greg Snow-2 wrote:


When freq=FALSE then the y axis is not the proportion in each group (what
I am assuming you mean by fraction), but rather is scaled so that the
total area of the histogram is 1 (making comparing to theoretical
densities easier).  If all the data values are between 0 and 1, then the
height of at least one bar needs to be >= 1 for the total area to equal 1.

If you want the y-axis to show relative frequency (proportion, fraction,
etc.), then you either need to plot the y-axis yourself or use a different
function than 'hist'.

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



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of charles78
Sent: Monday, June 22, 2009 10:08 AM
To: r-help@r-project.org
Subject: [R] Help needed: Fraction for Histogram > 1 ???


I have been trying to draw histogram for my manscript and found some
strange
things that I could not figure out why.

Using the same code listed below I have successfully draw histograms
for a
few figures with fraction labeled on Y axis less than 1 (acturally
between 0
to 0.1).  But one dataset gives the Y axis label 0 to 5 as fraction.
This
is not true, as fraction are less than 1, although the value
distribution on
the figure seems to me is right.

The only difference between the first few datasets and last dataset is:

All values for the first few data sets > 1.

The values for the last data sets between 0 and <1.

Any idea why this happens.

Your help is highly appreciated.

Charles



=
==

postscript("Figure.eps", paper="letter", horizontal=FALSE)
par(mfrow=c(3,3))
par(omi=c(2,0.2,1.8,0.2), mai=c(0.4, 0.4, 0.5, 0.1) )

my.input <- read.table("input.data", header=FALSE, sep="\t")
my.input.exp <- read.table("exp.data", header=FALSE, sep="\t")

hist(my.input.exp[,2], breaks=40,freq = FALSE,xlab="", border =
"grey30",
ylab="", main="")
hist(my.input[,2], breaks=40,freq = FALSE,xlab="", ylab="", main="",
border
= "red",add =TRUE)
mtext("Fraction", side=2, line=2, cex=0.7)
box()


=
=

--
View this message in context: http://www.nabble.com/Help-needed%3A-
Fraction-for-Histogram-%3E-1-tp24150345p24150345.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.




--
View this message in context: http://www.nabble.com/Help-needed%3A-

Fraction-for-Histogram-%3E-1-tp24150345p24154095.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.



Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

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


Re: [R] Help needed: Fraction for Histogram > 1 ???

2009-06-23 Thread charles78

I change the values by multiple 100 (from fraction to percentage) and then
use the same code draw the hist.  Now it works fine.  The y axis labeled
between 0 and 0.05.

Why using fraction (value between 0 and 1) it does not work?

Charles

charles78 wrote:
> 
> I have been trying to draw histogram for my manscript and found some
> strange things that I could not figure out why.
> 
> Using the same code listed below I have successfully draw histograms for a
> few figures with fraction labeled on Y axis less than 1 (acturally between
> 0 to 0.1).  But one dataset gives the Y axis label 0 to 5 as fraction. 
> This is not true, as fraction are less than 1, although the value
> distribution on the figure seems to me is right.
> 
> The only difference between the first few datasets and last dataset is:
> 
> All values for the first few data sets > 1.
> 
> The values for the last data sets between 0 and <1.
> 
> Any idea why this happens.
> 
> Your help is highly appreciated.  
> 
> Charles
> 
> ===
> postscript("Figure.eps", paper="letter", horizontal=FALSE)
> par(mfrow=c(3,3))
> par(omi=c(2,0.2,1.8,0.2), mai=c(0.4, 0.4, 0.5, 0.1) )
> 
> my.input <- read.table("input.data", header=FALSE, sep="\t")
> my.input.exp <- read.table("exp.data", header=FALSE, sep="\t")
> 
> hist(my.input.exp[,2], breaks=40,freq = FALSE,xlab="", border = "grey30",
> ylab="", main="")
> hist(my.input[,2], breaks=40,freq = FALSE,xlab="", ylab="", main="",
> border = "red",add =TRUE)
> mtext("Fraction", side=2, line=2, cex=0.7)
> box()
> ==
> 

-- 
View this message in context: 
http://www.nabble.com/Help-needed%3A-Fraction-for-Histogram-%3E-1-tp24150345p24166484.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help needed: Fraction for Histogram > 1 ???

2009-06-23 Thread Peter Dalgaard

charles78 wrote:

I change the values by multiple 100 (from fraction to percentage) and then
use the same code draw the hist.  Now it works fine.  The y axis labeled
between 0 and 0.05.

Why using fraction (value between 0 and 1) it does not work?


As you have been told multiple times, densities are not "fractions" and 
can be bigger than one.




Charles


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

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


[R] Help needed in identifying type of plot

2009-07-14 Thread Girish A.R.

Hi folks,

Can someone please help me in identifying the type of plot shown here?
Sample R code or specific package name would be of help as well.

Thanks,
-Girish

http://www.nabble.com/file/p24477714/example_plot.jpg 


-- 
View this message in context: 
http://www.nabble.com/Help-needed-in-identifying-type-of-plot-tp24477714p24477714.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] Calling C funtion from R help Needed

2009-08-28 Thread naresh4836
Hello Forum,

I'm calling C function from R.It is a small sample trial program. The C 
function will accept a character and a integer and print them.
It is printing some special character instead of input character. Below are the 
C function, Wrapper code ,R code and R output.
Please help me in this issue
Thank you in advance

C function (Name : checkstr.c)
#include
 int n_char(char n,int m)
{
   int result;
   result = 3;
   //result = strlen(n);
   printf("the string is %c\n",n);
   printf("the silly number is %d\n",m);
  return result;

}

Wrapper Code  (wrapcheckstr.c)
#include 
#include

int n_char(char ,int );
void checkstr_R_wrapper(char *n,int *m, int *result)
{ *result = n_char(*n,*m); }

R code (checkstr.c)

checkstr <- function(n,m) {
if (!is.loaded(symbol.C('checkstr_R_wrapper'))) { dyn.load('checkstr.so') }
 returned_data = .C('checkstr_R_wrapper', n=as.character(n),m=as.integer(m), 
result=integer(1))
return(returned_data$result) }

result in R
> source('checkstr.R')
> checkstr('a',3)
Warning in symbol.C("checkstr_R_wrapper") :
  'symbol.C' is not needed: please remove it
the string is Ð
the silly number is 3
[1] 3

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

2009-08-31 Thread naresh kumar
Hello Forum,

 I'm calling C function from R.It is a 
  small sample trial 
 program. The C function will accept a string and a integer 
 and print them.
 It is giving error segmentation fault. 
  Below are the C function, Wrapper code ,R code and 
 R 
  output.
 Please help me in this issue
 Thank you in 
  advance

Error:

 *** caught segfault ***
address 0x68, cause 'memory not mapped'

Traceback:
 1: .C("checkstr_R_wrapper", n = as.character(n), m = as.integer(m), NAOK = 
TRUE, DUP = TRUE, result = integer(1))
 2: checkstr("hi", 2)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 1
aborting ...
Segmentation fault



C FUNCTION (Name : checkstr.c)
#include
#include
 int n_char(char n[10],int m)
{
   int result;
   result = 3;
   result = strlen(n);
   printf("the string is %s\n",n);
   printf("the silly number is %d\n",m);
  return result;

}

WRAPPER CODE  
  (wrapcheckstr.c)
#include 
#include

int n_char(char,int);
void checkstr_R_wrapper(char **n,int *m, int *result)
{ *result = n_char(**n,*m); }
[prod...@venus myrpackages]$

R CODE(checkstr.R)

source('checkstr.R')
checkstr <- function(n,m) {
if (!is.loaded(symbol.C('checkstr_R_wrapper'))) { dyn.load('checkstr.so') }
 returned_data = .C('checkstr_R_wrapper', n=as.character(n),m=as.integer(m), 
result=integer(1))
return(returned_data$result) }

Thanks and Regards
Naresh P




  Love Cricket? Check out live scores, photos, video highlights and more. 
Click here http://cricket.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] help needed for HWE.exact in library "genetics"

2008-08-22 Thread Neil Shephard

You could follow the advice given when loading the library (see the code you
posted for details) and use the enhanced genetics packages to cross-validate
the results (ideally you should get the same answer).

The results not weird though.

Your working with SNPs and having a homozygote with a frequency of zero
isn't that unlikely, it depends on the minor allele frequency (MAF).  In
this instance its the controls you appear to be concerned about, and for
this locus the MAF of the minor allele is 0.0145, so in a sample of 173
individuals you would expect to see 0.0363 individuals with the recessive
genotype (basic Mendelian genetics of 173 * 0.0145^2).  Thus at best you
might expect to see one person in a sample of that size, but its not
surprising that you've not seen any.

You may also find the following references of interest...

Guangyong Zou, Allan Donner
The Merits of Testing Hardy-Weinberg Equilibrium in the Analysis of
Unmatched Case-Control Data: A Cautionary Note
Annals of Human Genetics
Volume 70, Issue 6, Pages 923-933

(basically advocates the use of a robust test for association such as the
trend test over the two-stage design of testing for HWeqm and then testing
for association).

There is follow up discussion of the article in 

Yik Y. Teo, Andrew E. Fry, Taane G. Clark, E. S. Tai, Mark Seielstad
On the Usage of HWE for Identifying Genotyping Errors 
Annals of Human Genetics
Volume 71 Issue 5 , Pages 701 - 703

...and a rejoinder from Zou and Donner...

Guangyong Zou, Allan Donner
The Reply of Zou & Donner to Teo's Commentary on their Manuscript (p
704-704)
Annals of Human Genetics
Volume 71 Issue 5 , Pages 701 - 703

Neil

Sun, Ying [BSD] - HGD wrote:
> 
> 
>> library( "genetics" )
> NOTE: THIS PACKAGE IS NOW OBSOLETE.
>   The R-Genetics project has developed an set of enhanced genetics
>   packages to replace 'genetics'. Please visit the project homepage
>   at http://rgenetics.org for informtion.
> 

-- 
View this message in context: 
http://www.nabble.com/help-needed-for-HWE.exact-in-library-%22genetics%22-tp19100974p19105112.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] help needed for HWE.exact in library "genetics"

2008-08-22 Thread David Duffy

"Sun, Ying" asked:


I have a genotype data for both case and controls and would
like to calculate the HW p-value.  However, since the
number of one genotype is 0, I got wierd result.  Would
someone help me to figure it out?  Or confirm it's right?
Thanks a lot.

...

HWE.exact(g1)
Exact Test for Hardy-Weinberg Equilibrium
data:  g1
N11 = 71, N12 = 9, N22 = 0, N1 = 151, N2 = 9,
p-value = 1


Yes, that is correct.  Double check it by calculating the
goodness-of-fit chi-square for the same hypothesis:

p <- 151/160; q <- 1-p; 80*c(p^2,2*p*q,q^2)
[1] 71.253125  8.493750  0.253125
...

David Duffy.

--
| David Duffy (MBBS PhD) ,-_|\
| email: [EMAIL PROTECTED]  ph: INT+61+7+3362-0217 fax: -0101  / *
| Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v

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


Re: [R] Help needed in Changing default P - value

2008-01-03 Thread Duncan Murdoch
On 1/3/2008 1:06 AM, [EMAIL PROTECTED] wrote:
> Dear all,
> I'm using friedman rank test in R. I need to know which P 
> value
> is used default and procedure to change the threshold P value.

It doesn't set any threshold.  That's up to you.  It just reports the 
p-value.

Duncan Murdocvh

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


Re: [R] Help needed in Changing default P - value

2008-01-03 Thread Henrique Dallazuanna
See the source code of function:

getS3method("friedman.test", "default")

On 03/01/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Dear all,
> I'm using friedman rank test in R. I need to know which P 
> value
> is used default and procedure to change the threshold P value.
> With regards
> jeevitesh
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


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

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


Re: [R] Help needed on calculation of Moran's I

2007-10-26 Thread Thibaut Jombart
Geertje Van der Heijden wrote:

>Hi,
>
>I am trying to calculate Moran's I test for the residuals for a
>regression equation, but I have trouble converting my  coordinates into
>nb format.
>
>I have used the dnearneigh() funtion now with an arbitrarily high upper
>distance to make it include all plots. However, when I do the
>lm.morantest() I get a Moran's I value which is the same as the expected
>value and a P-value of 1.
>
>I have used the following code:
>  
>
>>attach(lowland)
>>coords <- as.matrix(cbind(long, $lat))
>>coord.nb <- dnearneigh(coords, 0, 1 longlat=TRUE)
>>coord.list <- nb2listw(coord.nb, style="W")
>>lianasp.lm <- lm(lianasprich ~ log(averdist) + dsl + lianadens +
>>
>>
>wooddens)
>  
>
>>lm.morantest(lianasp.lm, coord.list, alternative="two.sided")
>>
>>
>
>And get the following result
>
>Global Moran's I for regression residuals
>
>data:  
>model: lm(formula = lianasprich ~ log(averdist) + dsl + lianadens +
>wooddens)
>weights: coord.list
> 
>Moran I statistic standard deviate = 0, p-value = 1
>alternative hypothesis: two.sided 
>sample estimates:
>Observed Moran's IExpectation   Variance 
> -1.754386e-02  -1.754386e-02   2.125706e-16 
>
>Can anyone tell me where I went wrong or if there is another way to
>generate a nb list? 
>
>Many thanks,
>Geertje
>  
>
Hi,

did you have a look at the graph you produced (using plot.nb)? Maybe the 
maximum distance between any two neighbours is too high. What does 
max(dist(coords)) say ?
Anyway, there are many different connection networks available in 
several R packages, some being more appropriate than others to model 
paticular spatial distributions.

The package adegenet proposes a small tool to choose among several 
graphs interactively:

library(adegenet)
xy = matrix(runif(100),ncol=2)
yourcn = chooseCN(xy)

Regards,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

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


Re: [R] Help needed on calculation of Moran's I

2007-10-26 Thread Geertje Van der Heijden
Hi,

Thanks for your help, Thibaut. It was helpful to look at the graphs.

I think that the problem is that when the lower boundary is 0 and the upper 
boundary is arbitrarily high it takes all connections into account (which 
shouldn't be a problem right?). If I make the lower boundary slightly higher 
than 0 and keep the maximum on some random high value or decrease the upper 
boundary - i.e. not all possible links are taken into account - the 
lm.morantest does work, but the Moran's I value is still really close to the 
expected value.

I have 58 sites from across the Neotropics. I am looking at the relationship of 
environmental and biogeographical factors on species richness and would like to 
see if there is still a spatial pattern in my data when these variables are 
taken into account. As far as I understand I should take all possible 
interactions between the sites into account if I want to test the residuals for 
spatial autocorrelation, right? I am a novice in this kind of spatial analyses, 
but is there a possibility to take all possible links between one point and all 
other points in the dataset into account when dealing with the Moran's I test 
for spatial autocorrelation in your residuals or have I misinterpreted the 
working of Morna's I? Or is there a better way to calculate it then I have done 
so far?

Any help on this will be greatly appreciated!

Many thanks,
Geertje



Geertje van der Heijden
PhD student
Tropical Ecology
School of Geography
University of Leeds
Leeds LS2 9JT

Tel: (+44)(0)113 3433345 
Email: [EMAIL PROTECTED]


-Original Message-
From: Thibaut Jombart [mailto:[EMAIL PROTECTED] 
Sent: 26 October 2007 15:49
To: Geertje Van der Heijden
Cc: [EMAIL PROTECTED]
Subject: Re: [R] Help needed on calculation of Moran's I

Geertje Van der Heijden wrote:

>Hi,
>
>I am trying to calculate Moran's I test for the residuals for a 
>regression equation, but I have trouble converting my  coordinates into 
>nb format.
>
>I have used the dnearneigh() funtion now with an arbitrarily high upper 
>distance to make it include all plots. However, when I do the
>lm.morantest() I get a Moran's I value which is the same as the 
>expected value and a P-value of 1.
>
>I have used the following code:
>  
>
>>attach(lowland)
>>coords <- as.matrix(cbind(long, $lat)) coord.nb <- dnearneigh(coords, 
>>0, 1 longlat=TRUE) coord.list <- nb2listw(coord.nb, style="W") 
>>lianasp.lm <- lm(lianasprich ~ log(averdist) + dsl + lianadens +
>>
>>
>wooddens)
>  
>
>>lm.morantest(lianasp.lm, coord.list, alternative="two.sided")
>>
>>
>
>And get the following result
>
>Global Moran's I for regression residuals
>
>data:  
>model: lm(formula = lianasprich ~ log(averdist) + dsl + lianadens +
>wooddens)
>weights: coord.list
> 
>Moran I statistic standard deviate = 0, p-value = 1 alternative 
>hypothesis: two.sided sample estimates:
>Observed Moran's IExpectation   Variance 
> -1.754386e-02  -1.754386e-02   2.125706e-16 
>
>Can anyone tell me where I went wrong or if there is another way to 
>generate a nb list?
>
>Many thanks,
>Geertje
>  
>
Hi,

did you have a look at the graph you produced (using plot.nb)? Maybe the 
maximum distance between any two neighbours is too high. What does
max(dist(coords)) say ?
Anyway, there are many different connection networks available in several R 
packages, some being more appropriate than others to model paticular spatial 
distributions.

The package adegenet proposes a small tool to choose among several graphs 
interactively:

library(adegenet)
xy = matrix(runif(100),ncol=2)
yourcn = chooseCN(xy)

Regards,

Thibaut.

--
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

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

2009-05-12 Thread Tena Sakai
Hi,

I cannot compile R with shared library.
I am using Redhad Linux on Dell hardware.

Here''s what I am doing:

I set ?PICFLAGS in config.site file:
 CPICFLAGS=-fPIC
 FPICFLAGS=-fPIC
and issue:
 ./configure --enable-R-shlib --prefix=$HOME/newR
 make

configure finishes with no complaints, the last
informative line being: 
 Options enabled:   shared R library, shared BLAS, R profiling, Java

But make is upset:
  /usr/bin/ld: CConverters.o: relocation R_X86_64_32S against `a local symbol' 
can not be used when making a shared object; recompile with -fPIC
  CConverters.o: could not read symbols: Bad value
  collect2: ld returned 1 exit status

It saysm "recompile with -fPIC"  But I am already
doing so, am I not?  What am I doing wrong here?
Any help would be appreciated.

Regards,

Tena Sakai
tsa...@gallo.ucsf.edu

[[alternative HTML version deleted]]

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


Re: [R] Help needed in identifying type of plot

2009-07-14 Thread Christopher Jones

On 14 Jul 2009, at 12:30, Girish A.R. wrote:

> Can someone please help me in identifying the type of plot shown here?

Its a Forest Plot


Chris.


---
Gynaecological Cancer Research Laboratories,
UCL EGA Institute for Women's Health,
University College London,
Paul O'Gorman Building,
72 Huntley Street,
London
WC1E 6DD
United Kingdom

Telephone; 020 3108 2007
Fax; 020 3108 2010


[[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] Help needed in identifying type of plot

2009-07-14 Thread ONKELINX, Thierry
It is a plot with pointranges. Here is an example with the ggplot2
package


library(ggplot2)
#use the diamond data set from ggplot2
diamonds$A <- diamonds$depth < 60
dmod <- lm(price ~ cut * A, data=diamonds)
cuts <- unique(diamonds[, c("cut", "A")])
cuts <- cbind(cuts, predict(dmod, cuts, se=T)[c("fit","se.fit")])

#the actual plot
ggplot(cuts, aes(x = cut, y = fit, ymin = fit - se.fit, ymax=fit +
se.fit, colour = factor(A))) + geom_pointrange(position =
position_dodge(width = 0.2)) + coord_flip()

More details on the ggplot2 website: http://had.co.nz/ggplot2/

HTH,

Thierry




ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
thierry.onkel...@inbo.be
www.inbo.be

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

The plural of anecdote is not data.
~ Roger Brinner

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

-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
Namens Girish A.R.
Verzonden: dinsdag 14 juli 2009 13:31
Aan: r-help@r-project.org
Onderwerp: [R] Help needed in identifying type of plot


Hi folks,

Can someone please help me in identifying the type of plot shown here?
Sample R code or specific package name would be of help as well.

Thanks,
-Girish

http://www.nabble.com/file/p24477714/example_plot.jpg 


--
View this message in context:
http://www.nabble.com/Help-needed-in-identifying-type-of-plot-tp24477714
p24477714.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.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

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


Re: [R] Help needed in identifying type of plot

2009-07-14 Thread Girish A.R.

Thanks, Chris and Thierry! I think I can explore both your solutions.

best,
-Girish


It is a plot with pointranges. Here is an example with the ggplot2
package


library(ggplot2)
#use the diamond data set from ggplot2
diamonds$A <- diamonds$depth < 60
dmod <- lm(price ~ cut * A, data=diamonds)
cuts <- unique(diamonds[, c("cut", "A")])
cuts <- cbind(cuts, predict(dmod, cuts, se=T)[c("fit","se.fit")])

#the actual plot
ggplot(cuts, aes(x = cut, y = fit, ymin = fit - se.fit, ymax=fit +
se.fit, colour = factor(A))) + geom_pointrange(position =
position_dodge(width = 0.2)) + coord_flip()

More details on the ggplot2 website: http://had.co.nz/ggplot2/

HTH,

Thierry




ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
thierry.onkel...@inbo.be
www.inbo.be

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

The plural of anecdote is not data.
~ Roger Brinner

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


-- 
View this message in context: 
http://www.nabble.com/Help-needed-in-identifying-type-of-plot-tp24477714p24478359.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help needed in identifying type of plot

2009-07-14 Thread John Kane

It looks like a forest plot normally used in meta-analysis work. See 
http://www.bmj.com/cgi/content/full/322/7300/1479 .  See 
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=114 for an 
example from rmeta package with accompanying code.

I think that package metafor also gives forest plots.

--- On Tue, 7/14/09, Girish A.R.  wrote:

> From: Girish A.R. 
> Subject: [R]  Help needed in identifying type of plot
> To: r-help@r-project.org
> Received: Tuesday, July 14, 2009, 7:30 AM
> 
> Hi folks,
> 
> Can someone please help me in identifying the type of plot
> shown here?
> Sample R code or specific package name would be of help as
> well.
> 
> Thanks,
> -Girish
> 
> http://www.nabble.com/file/p24477714/example_plot.jpg 
> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Help-needed-in-identifying-type-of-plot-tp24477714p24477714.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.
> 


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

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

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


Re: [R] Calling C funtion from R help Needed

2009-08-31 Thread Steve Lianoglou

Hi,

Perhaps you should try just passing in two integers to some toy C  
function just to make sure all the plumbing is correct before you play  
with strings/char arrays.


In any case, some comments inline:

On Aug 31, 2009, at 11:42 AM, naresh kumar wrote:


Hello Forum,

 I'm calling C function from R.It is a
 small sample trial
 program. The C function will accept a string and a integer
 and print them.
 It is giving error segmentation fault.
 Below are the C function, Wrapper code ,R code and
 R
 output.
 Please help me in this issue
 Thank you in
 advance

Error:

 *** caught segfault ***
address 0x68, cause 'memory not mapped'

Traceback:
 1: .C("checkstr_R_wrapper", n = as.character(n), m =  
as.integer(m), NAOK = TRUE, DUP = TRUE, result = integer(1))

 2: checkstr("hi", 2)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 1
aborting ...
Segmentation fault



C FUNCTION (Name : checkstr.c)
#include
#include
 int n_char(char n[10],int m)
{
   int result;
   result = 3;
   result = strlen(n);
   printf("the string is %s\n",n);
   printf("the silly number is %d\n",m);
  return result;

}


Why are you defining the first argument in this function as ``char  
n[10]``. How do you know it's 10 chars long? My C is a bit rusty, but  
I'm guessing this might be causing a problem (like a seg fault!) if  
your n isn't 10 chars long.



WRAPPER CODE
 (wrapcheckstr.c)
#include 
#include

int n_char(char,int);
void checkstr_R_wrapper(char **n,int *m, int *result)
{ *result = n_char(**n,*m); }
[prod...@venus myrpackages]$

R CODE(checkstr.R)

source('checkstr.R')
checkstr <- function(n,m) {
if (!is.loaded(symbol.C('checkstr_R_wrapper')))  
{ dyn.load('checkstr.so') }
 returned_data = .C('checkstr_R_wrapper',  
n=as.character(n),m=as.integer(m), result=integer(1))

return(returned_data$result) }


If you're going to be passing in arrays of anything (chars, ints,  
etc), you should also pass in a sister variable that is the length of  
the array itself.


So, your two functions might be:

void checkstr_R_wrapper(char **n, int n_length, int *m, int *result) {
  *result = n_char(**n,*m);
}

and the R call would be:

.C('checkstr_R_wrapper',
n=as.character(n),
n_length=length(as.character(n)),
m=as.integer(m), result=integer(1))

... or something ... perhaps.

Does that help any?

-steve

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

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


[R] Help needed to clarify hclust and cutree algorithms

2009-09-20 Thread Dana Sevak
Dear R Helpers,

I read carefully the documentation and all postings on the hclust and cutree 
functions, however some aspects of the tree ordering and cluster assignment 
performed by these functions remain unclear to me, so I would very much 
appreciate your help in making sure I get them right.

Here is an example, with values chosen to illustrate the problems.

I have a set of five profiles comprised of measurements of five variables (V1 
to V5) in 4 different conditions (c1 to c4).

df = data.frame(rbind(c(-32, -52, -46, -35, -35), c(-86, -111, -101, -96, 
-105), c(17, 42, 36, 34, 37), c(24, 37, 28, 29, 30)))

colnames(df) = c("V1", "V2", "V3", "V4", "V5")
rownames(df) = c("c1", "c2", "c3", "c4")

> df
V1   V2   V3  V4   V5
c1 -32  -52  -46 -35  -35
c2 -86 -111 -101 -96 -105
c3  17   42   36  34   37
c4  24   37   28  29   30

plot(df[,1], type="l", ylim=range(df))
points(df[1,1], type="p", pch=49)
for (i in 2:5) {
   points(df[,i], type="l", col=colors()[15*i])
   points(df[1,i], type="p", pch=48+i)
}

The tasks is to determine how correlated these profiles are and to partition 
them in two groups using hierarchical clustering.  Importantly, I need to 
output the order in which the variables occur in these clusters, from left to 
right in decreasing order of their correlation.  Because of this the number 
assigned to the clusters (1 or 2) and the order in which the variables are 
listed within them become very important.

For this I used the hclust and cutree functions:

cor.df =  cor(df, method="pearson")
dist.df = as.dist(1-cor.df)

hc.df = hclust(dist.df, method="complete")
hc.df.cl = cutree(hc.df, k=2)

> str(hc.df)
List of 7
 $ merge  : int [1:4, 1:2] -4 -2 -1 2 -5 -3 1 3
 $ height : num [1:4] 0.00043 0.00048 0.004916 0.010176
 $ order  : int [1:5] 2 3 1 4 5
 $ labels : chr [1:5] "V1" "V2" "V3" "V4" ...
 $ method : chr "complete"
 $ call   : language hclust(d = dist.df, method = "complete")
 $ dist.method: NULL
 - attr(*, "class")= chr "hclust"

> hc.df.cl
V1 V2 V3 V4 V5 
 1  2  2  1  1 

> round(dist.df*1000, 2)
  V1V2V3V4
V2 10.18  
V3 10.11  0.48
V4  4.42  3.74  2.27  
V5  4.92  6.61  4.33  0.43

plot(hc.df)

My questions are:

1.  Can I assume that plot(hc.df) and hc.df$order indicate that the order of 
merging was:

V2 V3 V1 V4 V5 ?

This does not seem to be supported by the distance matrix which shows that the 
closest pair to begin with is V4-V5.

Also the element closest to V2 or V3 is V4, and not V1.

The hclust help states that
 In hierarchical cluster displays, a decision is needed at each
 merge to specify which subtree should go on the left and which on
 the right. Since, for n observations there are n-1 merges, there
 are 2^{(n-1)} possible orderings for the leaves in a cluster tree,
 or dendrogram. The algorithm used in 'hclust' is to order the
 subtree so that the tighter cluster is on the left (the last,
 i.e., most recent, merge of the left subtree is at a lower value
 than the last merge of the right subtree). Single observations are
 the tightest clusters possible, and merges involving two
 observations place them in order by their observation sequence
 number.

In this light shall I look at the plot and $order as a flipped version of 

V1 V4 V5 V3 V2  ?

Would it be possible that somebody could be so kind and actually indicate step 
by step how the merges are done?

2. When cutree cuts the tree in two clusters, which number does it assign to 
the cluster in which the profiles are most correlated?  Is the numbering simply 
from the right to left of the tree as it appears in hc.df$order?

3. If I take into account only the hc.df$order slot and the cluster number 
assigned by cutree 

> hc.df$order
[1] 2 3 1 4 5

> hc.df.cl
V1 V2 V3 V4 V5 
 1  2  2  1  1 

can I infer that the order of variables from left to right in decreasing order 
of correlation between profiles is:

variable V2 V3 V1 V4 V5
cluster  1  1  1  2  2

Is this correct?  It does not seem to be supported by the actual distance 
matrix. Even in reverse and with the cluster numbers flipped, the immediate 
neighbor of V4 should be V3 and not V1.

3. Most importantly, how I could use the results of these functions to output 
the following:

   A. The two clusters, labeled such that cluster 1 contains the pair of 
profiles with smallest distance from each other.

   B. The order of variables in decreasing order of correlation (increasing 
value of distance).  In this way the value listed after the last entry in 
cluster 1 will be the closest in distance to the members of cluster1.

   Can I use only the results of these functions (and how), or do I need to do 
other data manipulation (and if so what exactly) to make sure the output 
complies to the requirements above?

Thank you very much for your help in clarifying these issues.

> sessionInfo()
R version 2.8.1 (2008-12-22) 
i486-pc-linux-gnu 

W

Re: [R] Help needed to compile R with shared library.

2009-05-12 Thread Tena Sakai
Hi,

I got it compiled.

> It says "recompile with -fPIC"  But I am already
> doing so, am I not?

It appeared so, but in fact that wasn't what happened.
When I looked at the date of CConverters.o, I realized
the date was several days old.  I deleted the entire
tree and did everything once more (from untar-ing the
gzipped file).  This time make took much longer, but
there was no complaint at all.

Regards,

Tena Sakai
tsa...@gallo.ucsf.edu

-Original Message-
From: r-help-boun...@r-project.org on behalf of Tena Sakai
Sent: Tue 5/12/2009 12:47 PM
To: r-help@r-project.org
Subject: [R] Help needed to compile R with shared library.
 
Hi,

I cannot compile R with shared library.
I am using Redhad Linux on Dell hardware.

Here''s what I am doing:

I set ?PICFLAGS in config.site file:
 CPICFLAGS=-fPIC
 FPICFLAGS=-fPIC
and issue:
 ./configure --enable-R-shlib --prefix=$HOME/newR
 make

configure finishes with no complaints, the last
informative line being: 
 Options enabled:   shared R library, shared BLAS, R profiling, Java

But make is upset:
  /usr/bin/ld: CConverters.o: relocation R_X86_64_32S against `a local symbol' 
can not be used when making a shared object; recompile with -fPIC
  CConverters.o: could not read symbols: Bad value
  collect2: ld returned 1 exit status

It saysm "recompile with -fPIC"  But I am already
doing so, am I not?  What am I doing wrong here?
Any help would be appreciated.

Regards,

Tena Sakai
tsa...@gallo.ucsf.edu

[[alternative HTML version deleted]]

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


[[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 needed to analyse a factorial microarray experiments! Newbie Question

2008-02-26 Thread Leonardo Boava
Dear R-users:

I am using the package MAANOVA to analyze microarray data and have
encountered problems when trying to get interactions.

I am a newbie in both, R and maanova, and I do not have good knowledge in 
statistical methods.

I have four effects:

Effects   Levels
Var  2
Ind  2
Trat 2
Time 4
Sample   3 <-- biological replicate
Spot 4 <-- technical replicate

I had fitted a model to got all interactions with Samples in random effect 
(mixed). But, I got an error when I include the Var:ind:Trat and Var:ind:Time 
in the fitted model. May be I didn't had degree of freedom enough.

Then I did an analyses without those interactions (Var:ind:Trat and 
Var:ind:Time ).

Now, I would like to known if are possible to get the interactions with three 
factors and interactions with four factors.

I am interested in known which genes are differentially expressed in Var 1, 
Ind 2, Trat 1 , Time 3, for example.

Could you address me how do I could do that?

If I include the technical replicate in the model, can I get those 
interactions?

If you had analysed a experiment like this, could you share your script?

Does anyone have experience using MAANOVA commands and is willing to help?

Any comments are very welcome!

Thank you very much.

Leonardo

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 needed with ridge regression and choice of lambda with lm.ridge!!!

2009-06-04 Thread Giulio Di Giovanni

Hi,

I'm a beginner in the field, I have to perform the ridge regression with 
lm.ridge for many datasets, and I wanted to do it in an automatic way.
In which way I can automatically choose lambda ?
As said, right now I'm using lm.ridge MASS function, which I found quite simple 
and fast, and I've seen that among the returned values there are HKB estimate 
of the ridge constant and L-W estimate of the ridge constant, together with GCV 
values.

I found on the web other studies where people simply choose among one of these 
quantities. It will be perfect to me to do the same, but how? Which are the 
decisional criteria, if there are criteria? HKB, L-W or none of these ?

Another (for me) important question: Aren't the lambda in general supposed to 
increase with the increasing of the number of predictors ? Isn't the ridge 
regression supposed to work fine even with number of predictors > number of 
observations? At least I was said so...
But if I have a dataset of 16 observations and 34 predictors I get:

> fmr<-lm.ridge(y~0+ .+., data=x, lambda = seq(0,10,0.01))
>select(fmr)
modified HKB estimator is -1.850770e-28 
modified L-W estimator is -2.012264e-28 
smallest value of GCV  at 0.01 

and similar values if I reduce the number of predictor in the dataset, all 
numbars between 17and 34.
but if I build a dataset with only 16 predictors (euqal to the number of rows) 
I get:

> select(fmr)
modified HKB estimator is 0.1511719 
modified L-W estimator is 3.322775 
smallest value of GCV  at 0.51 

And at the same way, other accettable values for any smaller dataset...
Please, could anybody help me? 

Thanks in advance

Giulio

 
_
[[elided Hotmail spam]]

[[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 needed using 3rd party C library/functions from within R (Nvidia CUDA)

2008-11-04 Thread MarcelK

Hello,

I'm trying to combine the parallel computing power available through NVIDIA
CUDA (www.nvidia.com/cuda) from within R. CUDA is an extension to the C
language, so I thought it would be possible to do this.

If I have a C file with an empty function which includes a needed CUDA
library (cutil.h) and compile this to an .so file using a NVIDIA compiler
(nvcc), called 'myFunc.so' I can load this fine from within R with
dyn.load("myFunc.so").
But, as soon as I want to call it's function I get:

> dyn.load("myFunc.so")
> .C("testFunc")
Error in .C("testFunc") : C symbol name "testFunc" not in load table

The myFunc.c file looks like this:

#include
#include
#include
#include

void testFunc() {
printf("Hello!\n");
}

The problem is that NVIDIA has their own C compiler (nvcc) which is needed
to compile code for their devices. This compiler calls 'gcc' (or Windows C
compiler) for all standard C code, so setting the 'CC = nvcc' might still
work when using 'R CMD SHLIB' to compile C files to shared libraries. But as
far as I know, if I use the same flags R CMD SHLIB uses (nvcc passes them to
gcc) it should work..

Can anyone point me in the right direction?

Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/Help-needed-using-3rd-party-C-library-functions-from-within-R-%28Nvidia-CUDA%29-tp20321716p20321716.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help needed using 3rd party C library/functions from within R (Nvidia CUDA)

2008-11-04 Thread Prof Brian Ripley
Please see the R posting guide (the footer of this and every R-help 
message).


- This is not an R-help question but an R-devel one.
- You have not told us your OS, nor any of the 'at a minimum' information 
requested in the posting guide.


But look at nm -g myFunc.so to see what symbols are exported.

Please post any follow-up help request on R-devel, with as far as possible 
a completely reproducible example.


On Tue, 4 Nov 2008, MarcelK wrote:



Hello,

I'm trying to combine the parallel computing power available through NVIDIA
CUDA (www.nvidia.com/cuda) from within R. CUDA is an extension to the C
language, so I thought it would be possible to do this.

If I have a C file with an empty function which includes a needed CUDA
library (cutil.h) and compile this to an .so file using a NVIDIA compiler
(nvcc), called 'myFunc.so' I can load this fine from within R with
dyn.load("myFunc.so").
But, as soon as I want to call it's function I get:


dyn.load("myFunc.so")
.C("testFunc")

Error in .C("testFunc") : C symbol name "testFunc" not in load table

The myFunc.c file looks like this:

#include
#include
#include
#include

void testFunc() {
   printf("Hello!\n");
}

The problem is that NVIDIA has their own C compiler (nvcc) which is needed
to compile code for their devices. This compiler calls 'gcc' (or Windows C
compiler) for all standard C code, so setting the 'CC = nvcc' might still
work when using 'R CMD SHLIB' to compile C files to shared libraries. But as
far as I know, if I use the same flags R CMD SHLIB uses (nvcc passes them to
gcc) it should work..

Can anyone point me in the right direction?

Thanks in advance.
--
View this message in context: 
http://www.nabble.com/Help-needed-using-3rd-party-C-library-functions-from-within-R-%28Nvidia-CUDA%29-tp20321716p20321716.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.



--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 needed: taking a function out of a package and it can not find some funtions

2007-11-06 Thread Jason Liao

 I tried to modify the R function bw.SJ (from the stats package) for my own 
use. But if I just get the source code and run directly (without any 
modification), it can no longer find some key functions called within it. I 
understand this has something to do with searching path which I do not 
understand well. Can anyone tell me how to modify the source code of an R 
function and still make it part of an existing package?

Thanks.


Jason Liao, http://www.geocities.com/jg_liao
Associate Professor of Biostatistics
Drexel University School of Public Health
245 N. 15th Street, Mail Stop 660
Philadelphia, PA 19102-1192
phone 215-762-3934

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


Re: [R] help needed: taking a function out of a package and it can not find some funtions

2007-11-06 Thread Katharine Mullen
bw.SJ calls C code from the file
/usr/local/bin/R-2.6.0/src/library/stats/src/bandwidths.c
You have to make this code available.

You can do the following:
1. copy bandwidths.c and the definition of bw.SJ (the latter renamed) to a
directory
2. compile bandwidths.c into a shared library with the command
R CMD SHLIB bandwidths.c (see the manual writing R extensions for details)
3. in your definition of bw.SJ, in the 3 places .C is
called, remove "R_" from the first argument and quote it; e.g.,
C(R_band_phi4_bin, ..." becomes "C("band_phi4_bin","
4. in R, load the shared library you built with the dyn.load function; now
your definition of the (renamed) function bw.SJ can be modified as you
like.

On Tue, 6 Nov 2007, Jason Liao wrote:

>
>  I tried to modify the R function bw.SJ (from the stats package) for my
> own use. But if I just get the source code and run directly (without any
> modification), it can no longer find some key functions called within
> it. I understand this has something to do with searching path which I do
> not understand well. Can anyone tell me how to modify the source code of
> an R function and still make it part of an existing package?
>
> Thanks.
>
>
> Jason Liao, http://www.geocities.com/jg_liao
> Associate Professor of Biostatistics
> Drexel University School of Public Health
> 245 N. 15th Street, Mail Stop 660
> Philadelphia, PA 19102-1192
> phone 215-762-3934
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] help needed: taking a function out of a package and it can not find some funtions

2007-11-06 Thread Jason Liao

Simple solution provide by  Prof. Ripley is to modify the relevant code as 
follows (he posted in the R-development group):


  SDh <- function(x, h, n, d) .C(stats:::R_band_phi4_bin,
 as.integer(n),
 as.integer(length(x)), as.double(d), x, as.double(h),
 u = double(1))$u
 TDh <- function(x, h, n, d) .C(stats:::R_band_phi6_bin,
 as.integer(n),
 as.integer(length(x)), as.double(d), x, as.double(h),
 u = double(1))$u
 Z <- .C(stats:::R_band_den_bin, as.integer(n), as.integer(nb), d =
 double(1),
 x, cnt = integer(nb))

It works great with minimum extra effort. 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] help needed: taking a function out of a package and it can not find some funtions

2007-11-06 Thread Katharine Mullen
OK, well, the way I suggested will allow you to modify the C code too --
but reading your question I realize you probably don't want to do this.
If you want to use the definitions of the C functions from stats, you can
skip 2. below and add another modification to the calls to .C in your
def. of bw.SJ; add the argument PACKAGE="stats".

On Tue, 6 Nov 2007, Katharine Mullen wrote:

> bw.SJ calls C code from the file
> /usr/local/bin/R-2.6.0/src/library/stats/src/bandwidths.c
> You have to make this code available.
>
> You can do the following:
> 1. copy bandwidths.c and the definition of bw.SJ (the latter renamed) to a
> directory
> 2. compile bandwidths.c into a shared library with the command
> R CMD SHLIB bandwidths.c (see the manual writing R extensions for details)
> 3. in your definition of bw.SJ, in the 3 places .C is
> called, remove "R_" from the first argument and quote it; e.g.,
> C(R_band_phi4_bin, ..." becomes "C("band_phi4_bin","
> 4. in R, load the shared library you built with the dyn.load function; now
> your definition of the (renamed) function bw.SJ can be modified as you
> like.
>
> On Tue, 6 Nov 2007, Jason Liao wrote:
>
> >
> >  I tried to modify the R function bw.SJ (from the stats package) for my
> > own use. But if I just get the source code and run directly (without any
> > modification), it can no longer find some key functions called within
> > it. I understand this has something to do with searching path which I do
> > not understand well. Can anyone tell me how to modify the source code of
> > an R function and still make it part of an existing package?
> >
> > Thanks.
> >
> >
> > Jason Liao, http://www.geocities.com/jg_liao
> > Associate Professor of Biostatistics
> > Drexel University School of Public Health
> > 245 N. 15th Street, Mail Stop 660
> > Philadelphia, PA 19102-1192
> > phone 215-762-3934
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/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.