Re: [R] shorten str() output for long list

2009-12-04 Thread Martin Maechler

 DW == David Winsemius dwinsem...@comcast.net
 on Fri, 4 Dec 2009 01:18:56 -0500 writes:

DW On Dec 3, 2009, at 10:11 PM, Peng Yu wrote:

 x=split(1:1000,1:1000)
 str(x)
 
 Although str() can suppress long output for vectors, but it can not
 suppress long output for list. I'm wondering how to suppress the
 output for long lists.

DW Very simple ... You examine the code (for str.default it's not short,  
DW I will admit) and modify it to your specifications:

DW str.default contains a section which is clearly for lists. These minor  
DW modifications to the list portion of the function will achieve what  
DW you request:

DW Argument ... ,max.list=200 )   defined in the invocation segment:

DW + for (i in seq_len(min(max.list,le) ) ){
DW 
DW +   cat(indent.str, comp.str, nam.ob[i], :, sep = )
DW +   envir - if (typeof(object[[i]]) == promise) {
DW + structure(object, nam = as.name(nam.ob[i]))
DW +   }

DW ...and ... since it is a recursive data structure...

DW +   str(object[[i]], nest.lev = nest.lev + 1,  
DW indent.str = paste(indent.str,
DW + ..), nchar.max = nchar.max, max.level =  
DW max.level,
DW + vec.len = vec.len, digits.d = digits.d,  
DW give.attr = give.attr,
DW + give.head = give.head, give.length = give.length,
DW + width = width, envir = envir, max.list)
DW 

(defensive programming requires to use  'max.list=max.list' in the line above.)

David, I know you as a smart R user.
If you provide patches against the *sources* , i.e.
  https://svn.r-project.org/R/trunk/src/library/utils/R/str.R
*and* the help file man/str.Rd

I'll incorporate these into str() ,
not anymore for R 2.10.1 though.

With regards,
Martin Maechler, ETH Zurich

 x=split(1:10,1:10)
 str(x)
DW List of 10
DW $ 1 : int 1
DW $ 2 : int 2
DW $ 3 : int 3
DW $ 4 : int 4
DW $ 5 : int 5
DW $ 6 : int 6
DW $ 7 : int 7
DW $ 8 : int 8
DW $ 9 : int 9
DW $ 10: int 10
 x=split(1:10,1:10)
 str(x, max.list=5)
DW List of 10
DW $ 1 : int 1
DW $ 2 : int 2
DW $ 3 : int 3
DW $ 4 : int 4
DW $ 5 : int 5

DW -- 
DW David Winsemius, MD
DW Heritage Laboratories
DW West Hartford, CT

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

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


Re: [R] R igraph clusters component

2009-12-04 Thread Gábor Csárdi
Hi,

On Fri, Dec 4, 2009 at 3:12 AM, Gaurav Kumar gau...@gauravkumar.org wrote:
 Hi R-users,

 I'm using igraph for an undirected graph.
 i used clusters() igraph function to know the component size(subgraphs) as 
 shown bellow:
 c -clusters(g)
 # component sizes
 size - sort(c$csize, decreasing=TRUE)
 cat(Top 20 cluster of the graph,\n)
 for (i in 1:20)
 {
   cat(i,  size:,size[i] ,\n)
 }

 Can anyone help how to extract the subgraph components  based on the size as  
 edgelist-format.

V(g)$name - seq_len(vcount(g))-1
lapply(head(order(c$csize, decreasing=TRUE), 20), g, c$membership,
FUN=function(w, g, m) {
  get.edgelist(subgraph(g, which(m==w-1)-1))
})

This gives you the largest 20 components. Best,
Gabor

ps. there is also an igraph-help mailing list, see
http://igraph.sf.net. Just in case you get no answer on R-help.

 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.





-- 
Gabor Csardi gabor.csa...@unil.ch UNIL DGM

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


Re: [R] Formatting of numbers on y axis

2009-12-04 Thread Jim Lemon

On 12/04/2009 03:16 AM, Wells Oliver wrote:

Hello all. I have the following:

plot(salaries$yearID, salaries$salary, type='n', xaxt='n', xlab='',
yaxt='n', ylab='')
axis(1, at=unique(salaries$yearID), labels=unique(salaries$yearID), lwd=.25,
tck=-0.05)
axis(2, axTicks(2), format(axTicks(2), scientific = F))

Which nicely creates the Y axis with the raw numbers, which are in the range
of .5 - 7 million.

However, it displays them as 100, and so on- I'd like it to show just
whole numbers 1, 2, 3, through 7, so I can label the Y axis in millions.
Any tips?

   

Hi Oliver,
Have a look at axis.mult in the plotrix package.

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] Data Manipulation Question

2009-12-04 Thread Barry Rowlingson
On Thu, Dec 3, 2009 at 9:52 PM, John Filben johnfil...@yahoo.com wrote:
 Can R support data manipulation programming that is available in the SAS 
 datastep?  Specifically, can R support the following:
 -  Read multiple dataset one record at a time and compare values from 
 each; then base on if-then logic write to multiple output files
 -  Load a lookup table and then process a different file; based on 
 if-then logic, access and lookup values in the table
 -  Support modular “gosub”programming
 -  Sort files
 -  Date math and conversions
 -  Would it be able to support the following type of logic:
 o   Start
 §  Read Record from File 1
 §  Read Record from File 2
 §  Match
 · If Key 1  Key 2 and Key 1  Key 2, Write to output file A
 · If Key 1 = Key 2, Write to output file B
 · If Key 1  Key 2 and Key 1  Key 2, Write to output file C§  Goto 
 Start until File 1 Done
  John Filben

I'll expand on Hadley Wickham's Yes, to say Yes, and it wouldn't be
much of a 'system for statistical computation and graphics' if it
couldn't do that.

Remember R uses the 'S' and C programming languages and is Open
Source. If it _cant_ do something you want it to do, you can write
code that does it. Like the date math and conversions. Originally,
maybe wy back in R version 0.something, it didn't have that. But
someone wrote it, and wisely contributed it, and the community saw
that it was good. And now we have date math and conversions. And
nobody has to write any date math or conversion codes ever again.

  Now tell me how to get something into the SAS core code.

Barry

P.S. I see a very obvious optimisation you can do on this line:

  If Key 1  Key 2 and Key 1  Key 2, Write to output file A

but maybe that's some kind of weird SASism

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


[R] How to draw a big heatmap?

2009-12-04 Thread Ning Ma
Hi everyone. How can I draw a big heatmaps?

png(foo.png,1,1)
heatmap(x)
dev.off()

where x is a big matrix, say 200*200.

The code above generates a small heatmap in the middle of the png file
and leaves big margins. I expect it to take up more space so that the
labels are not overlapping.

Thanks in advance.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Solve linear program without objective function

2009-12-04 Thread Andreas Wittmann

Dear R-users,

i try to solve to following linear programm in R

0 * x_1 + 2/3 * x_2 + 1/3 * x_3 + 1/3 * x_4 = 0.3
x_1 + x_2 + x_3 + x_4 = 1
x_1, x_2, x_3, x_4  0,
x_1, x_2, x_3, x_4  1

as you can see i have no objective function here besides that i use the 
following code.



library(lpSolve)

f.obj-c(1,1,1,1)
f.con-matrix(c(0,2/3,1/3,1/3,
   1,1,1,1,
   1,0,0,0,
   0,1,0,0,
   0,0,1,0,
   0,0,0,1),nrow=6,byrow=TRUE)
f.dir - c(=, =, , , , )
f.rhs - c(0.3, 1, 0, 0, 0, 0)

lp (max, f.obj, f.con, f.dir, f.rhs)$solution


the problem is, the condition x_1, x_2, x_3, x_4  0 is not fulfilled.

Any advice would be very helpful.

best regards

Andreas

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

2009-12-04 Thread Amelia Livington
 
Dear R helpers
 
Suppose I have two sets of ranges (interest rates) as 
 
Range 1 : (7 – 7.50, 7.50 – 8.50, 8.50 – 10.00) with respective 
probabilities 0.42, 0.22 and 0.36.
 
 
Range II : (11-12, 12-14, 14-21) with respective probabilities 0.14, 0.56 and 
0.30 respectively.
 
 
My problem is to form the combinations of these ranges in a decreasing order of 
joint probabilities. It is assumed that these ranges are independent.
 
Suppose A represents (7-7.50), B represents (7.50-8.50) and C represents (8.50 
– 10.00).
Also let X be (11-12), Y is (12-14) and Z is (14-21).
                        
These two groups are independent i.e. Prob(A and Y) = P(A) * P(Y)
 
So there are 9 combinations possible as (AX, AY, AZ, BX, BY, BZ, CX, CY and CZ) 
respectively with the joint probabilities (0.059, 0.235, 0.126, 0.031, 0.123, 
0.066, 0.05, 0.202, 0.108) respectively.
 
My problem is
(i)                               How to obtain 
these 9 combinations of probabilities in the sense how do I obtain the various 
combinations of these two ranges along-with their respective probabilities; 
(ii)                             How to arrange 
these 9 probabilities in descending order against the respective group 
combination i.e. for the combination AY, the joint probability is maximum at 
0.235, followed by CY at 0.202 and so on.
 
I sincerely apologize as perhaps I might not have raised the query properly. I 
have become member of this group today only and its been hardly a week since I 
have started learning R language. I have easily done this in Excel. My output 
should be something like this – 
 
Combination   Probability
AY                   0.235
CY                   0.202 
AZ                  0.126
BY                   0.123
CZ                  0.108
BZ                  0.066
AX                  0.059
CX                  0.050
BX                   0.031
 
 
I request you to guide me.
 
Thanking in advance
 
Amelia
 
 
 


  
[[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] Logarithm interpolation

2009-12-04 Thread giuseppef...@libero.it
Dear all, i want to know if in R exist a method that give a logarithm 
interpolation of a two columns of dates. I try to do the  lm of logarithm of 
the dates:

a-lm(log(vettore)~log(as.numeric(pippo2[3,])))

but this is a 
linear correlation and not that i want.

thanks

giuseppe

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


[R] Confidence Intervals for proportion according to Blyth, Still Casella

2009-12-04 Thread Öhagen Patrik

Are the confidence Intervals for proportion according to Blyth,Still  Casella 
implemented in R?

Thank you in advance!

Cheers, Patrik
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dividing a pixel image into factors - (cut.im(), cut.default())

2009-12-04 Thread Gough Lauren
Hi,

 

I have a numeric pixel image which I would like to divide into factors
for analysis in Spatstat.  I have found that I can use cut.im() function
to divide the range of pixel values into a series of equal length
intervals (e.g. if my pixels values range from 0 to 60,
cut.im(X.im,breaks=2) will produce two factors one containing pixel
values 0-30 and one containing pixel values of 30 - 60, or thereabouts).


 

However, I would like to specify the pixel value at which the factors
are created - e.g. create one factor containing pixel values of 0-5 and
another factor containing all other pixel values.  I have been
struggling to work out how to do this using either cut.im() or
cut.default().  Can anyone help?

 

Many thanks,

 

Lauren

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
[[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] pseudoreplication - LME

2009-12-04 Thread Rita

Need some help please 
I am trying to use this model because I have temporal replication in my data

results-read.table(file=file.choose(),header=T)
attach(results)
names(results)
results-na.omit(results)
library(nlme)
library(lattice)
results-groupedData(weight~date|group,outer=~diet,results)
plot(results)
plot(results,outer=T)
model-lme(weight~diet,random=~date|group,results)  everything
worked till here
although when I compute the model this error appears Error in
lme.formula(weight ~ diet, random = ~date | group, results) : nlminb
problem, convergence error code = 1
message = iteration limit reached without convergence (9)
summary(model)
http://n4.nabble.com/file/n948321/rawoctobercalciumexperiment2.xlsx
rawoctobercalciumexperiment2.xlsx 
kind regards
thank you in advance 
Ana
-- 
View this message in context: 
http://n4.nabble.com/pseudoreplication-LME-tp948321p948321.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] matrix^(-1/2)

2009-12-04 Thread Greg Dropkin
re [R] matrix^(-1/2)

re the discussion in November on this thread. I don't know about expm but
the problem must be equivalent to solve(B^(1/2)) and a solution will exist
iff B is invertible and has a square root A with A%*%A = B. For 2x2
matrices necessary and sufficient conditions for B to have a square root
are that either B = diag(0,2) or B%*%B != diag(0,2). This follows from the
fact that B%*%B - t(B)*B + det(B) = 0 and A%*%A - t(A)*A + det(A) = 0.
Many non-symmetric B satisfy B%*%B != diag(0,2) and many of them are
invertible. e.g. all the rotations.

If expm has a function, perhaps Exp, which exponentiates matrices using
matrix multiplication, then if B = Exp(C), B^(-1/2) = Exp(-C/2) would be a
solution. There is an open neighbourhood of the identity matrix in which B
= Exp(C) must hold. Since t(B) = Exp(t(C)), such B will not in general be
symmetric.

If N satisfies N%*%N=0, then B = I+N where I is the identity matrix will
have B^(-1/2) = 1-N/2. Such B are not symmetric as N cannot be symmetric
(for non-zero N).

So, for B^(-1/2) to exist, B must be invertible but need not be symmetric.

hope that helps

Greg

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


Re: [R] Lattice : Help with changing the labels of x-axis in respective panels

2009-12-04 Thread Deepayan Sarkar
On Fri, Dec 4, 2009 at 11:53 AM, Sunny Srivastava
research.b...@gmail.com wrote:
 Dear R-Helpers,
 I am not very experienced in using lattice and I am still in the learning
 stage

 I have a data set which looks like this: (I have deleted a few lines in
 order to save space)

   Chromosome marker Marker.Name Distance
 1           1      1     PeMm261   0.
 2           1      2       Xtxp8  10.1013
 ..
 20          1     20     EbMi148 210.3099
 21          1     21      Xtxp25 232.0118
 22          2      1     EcMm152   0.
 23          2      2     EeMp342   5.1474
 ...
 36          2     15     EaMp217 124.5115
 37          2     16     EaMp131 136.9033
 
 40          3      1    TEak2908   0.
 41          3      2     Xtxp303   4.7094
 42          3      3     EhMm195  10.1694

 (I have 11 chromosome in total .. so conditioning on chromosome gives me 11
 panels)

 This is a data.frame which contains Chromosome Number, Marker Number for
 that chromosome and the corresponding Marker.Name and Distance.

 I want to plot the genetic distance conditioned on chromosome and the marker
 name listed below the distance where the marker is situated on chromosome
 (something like this picture)

 Panel 1 : Chromosome 1

 |---|-  (so and so forth)
 PeMm261     Xtxp8
  10.1013 -  (the distance b/w these markers is same as the
 corresponding value in marker$Distance - see 1 and 2 row in the sample
 output)

 and similarly for other chromosomes.

Here's one attempt; hopefully it will give you useful ideas:


df -
structure(list(Chromosome = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
3L, 3L, 3L), marker = c(1L, 2L, 20L, 21L, 1L, 2L, 15L, 16L, 1L,
2L, 3L), Marker.Name = structure(c(7L, 11L, 3L, 9L, 4L, 5L, 2L,
1L, 8L, 10L, 6L), .Label = c(EaMp131, EaMp217, EbMi148,
EcMm152, EeMp342, EhMm195, PeMm261, TEak2908, Xtxp25,
Xtxp303, Xtxp8), class = factor), Distance = c(0, 10.1013,
210.3099, 232.0118, 0, 5.1474, 124.5115, 136.9033, 0, 4.7094,
10.1694)), .Names = c(Chromosome, marker, Marker.Name,
Distance), class = data.frame, row.names = c(1, 2, 20,
21, 22, 23, 36, 37, 40, 41, 42))


library(lattice)

## single panel
dotplot(Chromosome ~ Distance, df, mnames = df$Marker.Name,
panel = function(x, y, ..., mnames, subscripts) {
panel.dotplot(x, y, ...)
panel.text(x, y, labels = mnames[subscripts],
   srt = 90, adj = -0.1)
})

## multiple panels
dotplot( ~ Distance | factor(Chromosome), df, mnames = df$Marker.Name,
layout = c(1, 3), strip = FALSE, strip.left = TRUE,
panel = function(x, y, ..., mnames, subscripts) {
panel.dotplot(x, y, ...)
panel.text(x, y, labels = mnames[subscripts],
   srt = 90, adj = -0.1)
})

-Deepayan



 I tried:

 plt1 = dotplot(  ~ Distance | Chromosome, data=marker,par.strip.text =
 list(cex = 0.75), layout = c(1,11),
        lattice.options=list(legend=right), xlab=Distance in cM,
 ylab=,
        scales= list(cex=0.5),

        panel = function(x, y) {
           panel.grid(h=1,v= 345)
           panel.xyplot(x, y,pch=20,type=o,lwd=2,cex=1.5)
       },
 )

 update(plt1, main=Genetic Map,
  strip = strip.custom(factor.levels = c(1,
 2,3,4,5,6,7,8,9,10,11), strip.levels = TRUE))


 This gives me the location of markers on the respective chromosomes
 corresponding to the distances in the above data.frame. The markers are just
 shown as points.


 MY QUESTIONS - 1) If I want to label these dots with the corresponding
 marker names - How do I do that?
                             2) Is there a way in lattice - to know which
 panel I am in.

 I tried inserting panel.text in the panel function - but it doesn't like
 that. (I also played around with scales - but without any success)

 Any help will be greatly appreciated.

 Thx,
 S.

 ---
 sessionInfo()
 R version 2.9.1 (2009-06-26)
 i386-pc-mingw32

 locale:
 LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
 States.1252;LC_MONETARY=English_United
 States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

 other attached packages:
 [1] lattice_0.17-25 qtl_1.14-2

 loaded via a namespace (and not attached):
 [1] grid_2.9.1  tools_2.9.1

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

Re: [R] R will not load

2009-12-04 Thread Petr PIKAL
Hi

It sometimes occur if I work on different computers. When I save work on 
one and try to start with another it has to have installed all packages 
used in a saved session. So I need to add a package(s) yet uninstalled and 
than the session is started.

Petr Pikal
petr.pi...@precheza.cz
724008364, 581 252 256, 
581 252 140, 581 252 257


r-help-boun...@r-project.org napsal dne 02.12.2009 23:29:35:

 David, Erik, Uwe, Peter
 Thanks to everyone. I found .Rdata (it was hidden) deleted it and all is 
well.
 P.S. The suggestion to launch R from the command line with the --vanilla 

 option allowed the program to start, but it did not solve the problem of 

 launching from startall programsR
 
 
 
 
 John David Sorkin M.D., Ph.D.
 Chief, Biostatistics and Informatics
 University of Maryland School of Medicine Division of Gerontology
 Baltimore VA Medical Center
 10 North Greene Street
 GRECC (BT/18/GR)
 Baltimore, MD 21201-1524
 (Phone) 410-605-7119
 (Fax) 410-605-7913 (Please call phone number above prior to faxing) 
Uwe 
 Ligges lig...@statistik.tu-dortmund.de 12/2/2009 5:12 PM 
 
 
 John Sorkin wrote:
  I delete my R directory, and searched for and file of the form .RData, 
I 
 don't have any. I re-installed R. my problem persists. Any suggestions?
 
 You do have it. Otherwise R would not give that error message.
 Please take a look in the directory that is used as the working 
 directory of R. Note that files beginning with a dot are not visible in 
 the Windows Explorer by default and may not be found with Windows search 

 in default settings.
 
 Best wishes,
 Uwe Ligges
 
 
 
  John 
  
  
  
  
  John David Sorkin M.D., Ph.D.
  Chief, Biostatistics and Informatics
  University of Maryland School of Medicine Division of Gerontology
  Baltimore VA Medical Center
  10 North Greene Street
  GRECC (BT/18/GR)
  Baltimore, MD 21201-1524
  (Phone) 410-605-7119
  (Fax) 410-605-7913 (Please call phone number above prior to faxing) 
David
 Winsemius dwinsem...@comcast.net 12/2/2009 4:40 PM 
  Corrupted datasets have been a fairly commonly observed cause of such 
  problems. Correction is through deletion (or removal to a different 
  directory if you want to check without committing to that solution) of 
 
  the offending .Rdata file.
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help 
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html 
 and provide commented, minimal, self-contained, reproducible code.
 
 Confidentiality Statement:
 This email message, including any attachments, is for th...{{dropped:6}}
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] writing 'output.csv' file

2009-12-04 Thread Maithili Shiva
Dear R helpers
 
Suppose 
 
M - c(1:10)  #  length(M) = 10
N - c(25:50) #  length(N) = 26 
 
I wish to have an outut file giving M and N. So I have tried
 
write.csv(data.frame(M, N), 'output.csv', row.names = FALSE)
 
but I get the following error message 
 
Error in data.frame(M, N) : 
  arguments imply differing number of rows: 10, 26
 
How do I modify my write.csv command to get my output in a single (csv) file 
irrespective of lengths.
 
Plese Guide
 
Thanks in advance
 
Maithili
 


  The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
[[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] writing 'output.csv' file

2009-12-04 Thread Chuck Cleland
On 12/4/2009 5:12 AM, Maithili Shiva wrote:
 Dear R helpers
  
 Suppose 
  
 M - c(1:10)  #  length(M) = 10
 N - c(25:50) #  length(N) = 26 
  
 I wish to have an outut file giving M and N. So I have tried
  
 write.csv(data.frame(M, N), 'output.csv', row.names = FALSE)
  
 but I get the following error message 
  
 Error in data.frame(M, N) : 
   arguments imply differing number of rows: 10, 26
  
 How do I modify my write.csv command to get my output in a single (csv) file 
 irrespective of lengths.

  The first argument to write.csv() is preferably a matrix or data
frame.  If it is something else, write.csv() will try to make it a data
frame.  You may want to create the data frame like this:

data.frame(M = c(M, rep(NA,length(N) - length(M))), N=N)

M  N
1   1 25
2   2 26
3   3 27
4   4 28
5   5 29
6   6 30
7   7 31
8   8 32
9   9 33
10 10 34
11 NA 35
12 NA 36
13 NA 37
14 NA 38
15 NA 39
16 NA 40
17 NA 41
18 NA 42
19 NA 43
20 NA 44
21 NA 45
22 NA 46
23 NA 47
24 NA 48
25 NA 49
26 NA 50

 Plese Guide
  
 Thanks in advance
  
 Maithili
  
 
 
   The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
   [[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.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

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


Re: [R] GLM Question

2009-12-04 Thread Knut Krueger

Peter Flom schrieb:


What do you mean by better?

Dear Peter

Thank you for your kind respons as well. You are right, we are in
constant debate whether it makes sense to remove variables (no matter
whether significant or not) from a total dataset which in itself has a
certain meaning and may not stand for other studies with differing
variables.

However, in biology it is common practice to remove non significant
factors (and sometimes also variables)from data sets (so called: forward
and backward elimination process), usually when they are permanently non
significant on all the paticular positions in the factor list.

Some authors suggest only to remove data which may have similar meanings,
and therefore may be understod as pseudorepliaions.

Best regards Knut

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


Re: [R] Get back to the console with ssh access

2009-12-04 Thread Jakson A. Aquino
On Fri, Dec 04, 2009 at 02:23:18AM +0100, Timothée Poisot wrote:
 I am currently learning how to work with a new shared computer (a Mac pro) in 
 our lab, that is dedicated to execute R code for large simulations (over a 
 few days).
 
 We have a VNC option to remote control the computer, with a shared used 
 session, but this is not really needed in most of the cases. I would like to 
 do some ssh access.
 
 This is pretty straigthforward, and I am able to launch commands using
 
 R -e 'source(myfile.R)' 
 
 However, it could be useful to check the advancement of the computation from 
 time to time, again via ssh.
 
 Is there any way to do this?

On Linux you can type in the terminal (I guess the command will
work in Mac too):

tail -f myfile.Rout

Then you hit Ctrl+C to stop tail from following myfile.Rout.

Another option would be the use of screen (again, this is a *nix
solution that may be available to Mac too). With screen you can
run R interactively detach the session, logout, come back and
reattach the session. But it seems that tail -f is what you
really needs since the R script is finished and you just need to
run it.

-- 
Jakson

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

2009-12-04 Thread Jose Narillos de Santos
Hi all,,I´m using function arima()

I.e
series is my data

model-arima(series,c(1,0,0))
forecast-predict(model,80)
I want to create a variable:
b1-forecast$pred - 1.96*forecast$se
and save in a txt file

but using this:

save(b1, file= b1.txt)

creates afile butwith this  inside:

‹  ]Ò{H“Q ðï~Ÿß|¦›ùÊÊLJI³ÔiÍW*¥þ‘Í-l)˜%¤ 
)Šmæ#)­±,›
ÉйRIñ¸åœÈÊiSÂfµd›bҝôGuážß¹çr9p9œø´»4;‚ 
H‚´Å‘©‰¦­¥žL”#ÎR€ez´
ãÊÁ¹1ìy‡÷3pN8Ä®°{,IÚ6¡¢˜ÊW²–ížàôâ!ã“6éúžù=­à
êÍžó{·â6ƒ½l?øß×OõƒMw_ϐ¬û—¯•5ãëK÷ÖÝ©ÀZ+òÛ×
ô=é„ëæ ÉÊ(•YV·‘÷BçXùÔ(²E2 †uaÍz J
Yj±+P‘tSU[Pt­gíïoÆ...@¶,ŠËx�...@Þ)k¤$™TìÜ $/¼ÈA˜ 
dôz®‡p ÈÀù¢iþ
½Êw™�...@²räÖodœbë¤r@c¾ån€~ô™óW§ }û\M*g 
-¹w†ûšÛŸìj
hfEs! 4¡»Q‘h’Ë6%G ÒöJ 
mhdiÃ...@ã­§‹iÃ¥Â�...@êÐÇ/@£2Ôº èÜM³¡ ôV#
x=†Ý¥l8 h¤jgɨkrÂ¥Â...@õŽ|u=ö¿Ùæ ¡Ånº2
ûÔEÙTŒÍ©ËÔ¬cõꙩX§(Õø,
Á/ë2óM¬š°â°JIÄŠÛ°¬ºjÂÞ­î•~ÄŠ—]êDØ|¹°¿{9£tnË*‘âÿäÈýõ\lr—oö*6a’Ǧ±1:e¨{¢Îˆû'öî°Ü‡{ZÎl^Bb6ØËÌWbGŽ¤¯aåÆeKÿƒ‰5ß—°Ú®ü7™TacM*ŸØZ1…Â-£Wˆ?ëŸ'ô%ÁÅ‚œ0ÿžðBKeÓ²7–å'



Can anyone help me to do  it?

Do you know also a document wich expalin how works and calculates
modelpredictions?

[[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] writing 'output.csv' file

2009-12-04 Thread Maithili Shiva

Dear Mr Signer and Mr Cleland,
 
Thanks a lot for you great help. However, the output which I am getting is as 
given below -
 






x

1;25

2;26

3;27

4;28

5;29

6;30

7;31

8;32

9;33

10;34

 ;35

 ;36

 ;37

 ;38

 ;39

 ;40

 ;41

 ;42

 ;43

 ;44

 ;45

 ;46

 ;47

 ;48

 ;49

 ;50
 
However, my requirement is I should get the csv file as
 
M N
1 25
2 26
3 27 

 
10   34
   35
   36
   37

..
..
   50
 
So that I can acrry out further calcualtions on this output file. Please guide.
 
Regards
 
Maithili

--- On Fri, 4/12/09, Johannes Signer j.m.sig...@gmail.com wrote:


From: Johannes Signer j.m.sig...@gmail.com
Subject: Re: [R] writing 'output.csv' file
To: Maithili Shiva maithili_sh...@yahoo.com
Date: Friday, 4 December, 2009, 10:29 AM


Hello, 

maybe that helps:

write.csv(paste((c(m,rep( ,length(N)-length(M,n, sep=;), output.csv, 
row.names=F)

Johannes


On Fri, Dec 4, 2009 at 11:12 AM, Maithili Shiva maithili_sh...@yahoo.com 
wrote:

Dear R helpers
 
Suppose
 
M - c(1:10)  #  length(M) = 10
N - c(25:50) #  length(N) = 26 
 
I wish to have an outut file giving M and N. So I have tried
 
write.csv(data.frame(M, N), 'output.csv', row.names = FALSE)
 
but I get the following error message
 
Error in data.frame(M, N) :
  arguments imply differing number of rows: 10, 26
 
How do I modify my write.csv command to get my output in a single (csv) file 
irrespective of lengths.
 
Plese Guide
 
Thanks in advance
 
Maithili
 


     The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
       [[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.





[[elided Yahoo 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] Substitute Object not found with NA

2009-12-04 Thread Veronesi, Fabio
Hi everybody,
I'm trying to create a script that picks a txt file with 2 columns of 
coordinates (depth and variable1) and automatically tries to fit several 
polynomial with the function nls().
After  that, it creates a list of observed, predict, residuals and other, and 
then it calculates AIC, RMSD, MAD and R^2.
At the end of the script I create a series of vectors with MAD for all 
polynomials, RMSD for all polynomial and so on, and from a matrix a .csv file.
This script is completely automatic, but there is a problem if one or more 
models don't fit, because if one or more data is missing I cannot create the 
vectors and the matrix, as well.

So, my question is: is it possible to create a vector with a missing object, 
substituting that object with NA in the vector?

For example:
I want to create this vector
Vec1-c(MAD1,MAD2,MAD3,MAD4)
but MAD4 is missing and as a consequence R return an error like this:
object 'MAD4' not found

Is it possible to say to R that if it does not find an object it must 
substitute that object with NA in the vector?

Many Thanks, Fabio


Mr. Fabio Veronesi
Ph.D. student

Cranfield University, Bld.37
School of Applied Sciences
MK43 0AL
Cranfield, Bedfordshire

Tel. +44 (0)7984049316
e-mail: f.veron...@cranfield.ac.uk

[[alternative HTML version deleted]]

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


Re: [R] Solve linear program without objective function

2009-12-04 Thread Hans W Borchers
Andreas Wittmann andreas_wittmann at gmx.de writes:

 
 Dear R-users,
 
 i try to solve to following linear programm in R
 
 0 * x_1 + 2/3 * x_2 + 1/3 * x_3 + 1/3 * x_4 = 0.3
 x_1 + x_2 + x_3 + x_4 = 1
 x_1, x_2, x_3, x_4  0,
 x_1, x_2, x_3, x_4  1
 
 as you can see i have no objective function here besides that i use the 
 following code.
 
 library(lpSolve)
 
 f.obj-c(1,1,1,1)
 f.con-matrix(c(0,2/3,1/3,1/3,
 1,1,1,1,
 1,0,0,0,
 0,1,0,0,
 0,0,1,0,
 0,0,0,1),nrow=6,byrow=TRUE)
 f.dir - c(=, =, , , , )
 f.rhs - c(0.3, 1, 0, 0, 0, 0)
 
 lp (max, f.obj, f.con, f.dir, f.rhs)$solution
 
 the problem is, the condition x_1, x_2, x_3, x_4  0 is not fulfilled.

With strict inequalities x_i  0 your problem will not have a solution. That is
why in linear programming strict inequalities are replaced with non-strict
inequalities, or as the lp_solve manual says:

The inequalities can be =, = or =
 Because all numbers are real values,
 = is the same as  and = is the same as  . 

Try x_i = eps  0 with some eps appropriate for your problem.

Hans Werner

 Any advice would be very helpful.
 
 best regards
 
 Andreas
 


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


[R] Confidence Intervals for proportion according to Blyth, Still Casella

2009-12-04 Thread Öhagen Patrik

Are the confidence Intervals for proportion according to Blyth,Still  Casella 
implemented in R?

Thank you in advance!

Cheers, Patrik
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Problems while plotting with ROCR

2009-12-04 Thread Heiko Strathmann
Hello all,

I have two problems with the ROCR package.

First Problem:
the add=TRUE option does not work for plotting performance objects

The following code is taken from the reference manual (example for
ROCR.hiv, page2)

data(ROCR.hiv)
attach(ROCR.hiv)
pred.svm - prediction(hiv.svm$predictions, hiv.svm$labels)
perf.svm - performance(pred.svm, 'tpr', 'fpr')
pred.nn - prediction(hiv.nn$predictions, hiv.svm$labels)
perf.nn - performance(pred.nn, 'tpr', 'fpr')
plot(perf.svm, lty=3, col=red,main=SVMs and NNs for prediction of
HIV-1 coreceptor usage)

now I see some dotted red ROC curves.
Now after the next command:
plot(perf.nn, lty=3, col=blue,add=TRUE)

there happens exactly the same as if i would call:
plot(perf.nn, lty=3, col=blue)

I now see only some dotted blue ROC curves, the red ones and the main
caption of the plot are gone.

Second problem:
the averaging of multiple performance curves does not work correctly

 (using the same example code, skipping some comands)
data(ROCR.hiv)
attach(ROCR.hiv)
pred.svm - prediction(hiv.svm$predictions, hiv.svm$labels)
perf.svm - performance(pred.svm, 'tpr', 'fpr')
pred.nn - prediction(hiv.nn$predictions, hiv.svm$labels)
perf.nn - performance(pred.nn, 'tpr', 'fpr')

plot(perf.svm, avg=vertical, lwd=3, col=red,
 spread.estimate=stderror,plotCI.lwd=2)

this does not give me an average curve, but multiple ones:
see screenshot:
http://www-stud.uni-due.de/~sfhestra/Bildschirmfoto.png

I already tried reinstalling R and ROCR

thanks for your help

Heiko

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


Re: [R] Substitute Object not found with NA

2009-12-04 Thread Duncan Murdoch

Veronesi, Fabio wrote:

Hi everybody,
I'm trying to create a script that picks a txt file with 2 columns of 
coordinates (depth and variable1) and automatically tries to fit several 
polynomial with the function nls().
After  that, it creates a list of observed, predict, residuals and other, and 
then it calculates AIC, RMSD, MAD and R^2.
At the end of the script I create a series of vectors with MAD for all 
polynomials, RMSD for all polynomial and so on, and from a matrix a .csv file.
This script is completely automatic, but there is a problem if one or more 
models don't fit, because if one or more data is missing I cannot create the 
vectors and the matrix, as well.

So, my question is: is it possible to create a vector with a missing object, 
substituting that object with NA in the vector?

For example:
I want to create this vector
Vec1-c(MAD1,MAD2,MAD3,MAD4)
but MAD4 is missing and as a consequence R return an error like this:
object 'MAD4' not found

Is it possible to say to R that if it does not find an object it must 
substitute that object with NA in the vector?

  

Not automatically, but you can write an expression to do that:

if (exists(MAD4)) MAD4 else NA

or

tryCatch(MAD4, error=function(e) NA)


You could write a function to do this.  I wouldn't recommend trying the 
first version; it will be messy.  But the second is:


defaultNA - function(x) {
 tryCatch(x, error=function(e) NA)
}

then defaultNA(MAD4) will do what you want. 


Duncan Murdoch

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


[R] Odp: Substitute Object not found with NA

2009-12-04 Thread Petr PIKAL
Hi


r-help-boun...@r-project.org napsal dne 04.12.2009 12:09:08:

 Hi everybody,
 I'm trying to create a script that picks a txt file with 2 columns of 
 coordinates (depth and variable1) and automatically tries to fit several 

 polynomial with the function nls().
 After  that, it creates a list of observed, predict, residuals and 
other, and 
 then it calculates AIC, RMSD, MAD and R^2.
 At the end of the script I create a series of vectors with MAD for all 
 polynomials, RMSD for all polynomial and so on, and from a matrix a .csv 
file.
 This script is completely automatic, but there is a problem if one or 
more 
 models don't fit, because if one or more data is missing I cannot create 
the 
 vectors and the matrix, as well.
 
 So, my question is: is it possible to create a vector with a missing 
object, 
 substituting that object with NA in the vector?
 
 For example:
 I want to create this vector
 Vec1-c(MAD1,MAD2,MAD3,MAD4)
 but MAD4 is missing and as a consequence R return an error like this:
 object 'MAD4' not found

Look at ?try function.

I did something similar

#this is just a selection if inputed start values shall be used

fit-try(nls(formula[[i]], data, ...))
} else {
fit-try(nls(formula[[i]], data, start, ...)) }
}

#here is a test whether fit had some result, if yes values are extracted 
from fit if not, NA is put into list

if( class(fit)==try-error) result1[i] - NA  else result1[i] - 
sum(resid(fit)^2, na.rm=T)
if( class(fit)==try-error) result2[[i]] - NA  else result2[[i]] - 
coef(fit)
}

Regards
Petr


 
 Is it possible to say to R that if it does not find an object it must 
 substitute that object with NA in the vector?
 
 Many Thanks, Fabio
 
 
 Mr. Fabio Veronesi
 Ph.D. student
 
 Cranfield University, Bld.37
 School of Applied Sciences
 MK43 0AL
 Cranfield, Bedfordshire
 
 Tel. +44 (0)7984049316
 e-mail: f.veron...@cranfield.ac.uk
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] Odp: How build hist combining data

2009-12-04 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 03.12.2009 10:45:44:

 I would like to ask if there is some simple way for building a hist from 
the
 following data.
 
 mm -c(2,3,0,4,5,0,2,9,0)
 mmm - matrix(mm,ncol=3, nrow=3)
 
 x - c(0,1.45,2.9)
 
 in mmm there are frequencies (each column is separate histogram and each 
row
 corresponds to value of x).
 So that for the first histogram  we have 2 times interval [0,1.45] and 3
 times [1.45,2.90].

If I understand correctly basically you want barplot

barplot(mmm[,1], names.arg=x)

Regards
Petr



 
 Thanks a lot!
 
[[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] multidimensional point.in.polygon??

2009-12-04 Thread Keith Jewell
Hi,

I seek to identify those points in/outside a multidimensional convex hull 
(geometry::convhulln). Any suggestions?

Background just in case I'm going down a really wrong road:

Given an observed data set with one dependent/observed variable (Y) and 
multiple (3 to 10) independent/design variables (X1, X2, ...) I want to 
increase the number of points by interpolating. I'm using expand.grid(X) to 
generate the X points and locfit::predict.locfit to interpolate the Y 
values. No problem so far.

BUT my observed X data set is very far from rectangular, so the set of 
points produced by expand.grid includes many  extrapolations which I'd 
want to remove. I'm aware of the problems of defining extrapolation in 
multiple dimensions and am minded to define it as outside the convex hull, 
hence my question.

In searching r-project.org I came across a thread in which baptiste auguie 
said one general way to do this would be to compute the convex hull 
(?chull) of the augmented set of points and test if the point belongs to 
it; an approach I'd considered generalising to multiple points thus (pseudo 
R code)...

  baseHull - convhulln(baseSet)
  augHull - convhulln(augSet)
  while (augHull != baseHull)
{   augSet - augSet [-(augHull !%in% baseHull)]
augHull - convhulln(augSet)
}

... but this has that horrible loop including a convhulln!

In the (real, typical) test data set I'm using for development baseSet is 5 
columns by 2637 rows while baseHull has only 42 distinct points. If augHull 
has a similarly simple hull, then each time round the loop will remove only 
a few dozen points; I need to remove many thousands.

And (in my naivete) I think there must be a better way of testing for a 
point inside a polygon, I'd have thought convhulln must need to do that 
often!

Thanks in advance for any pointers,

Keith Jewell

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] length of a density curve (or any curve)

2009-12-04 Thread sylvain willart
Hello R users,

When I type

d - density(MyData$x)

I obtain a density object I can plot,

But I wonder if there is a way to easily compute the length of the
density curve ?

( I imagine I could compute the distances between the 512 equally
spaced points using their x and y, but does it exist a smarter way ?)

Regards,

SW

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


Re: [R] Solve linear program without objective function

2009-12-04 Thread Soetaert, Karline

Andreas,
 
I don't know what it is exactly that you want to do, but perhaps you can try 
using limSolve,
which solves for the equations Ex=F, Gx=H. In the code below, lsei calculates 
the least squares solution (min sum(x^2)), xranges estimates the range of your 
variables, and xsample takes a random sample of solutions.
 
f.con-matrix(c(0,2/3,1/3,1/3,
1,1,1,1,
1,0,0,0,
0,1,0,0,
0,0,1,0,
0,0,0,1),nrow=6,byrow=TRUE)
f.rhs - c(0.3, 1, 0, 0, 0, 0)
 
 
E- f.con[1:2,]
G- f.con[-(1:2),]
F- f.rhs[1:2]
H-f.rhs[-(1:2)]
 
require(limSolve)
 
lsei(E=E,F=F,G=G,H=H)
xranges(E=E,F=F,G=G,H=H)
xs - xsample(E=E,F=F,G=G,H=H)
pairs(xs$X)

 
Hope this helps,
 
Karline

[[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] length of a density curve (or any curve)

2009-12-04 Thread milton ruser
hi Sylvain,

did you try ?density

regards

milton

On Fri, Dec 4, 2009 at 7:19 AM, sylvain willart
sylvain.will...@gmail.comwrote:

 Hello R users,

 When I type

 d - density(MyData$x)

 I obtain a density object I can plot,

 But I wonder if there is a way to easily compute the length of the
 density curve ?

 ( I imagine I could compute the distances between the 512 equally
 spaced points using their x and y, but does it exist a smarter way ?)

 Regards,

 SW

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


[[alternative HTML version deleted]]

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


Re: [R] Combinations and joint probabilities

2009-12-04 Thread G. Jay Kerns
Dear Amelia,

On 12/4/09, Amelia Livington amelia_living...@yahoo.com wrote:

 Dear R helpers

 Suppose I have two sets of ranges (interest rates) as

 Range 1 : (7 – 7.50, 7.50 – 8.50, 8.50 – 10.00) with respective
 probabilities 0.42, 0.22 and 0.36.


 Range II : (11-12, 12-14, 14-21) with respective probabilities 0.14, 0.56
 and 0.30 respectively.


 My problem is to form the combinations of these ranges in a decreasing order
 of joint probabilities. It is assumed that these ranges are independent.

 Suppose A represents (7-7.50), B represents (7.50-8.50) and C represents
 (8.50 – 10.00).
 Also let X be (11-12), Y is (12-14) and Z is (14-21).

 These two groups are independent i.e. Prob(A and Y) = P(A) * P(Y)

 So there are 9 combinations possible as (AX, AY, AZ, BX, BY, BZ, CX, CY and
 CZ) respectively with the joint probabilities (0.059, 0.235, 0.126, 0.031,
 0.123, 0.066, 0.05, 0.202, 0.108) respectively.

 My problem is
 (i)   How to obtain these 9 combinations of
 probabilities in the sense how do I obtain the various combinations of these
 two ranges along-with their respective probabilities;
 (ii) How to arrange these 9 probabilities in
 descending order against the respective group combination i.e. for the
 combination AY, the joint probability is maximum at 0.235, followed by CY at
 0.202 and so on.

 I sincerely apologize as perhaps I might not have raised the query properly.
 I have become member of this group today only and its been hardly a week
 since I have started learning R language. I have easily done this in Excel.
 My output should be something like this –

 Combination   Probability
 AY   0.235
 CY   0.202
 AZ  0.126
 BY   0.123
 CZ  0.108
 BZ  0.066
 AX  0.059
 CX  0.050
 BX   0.031


 I request you to guide me.

 Thanking in advance

 Amelia


This sounds like a homework problem, which is a strict no-no for this
list;  be sure to read the Posting Guide.  I will give you the benefit
of the doubt for now, but be warned for the future.

Are you looking for something like the following?

Probspace - expand.grid(LETTERS[1:3], LETTERS[24:26])

marginals - list()
marginals[[1]] - c(0.42, 0.22, 0.36)
marginals[[2]] - c(0.14, 0.56, 0.30)

pdf - expand.grid(marginals)
Probspace$probs - apply(pdf, 1, prod)

# the joint pmf
xtabs(probs ~ Var1 + Var2, data = Probspace)

# sorted by probability
Probspace[order(Probspace$probs), ]

See the prob package for other utilities in this vein. You can make
the labels better with c(7 – 7.50, 7.50 – 8.50, 8.50 – 10.00),
etc, in the first line instead of LETTERS.

Welcome to R.
Jay

P.S.  Please don't send HTML.  Again, in the Posting Guide.


   [[alternative HTML version deleted]]







***
G. Jay Kerns, Ph.D.
Associate Professor
Department of Mathematics  Statistics
Youngstown State University
Youngstown, OH 44555-0002 USA
Office: 1035 Cushwa Hall
Phone: (330) 941-3310 Office (voice mail)
-3302 Department
-3170 FAX
VoIP: gjke...@ekiga.net
E-mail: gke...@ysu.edu
http://people.ysu.edu/~gkerns/

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


Re: [R] writing 'output.csv' file

2009-12-04 Thread jim holtman
The csv file is exactly as you describe it.  ;35 represents two columns of
data.  If you read it is, you will probably get NA as the value in the first
column.  So what problem are you having in reading in the data?

 x - read.csv(textConnection(8;32
+ 9;33
+ 10;34
+  ;35
+  ;36
+  ;37
+  ;38), header=FALSE, sep=';')
 closeAllConnections()
 x
  V1 V2
1  8 32
2  9 33
3 10 34
4 NA 35
5 NA 36
6 NA 37
7 NA 38


On Fri, Dec 4, 2009 at 5:49 AM, Maithili Shiva maithili_sh...@yahoo.comwrote:


 Dear Mr Signer and Mr Cleland,

 Thanks a lot for you great help. However, the output which I am getting is
 as given below -







 x

 1;25

 2;26

 3;27

 4;28

 5;29

 6;30

 7;31

 8;32

 9;33

 10;34

  ;35

  ;36

  ;37

  ;38

  ;39

  ;40

  ;41

  ;42

  ;43

  ;44

  ;45

  ;46

  ;47

  ;48

  ;49

  ;50

 However, my requirement is I should get the csv file as

 M N
 1 25
 2 26
 3 27
 

 10   34
35
36
37

 ..
 ..
50

 So that I can acrry out further calcualtions on this output file. Please
 guide.

 Regards

 Maithili

 --- On Fri, 4/12/09, Johannes Signer j.m.sig...@gmail.com wrote:


 From: Johannes Signer j.m.sig...@gmail.com
 Subject: Re: [R] writing 'output.csv' file
 To: Maithili Shiva maithili_sh...@yahoo.com
 Date: Friday, 4 December, 2009, 10:29 AM


 Hello,

 maybe that helps:

 write.csv(paste((c(m,rep( ,length(N)-length(M,n, sep=;),
 output.csv, row.names=F)

 Johannes


 On Fri, Dec 4, 2009 at 11:12 AM, Maithili Shiva maithili_sh...@yahoo.com
 wrote:

 Dear R helpers

 Suppose

 M - c(1:10)  #  length(M) = 10
 N - c(25:50) #  length(N) = 26

 I wish to have an outut file giving M and N. So I have tried

 write.csv(data.frame(M, N), 'output.csv', row.names = FALSE)

 but I get the following error message

 Error in data.frame(M, N) :
   arguments imply differing number of rows: 10, 26

 How do I modify my write.csv command to get my output in a single (csv)
 file irrespective of lengths.

 Plese Guide

 Thanks in advance

 Maithili



  The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
[[alternative HTML version deleted]]


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





 [[elided Yahoo 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.htmlhttp://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] length of a density curve (or any curve)

2009-12-04 Thread sylvain willart
Yes, sure (and I just did it again)
but I can't see an answer... did I miss sthg ?

regards,

SW

2009/12/4 milton ruser milton.ru...@gmail.com:
 hi Sylvain,

 did you try ?density

 regards

 milton

 On Fri, Dec 4, 2009 at 7:19 AM, sylvain willart sylvain.will...@gmail.com
 wrote:

 Hello R users,

 When I type

 d - density(MyData$x)

 I obtain a density object I can plot,

 But I wonder if there is a way to easily compute the length of the
 density curve ?

 ( I imagine I could compute the distances between the 512 equally
 spaced points using their x and y, but does it exist a smarter way ?)

 Regards,

 SW

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] length of a density curve (or any curve)

2009-12-04 Thread Ted Harding
True enough -- ?density does not address the issue of computing
the length pf the curve!

One simple way of implementing the idea you first thought of
would be on the following lines:

  d - density(MyData$x)
  sum(sqrt(diff(d$x)^2 + diff(d$y)^2))

which simply sums the lengths of the line-segments. You would
get a better approximation to the ideal length by increasing
the value of 'n' in the call to density() (perhaps as a separate
calculation, since a relatively small value of 'n' is likely
to be adeqaute for plotting, but possibly inadequate for the
accurate computation of the length).

Hpoing this helps,
Ted.

On 04-Dec-09 12:41:22, sylvain willart wrote:
 Yes, sure (and I just did it again)
 but I can't see an answer... did I miss sthg ?
 
 regards,
 
 SW
 
 2009/12/4 milton ruser milton.ru...@gmail.com:
 hi Sylvain,

 did you try ?density

 regards

 milton

 On Fri, Dec 4, 2009 at 7:19 AM, sylvain willart
 sylvain.will...@gmail.com
 wrote:

 Hello R users,

 When I type

 d - density(MyData$x)

 I obtain a density object I can plot,

 But I wonder if there is a way to easily compute the length of the
 density curve ?

 ( I imagine I could compute the distances between the 512 equally
 spaced points using their x and y, but does it exist a smarter way ?)

 Regards,

 SW

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


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 04-Dec-09   Time: 13:02:27
-- XFMail --

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


[R] selective subsetting of a correlation matrix

2009-12-04 Thread Lee William
Dear All,
I have a correlation matrix say 'M' (4000x4000) for 4000 genes and I want to
subset it to 'N' (190x190) for 190 genes.
The list of those 190 genes are in variable 't'. So the idea is to read the
names of genes from variable 't' and subset the matrix M accordingly.
Any thoughts are welcome!

Best
Lee

[[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] selective subsetting of a correlation matrix

2009-12-04 Thread Romain Francois

On 12/04/2009 02:18 PM, Lee William wrote:


Dear All,
I have a correlation matrix say 'M' (4000x4000) for 4000 genes and I want to
subset it to 'N' (190x190) for 190 genes.
The list of those 190 genes are in variable 't'. So the idea is to read the
names of genes from variable 't' and subset the matrix M accordingly.
Any thoughts are welcome!

Best
Lee


Hi,

Assuming the correlation matrix has dimnames, you can do :

x[ rownames(x) %in% t, colnames(x) %in% t ]

Here is a reproducible example, please make sure you provide one next time.

x - expand.grid( x1 = 1:2, x2 = 1:2, x3 = 1:2, x4 = 1:2 )
y - cor( x )
t - c(x1, x2)
y[ rownames(y) %in% t, colnames(y) %in% t ]

Romain


--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/Gq7i : ohloh
|- http://tr.im/FtUu : new package : highlight
`- http://tr.im/EAD5 : LondonR slides

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


Re: [R] selective subsetting of a correlation matrix

2009-12-04 Thread jim holtman
Will something like this work for you:

 x - matrix(1:100,10)
 dimnames(x) - list(letters[1:10], LETTERS[1:10])
 x
   A  B  C  D  E  F  G  H  I   J
a  1 11 21 31 41 51 61 71 81  91
b  2 12 22 32 42 52 62 72 82  92
c  3 13 23 33 43 53 63 73 83  93
d  4 14 24 34 44 54 64 74 84  94
e  5 15 25 35 45 55 65 75 85  95
f  6 16 26 36 46 56 66 76 86  96
g  7 17 27 37 47 57 67 77 87  97
h  8 18 28 38 48 58 68 78 88  98
i  9 19 29 39 49 59 69 79 89  99
j 10 20 30 40 50 60 70 80 90 100
 x[c('c','g','j'), c(B,E,I)]
   B  E  I
c 13 43 83
g 17 47 87
j 20 50 90



On Fri, Dec 4, 2009 at 8:18 AM, Lee William leeon...@gmail.com wrote:

 Dear All,
 I have a correlation matrix say 'M' (4000x4000) for 4000 genes and I want
 to
 subset it to 'N' (190x190) for 190 genes.
 The list of those 190 genes are in variable 't'. So the idea is to read the
 names of genes from variable 't' and subset the matrix M accordingly.
 Any thoughts are welcome!

 Best
 Lee

[[alternative HTML version deleted]]

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




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


[R] z to r transformation within print.rma.uni and forest from the package metafor

2009-12-04 Thread Sebastian Stegmann
Dear R community,

 

I'm using the ,metafor'-package by Wolfgang Viechtbauer (Version: 0.5-5) to
calculate random-effects meta-analyses using Correlations and Sample Sizes
as the raw data. 

(By the way: Really a nice piece of work, Wolfgang! Thanks heaps.)

 

I specified the rma.uni' function so that it looks like this:

MAergebnis-rma.uni(ri=PosOutc, ni=N,

mods=NULL,

data=dm, intercept=TRUE, slab=c(dm$Article, dm$StudyNo),

subset=NULL, measure=ZCOR, add=1/2, to=only0,
vtype=LS,

method=DL, weighted=TRUE, level=95, digits=4, btt=NULL,

tau2=NULL, knha=FALSE, control=list())

 

With PosOutc being the column containing the raw correlations and N being
the column with the sample sizes.

 

I assume that this will imply that 

a) although the 'tau2' value is set to NULL, still a random-effects analysis
is calculated

b) the raw correlation coefficients are transformed to fisher-z-values

c) the according variances of the fisher-z-values are calculated from the
sample sizes

d) these calculated z-values and sample sizes are then used to calculate
summary effect and confidence interval limits

e) the resulting object contains z-values and not raw correlations

 

Now, the problem is: 

How do I get the calculated results back into the form of raw correlation
coefficients? (In order to report them in an article.)

I see two cases, where this might be relevant:

 

A) When reporting numeric results:

I tried the following:

print.rma.uni(MAergebnis, transf=transf.ztor)

but then noticed that the following will bring up the same result:

print.rma.uni(MAergebnis)

(When using the z2r and r2z functions out of the psychometric-package
on the separate numbers, the values change, so it can't simply be a matter
of rounding.)

 

B) When drawing a forest plot:

forest(MAergebnis, ., transf=transf.ztor, .)

should to the trick, right?

 

Does anyone have any experience or greater insight knowledge regarding this
little problem? 

Best regards

Sebastian

 

 

 


[[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] Data Manipulation Question

2009-12-04 Thread Gray Calhoun
This is probably far more discussion than the question warranted, but...

On Thu, Dec 3, 2009 at 11:14 PM, David Winsemius dwinsem...@comcast.net wrote:

 On Dec 3, 2009, at 10:52 PM, Gray Calhoun wrote:

 The data import/export manual can elaborate on a lot of these; this is
 all straightforward, although many people would prefer to use a
 relational database for some of the things you mentioned.

 See Wickham's pithy response to this.

Sure.  My (indirect) point is that representing query results as
separate files is usually not the right approach, regardless of
statistical language/package one uses.


 I'm not
 aware of a goto command in R, though (although I could be wrong).

 In fairness to the OP, he did not ask if there were a go-to construct, but
 rather whether there were a gosub construct that supported modular
 programming. My response would have been that calling modular functions
 (i.e., subroutines with defined arguments) is fundamental to R and the key
 to understanding how to use it with grace and efficiency. I would say that
 the concept of functional programming is to a much greater extent supported
 by R than by SAS, whose datastep mechanisms (as I remember them from earlier
 incarnation) in no way supported modular programming. I suspect that S and R
 arose precisely because of the mental straightjackets imposed by SAS.

From the original: Goto Start until File 1 Done.  But, yes, probably
unfair and certainly less informative than your response.


 --
 David.


 --Gray

 On Thu, Dec 3, 2009 at 1:52 PM, John Filben johnfil...@yahoo.com wrote:

 Can R support data manipulation programming that is available in the SAS
 datastep?  Specifically, can R support the following:
 -          Read multiple dataset one record at a time and compare values
 from each; then base on if-then logic write to multiple output files
 -          Load a lookup table and then process a different file; based
 on if-then logic, access and lookup values in the table
 -          Support modular “gosub”programming
 -          Sort files
 -          Date math and conversions
 -          Would it be able to support the following type of logic:
 o   Start
 §  Read Record from File 1
 §  Read Record from File 2
 §  Match
 ·         If Key 1  Key 2 and Key 1  Key 2, Write to output file A
 ·         If Key 1 = Key 2, Write to output file B
 ·         If Key 1  Key 2 and Key 1  Key 2, Write to output file C§
  Goto Start until File 1 Done
  John Filben
 Cell Phone - 773.401.2822
 Email - johnfil...@yahoo.com



       [[alternative HTML version deleted]]


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



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

 David Winsemius, MD
 Heritage Laboratories
 West Hartford, CT



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


Re: [R] selective subsetting of a correlation matrix

2009-12-04 Thread Romain Francois

On 12/04/2009 02:24 PM, Romain Francois wrote:


On 12/04/2009 02:18 PM, Lee William wrote:


Dear All,
I have a correlation matrix say 'M' (4000x4000) for 4000 genes and I
want to
subset it to 'N' (190x190) for 190 genes.
The list of those 190 genes are in variable 't'. So the idea is to
read the
names of genes from variable 't' and subset the matrix M accordingly.
Any thoughts are welcome!

Best
Lee


Hi,

Assuming the correlation matrix has dimnames, you can do :

x[ rownames(x) %in% t, colnames(x) %in% t ]

Here is a reproducible example, please make sure you provide one next time.

x - expand.grid( x1 = 1:2, x2 = 1:2, x3 = 1:2, x4 = 1:2 )
y - cor( x )
t - c(x1, x2)
y[ rownames(y) %in% t, colnames(y) %in% t ]


Or even : y[t,t]

--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/Gq7i : ohloh
|- http://tr.im/FtUu : new package : highlight
`- http://tr.im/EAD5 : LondonR slides

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] set working directory in Windows XP

2009-12-04 Thread Ivan Calandra

Hello everybody,

I'm new in the R world and I'm struggling to set the working directory.
Up to now, I just set it up every time I start R ( 'setwd()' ) but I'd 
like it to be set automatically. I've read the FAQ as well as the help 
on Startup ('?Startup') about the environment variables and profiles but 
I could not understand what to do: which command line, which variable, 
which file etc.


I hope you'll be able to help me.
Thanks a lot in advance,
Ivan

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


Re: [R] multidimensional point.in.polygon??

2009-12-04 Thread baptiste auguie
Hi,

Yet another one of my very naive ideas on the subject: maybe you can
first evaluate the circumscribed and inscribed spheres of the base set
of points (maximum and minimum of their distances to the center of
gravity). Any points within a distance smaller than the infimum is
good, any point further than the supremum is not good. This should be
faster than the calculation of a convex hull for each point. Of course
the usefulness of this first test really depends on how aspherical is
your base convex hull.

I do hope to read a real answer from someone who knows this stuff!

HTH,

baptiste


2009/12/4 Keith Jewell k.jew...@campden.co.uk:
 Hi,

 I seek to identify those points in/outside a multidimensional convex hull
 (geometry::convhulln). Any suggestions?

 Background just in case I'm going down a really wrong road:

 Given an observed data set with one dependent/observed variable (Y) and
 multiple (3 to 10) independent/design variables (X1, X2, ...) I want to
 increase the number of points by interpolating. I'm using expand.grid(X) to
 generate the X points and locfit::predict.locfit to interpolate the Y
 values. No problem so far.

 BUT my observed X data set is very far from rectangular, so the set of
 points produced by expand.grid includes many  extrapolations which I'd
 want to remove. I'm aware of the problems of defining extrapolation in
 multiple dimensions and am minded to define it as outside the convex hull,
 hence my question.

 In searching r-project.org I came across a thread in which baptiste auguie
 said one general way to do this would be to compute the convex hull
 (?chull) of the augmented set of points and test if the point belongs to
 it; an approach I'd considered generalising to multiple points thus (pseudo
 R code)...
 
  baseHull - convhulln(baseSet)
  augHull - convhulln(augSet)
  while (augHull != baseHull)
    {   augSet - augSet [-(augHull !%in% baseHull)]
        augHull - convhulln(augSet)
    }
 
 ... but this has that horrible loop including a convhulln!

 In the (real, typical) test data set I'm using for development baseSet is 5
 columns by 2637 rows while baseHull has only 42 distinct points. If augHull
 has a similarly simple hull, then each time round the loop will remove only
 a few dozen points; I need to remove many thousands.

 And (in my naivete) I think there must be a better way of testing for a
 point inside a polygon, I'd have thought convhulln must need to do that
 often!

 Thanks in advance for any pointers,

 Keith Jewell

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] cycling k times a realization of a random walk.....problems..

2009-12-04 Thread Federico Bonofiglio
hello R-masters.

i have an R-issue here that i don't know if you'd wish to help me  about it:

briefly i'd like to generate many (say hundred) realizations of a random walk, 
execute a few operations on each of them (mean time of return), and graph each 
realization on the same plot.
IN OTHER WORDS I'D LIKE TO IMPOSE A LOOPING CYCLE TO THE COMMAND NOT THE 
ARGUMENT OF THE COMMAND.

for some of these questions i have already a partial answer: my main problem 
here is automatizing the process for 100 times.

my random walk generating function is:

rwalk - function(n,p, x0=0)
         {
          x - rbinom(n,1,p)
          x[which(x==0)] - -1
          y-c(x0,x)
          y - cumsum(y)
           }

THIS IS THE CODE THAT I'D LIKE TO REITERATE

a- rwalk(n,p,x0=0) #whish to generate 100 of those 
#and for each calculate the following
o-which(a==0)
N-length(o) # number of times the walk returns to 0
Nn-(o[-1]-N) # number of steps to get to 0
V-mean(Nn)  # mean time of return to 0


par(mfrow=c(1,1))
plot(0:n, a, type= l, main=..., xlab=tempo, ylab=stato,
ylim=c(...), lwd=3, col=red, lty=1)

par(new=T) 

plot(0:n, b, type= l, main=, xlab=, ylab=,
ylim=c(), lwd=3, col=green, lty=2)

#technically i've tryed to fuse all those parts in a function reiterating k=100 
times with a for cycle, but with no succes, and i dare there must be something 
really disturbing in the code below 

function(k){
for (i in 1:k){
a[i]-rwalk(1e+04,0.5,0)
o[i]-which(a[i]==0)
N[i]-length(o[i]) 
Nn[i]-(o[i][-1]-N[i]) 
V[i]-mean(Nn[i]) 
w-c(V[1]:V[k])
M-mean(w) #mean over all the realizations
par(mfrow=c(1,1))
plot(0:n, a[1], type= l, main=..., xlab=tempo, ylab=stato,
ylim=c(...), lwd=3, col=red, lty=1)

par(new=T) 

plot(0:n, a[i], type= l, main=, xlab=, ylab=,
ylim=c(...), lwd=3, col=c(1:i), lty=2)

}
}   #NOTE: I'VE ALSO TRIED TO REITERATE THE WALK WITH THE rep()
    # t-rep(rwalk(1e+04,0.5,0),100)
     # then of course i have the problem of splicing this ridicolously   #one 
milion long vector in 100 bits of tenthousand, and still goig through all the 
calculations and plotting i meant before

i wonder what..

THANK YOU FOR YOUR PRECIUOS ATTENTION!!! 

  








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


[R] question about invers gamma trancted

2009-12-04 Thread khazaei
Hi
I want to generate from invers gamma distribution truncated but when I use
the rinvegamma() function, the system can not find this function.
Is ther someone to help me please?
thanks
soleiman

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


[R] Error when running Conditional Logit Model

2009-12-04 Thread Hien Nguyen
Dear R-helpers,

I am very new to R and trying to run the conditional logit model using
clogit  command.
I have more than 4000 observations in my dataset and try to predict the
dependent variable from 14 independent variables. My command is as follows

clmtest1 -
clogit(Pin~Income+Bus+Pop+Urbpro+Health+Student+Grad+NE+NW+NCC+SCC+CH+SE+MRD+strata(IDD),data=clmdata)


However, it produces the following errors:

Error in fitter(X, Y, strats, offset, init, control, weights = weights,  :
 NA/NaN/Inf in foreign function call (arg 6)
In addition: Warning messages:
1: In Surv(rep(1, 4096L), Pinmig) : Invalid status value, converted to NA
2: In fitter(X, Y, strats, offset, init, control, weights = weights,  :
 Ran out of iterations and did not converge

I search the error message from R forums but it does not say anything
for Conditional Logit Model.

Please check for me what it says and what should I do to solve it.

Thanks a lot for your help

Hien Nguyen

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

2009-12-04 Thread Pazur, Robert
Dear all,
is it possible to perform logstic type of geographical weighted
regression in R software?
 
thanks in advance.
 
robert.

[[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] latex.table for table with character and numeric columns

2009-12-04 Thread Gerrit Draisma

Hallo,
I have a dataset with one or two columns with character data
and the rest with numeric data.
Using latex.table from the quantreg package produced a table,
but I cannot set the decimals.
For instance:
---
 x-data.frame(Name=c(Jan,Piet,Jan), V=c(1,2.991,3))
 latex.table(as.matrix(x),file=x,caption=x)
 latex.table(as.matrix(x),file=x,caption=x,dec=2)
Error in round(x, dec) : Non-numeric argument to mathematical function

---
Am I not using the right command, or is there a way around?
Thanks,
Gerrit.

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

2009-12-04 Thread Pascale Weber

Hi to all

This is the first time I am quoting a question and I hope, my 
question is not too basic...


For the following data, I wish to draw a fitted curve.

x - c(123,129,141,144,144,145,149,150,158,159,163,174,183,187,242,248)

y - 
c(14.42,26.96,31.3,19.95,36.36,15.4,24.76,35.39,28.07,40.97,26.23,42.83,46.53,14.79,49.18,48.08)


If I plot the data, it looks somehow that a logistic function would 
render good results.


My questions are:

How do I use
 nls and/or SSlogis (or other)
to fit the curve?

How can I see the summary statistics of the fit?

How do I finally draw the line to my x,y (untransformed data) plot?

Any help would be highly appreciated.

Thank you and cheers

Pascale

--
..___

Dr. Pascale Weber
Swiss Federal Research Institute WSL
Zuercherstrasse 111
CH-8903 Birmensdorf
Switzerland

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


Re: [R] length of a density curve (or any curve)

2009-12-04 Thread sylvain willart
Thanks for your answer,

@Dennis Murphy: no, I don't know the functionnal form, this is purely
empirical data

@ Ted Harding: Thank you for your lines of code, they are actually a
pretty smart way...

SW

2009/12/4 Ted Harding ted.hard...@manchester.ac.uk:
 True enough -- ?density does not address the issue of computing
 the length pf the curve!

 One simple way of implementing the idea you first thought of
 would be on the following lines:

  d - density(MyData$x)
  sum(sqrt(diff(d$x)^2 + diff(d$y)^2))

 which simply sums the lengths of the line-segments. You would
 get a better approximation to the ideal length by increasing
 the value of 'n' in the call to density() (perhaps as a separate
 calculation, since a relatively small value of 'n' is likely
 to be adeqaute for plotting, but possibly inadequate for the
 accurate computation of the length).

 Hpoing this helps,
 Ted.

 On 04-Dec-09 12:41:22, sylvain willart wrote:
 Yes, sure (and I just did it again)
 but I can't see an answer... did I miss sthg ?

 regards,

 SW

 2009/12/4 milton ruser milton.ru...@gmail.com:
 hi Sylvain,

 did you try ?density

 regards

 milton

 On Fri, Dec 4, 2009 at 7:19 AM, sylvain willart
 sylvain.will...@gmail.com
 wrote:

 Hello R users,

 When I type

 d - density(MyData$x)

 I obtain a density object I can plot,

 But I wonder if there is a way to easily compute the length of the
 density curve ?

 ( I imagine I could compute the distances between the 512 equally
 spaced points using their x and y, but does it exist a smarter way ?)

 Regards,

 SW

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

 
 E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
 Fax-to-email: +44 (0)870 094 0861
 Date: 04-Dec-09                                       Time: 13:02:27
 -- XFMail --


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


[R] flexmix and mclust help

2009-12-04 Thread osazuta

Hello, 

I'm trying out flexmix and mclust for the first time on some univariate data
which is typically best described as lognormal, but can sometimes be gamma
distributed as well. I first tried using EM on mclust assuming the data was
lognormally distributed and could only get it to work in E mode, i.e. the
equal variance mode. I could never get it to work on V mode [ the warning
message was 

Warning message:
In meV(data, z = z, prior = prior, control = control, Vinv =
parameters$Vinv,  :
  sigma-squared falls below threshold

]

so I gave up even after trying the two suggestions I encountered on the web
(eliminating zeros in the data and changing the version of R and mclust). 
Does anyone understand what's going on here? My EM script in MATLAB has no
problem with this data, but is slow, which is why I want to use R. 

I then tried to understand and use flexmix assuming the data are actually
better described as a gamma mixture. From what I could understand of the
function call I wrote

flextest - flexmix( Data ~ unmap(priors_from_kmeans_call$cluster),
data=Data, k = number_clusters, model = FLXMRglm(family = Gamma ) )

and found

Error in model.frame.default(mo...@fullformula, data = data, na.action =
NULL) :
  invalid type (list) for variable 'chr18_test_binned'

I think it wants a list (like NPreg in the examples, a struct in
MATLAB), but I'm so new at R that I don't really know what I'm doing. 

Can anyone give me a simple example of how take a vector of data and ask it
to perform a gamma mixture EM on it using flexmix, or even more ideally, how
to use do either lognormal or gamma mixtures? Also, are there any lists of
examples that people can use to test agglomerative hclust methods on this
same data (instead of using kmeans) as  initialization for these EM methods?

Thanks a lot for your help. 


-- 
View this message in context: 
http://n4.nabble.com/flexmix-and-mclust-help-tp948545p948545.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] stepAIC function

2009-12-04 Thread Ashta
Hi All,

I am trying to run the following script  but have problem,

coxm- coxph(Surv(sdat$time, sdat$cens)~hd+nawtg+nwwg+ntpg+cy+nseas,data=sdat)
coxm-stepAIC(coxm,~.^2)

The error message is
Error: could not find function stepAIC

I tried to install the package  but I could not find it. Where can i get it?


The other question is that I want to get the Kaplan-Meier Estimate
for each covariate in the model,
Like
covaraite   n Events   Mean, S.E.(mean) ,Median, 95% LCL, 95% UCL
   0 14  10   2.87   .03  2.2
1.938 infi
   1 11  9  1.06  .67  1.1
 0.29   2.48

I used

sdat.fit0 - survfit(Surv(sdat$time, sdat$cens)~sdat$ntpg, data = sdat,
type = kaplan-meier, conf.type=plain)
sdat.fit0

Instead I got the following,


Call: survfit(formula = Surv(sdat$time, sdat$cens) ~ sdat$ntpg, data = sdat,
type = kaplan-meier, conf.type = plain)

   records  n.max   n.start  events   median
0.95LCL   0.95UCL
sdat$ntpg=03576  35763576311  NA  NA  NA
sdat$ntpg=14851  48514851466  NA  NA  NA


I would appreciate if some one can help me.

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] cycling k times a realization of a random walk.....problems..

2009-12-04 Thread Gavin Simpson
On Fri, 2009-12-04 at 05:54 -0800, Federico Bonofiglio wrote:
 hello R-masters.
 
 i have an R-issue here that i don't know if you'd wish to help me
 about it:
 
 briefly i'd like to generate many (say hundred) realizations of a
 random walk, execute a few operations on each of them (mean time of
 return), and graph each realization on the same plot.
 IN OTHER WORDS I'D LIKE TO IMPOSE A LOOPING CYCLE TO THE COMMAND NOT
 THE ARGUMENT OF THE COMMAND.
 
 for some of these questions i have already a partial answer: my main
 problem here is automatizing the process for 100 times.
 
 my random walk generating function is:
 
 rwalk - function(n,p, x0=0)
  {
   x - rbinom(n,1,p)
   x[which(x==0)] - -1
   y-c(x0,x)
   y - cumsum(y)
}
snip /
 #NOTE: I'VE ALSO TRIED TO REITERATE THE WALK WITH THE rep()
 # t-rep(rwalk(1e+04,0.5,0),100)
  # then of course i have the problem of splicing this
 ridicolously   #one milion long vector in 100 bits of tenthousand, and
 still goig through all the calculations and plotting i meant
 before

One way of doing away with the loop, is to just get all the rbinoms you
want and format it appropriately, before cumsum: Try this:

rwalk - function(n, p, x0 = 0, sim = 1)
 {
x - rbinom(n * sim, 1, p)
x[!x] - -1
x - matrix(x, nrow = sim, byrow = TRUE)
x - cbind(rep(x0, sim), x)
y - t(apply(x, 1, cumsum))
return(y)
}

sim is the extra argument, indicating the number of walks you want. Set
it to 100 to get what you need. Each row in the returned matrix is a
random walk of the form you describe.

You can then use the apply() function to compute your statistics on each
row (walk) and aggregate the results, e.g.

 set.seed(123)
 system.time(walks - rwalk(1, p = 0.5, x0 = 0, sim = 100))
   user  system elapsed 
  0.747   0.010   0.759 
 tmp[1:10, 1:10] # first 10 walks, first 10 data in each
  [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]01010   -10   -1   -2-3
 [2,]0   -1   -2   -3   -4   -3   -4   -5   -6-7
 [3,]01210   -10   -1   -2-3
 [4,]010   -10   -10   -10-1
 [5,]010   -10   -1   -2   -3   -4-3
 [6,]0   -1   -2   -3   -4   -5   -4   -5   -4-3
 [7,]0   -1010   -1   -2   -10-1
 [8,]010   -1   -2   -3   -2   -3   -2-1
 [9,]0   -1   -2   -3   -4   -3   -4   -5   -4-3
[10,]0   -1   -2   -3   -2   -3   -4   -5   -4-3
 apply(tmp[1:10, ], 1, function(x) which(x == 0))
[[1]]
[1] 1 3 5 7

[[2]]
[1] 1

[[3]]
[1] 1 5 7

[[4]]
[1] 1 3 5 7 9

[[5]]
[1] 1 3 5

[[6]]
[1] 1

[[7]]
[1]  1  3  5  9 11 17 23 27 29

[[8]]
[1] 1 3

[[9]]
[1] 1

[[10]]
[1] 1

That might make it easier to work with as you only need to generate the
walks once and then develop each summary function independently. If you
start with a small example, say n = 10 and sim = 10, you should be able
to follow the computations and check they are correct.

HTH

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

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


Re: [R] curve fitting to data

2009-12-04 Thread Gabor Grothendieck
A simple y vs log(x) fit seems to work pretty well here:

fit - lm(y ~ log(x))
summary(fit)

plot(y ~ log(x))
abline(fit)

On Fri, Dec 4, 2009 at 9:06 AM, Pascale Weber pascale.we...@wsl.ch wrote:

 Hi to all

 This is the first time I am quoting a question and I hope, my question is
 not too basic...

 For the following data, I wish to draw a fitted curve.

 x - c(123,129,141,144,144,145,149,150,158,159,163,174,183,187,242,248)

 y -
 c(14.42,26.96,31.3,19.95,36.36,15.4,24.76,35.39,28.07,40.97,26.23,42.83,46.53,14.79,49.18,48.08)

 If I plot the data, it looks somehow that a logistic function would render
 good results.

 My questions are:

 How do I use
  nls and/or SSlogis (or other)
 to fit the curve?

 How can I see the summary statistics of the fit?

 How do I finally draw the line to my x,y (untransformed data) plot?

 Any help would be highly appreciated.

 Thank you and cheers

 Pascale

 --
 ..___

 Dr. Pascale Weber
 Swiss Federal Research Institute WSL
 Zuercherstrasse 111
 CH-8903 Birmensdorf
 Switzerland

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

2009-12-04 Thread Terry Therneau
First, note that all attachments are removed from messages sent to
R-help, please use plain text only.  I took the time to bring up the
attachment in a web browser (there is a link to it), but you are
unlikely to get a lot of readers when the question is captured as a pdf.

 1. Tobit regression on the raw data:
   The scale is the residual standard deviation, or estimate of
sigma in the usual linear models terminology.
   For linear regression with uncensored data, the estimate of scale is
independent of the estimate of the other coefficients, and can be
computed at the end.  For censored data this is not so, the scale and
the coefficients must be estimated together.  During the maximization
step the routine uses log(scale), it forces positive coefficients and
also works better numerically; as a consequence the full
variance/covariance matrix includes both beta and log(scale).

2. Tobit regression on the rescaled data.
  You must have rescaled both x and y, since the estimated residual
variance changed.
  I see multiple disadvantages, and no advantages, to regression on
rescaled data.  I know it is common in some fields, but why?  With
respect to your questions on how to interpret rescaled coefficients, I
don't know how to interpret them either.

 3. The residual for a censored observation is not a well defined
quantity.  Hence both the computation and meaning of R^2 are unclear to
me.

Terry Therneau


  Terry Therneau

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


Re: [R] Arules - Association Rules

2009-12-04 Thread Michael Hahsler

Alexandre,

You are mining for association rules with an absolute support count of 
1001*0.01 = 10.1. From your 40 minutes processing time I guess that your 
survey data set is very dense and that results in an enormous number of 
frequent itemsets (potentially up to 2^k - k - 1 which is in your case 
for k=71 about 10^21) which causes you to run out of memory. You have 
the following options:


* increase minimum support (e.g., start with 0.1) and see how low you 
can go without using up all your memory (I don't know how to watch 
memory usage on Windows).


* restrict the maximal length of frequent itemsets by using 
parameter=list(maxlen = 3, support = ...)


If that does not help I will need your dataset and some code to 
reproduce and study the problem.


-Michael



Hi I'm a windows XP user. My notebook have 1gb ram, 160gb hd, processor amd turion64 1,6gh. For processing, it 
takes about 40 minutes. This is the code i used: dados=read.csv(C:/Documents and 
Settings/Administrador/Meus documentos/My Dropbox/Estat?stica/Association Rules/Top2009 alterado.csv, 
header=T, sep=;) library(arules) bin=as(dados, transactions) rules - apriori(bin, 
parameter = list(support = 0.01, confidence = 0.6)) Below is a sample of the file. I export data as CSV from 
excel. I have 71 columns (variabels) an 1001 lines (responses) 1. Churrascaria 2. Supermercado 3. Restaurante 
Self Service 4. Restaurante Chin?s 5. Buffet 6. Sorvete Galp?o Nelore Super Muffato N?o Sabe Jin Jin Planalto 
S?vio Vento Sul Super Muffato N?o Sabe N?o Sabe N?o Sabe Doce Ver?o Ga?cha Super Muffato N?o Sabe N?o Sabe N?o 
Sabe Kibon Tradi??o Ga?cha Super Muffato N?o Sabe N?o Sabe N?o Sabe Nestl? N?o Sabe Super Muffato N?o Sabe N?o 
Sabe Estilo S?vio Rancho Grill Viscardi Akira Akira N?

o Sabe N?o Sabe Thank you very for your helping!!! On 3 dez, 01:46, Steve Lianoglou 
mailinglist.honey...@gmail.com wrote:

 Hi,

 On Wed, Dec 2, 2009 at 6:57 PM, Alexandre - UEL shima...@gmail.com wrote:


  Hello everybody!
  I'm trying some datamining, but i'm having some problems with arule
  package, in the end of processing R had to be closed. I already
  tryied to reinstall the 2.10 version, change the computer and
  realocated more virtual memory.



  Does anyone had this problem to?



  I had a hiphoteses that i have to prepare the data, somehow i don't
  know.



  Thanks for helping!!!


 Can you provide more info here?

 1. I'm assuming since you're talking about reallocating virtual
 memory, or whatever, you're on windows?
 2. What's the exact error you're getting (what's it saying before R
 'had to be closed'?
 3. What's the size of your data? What type of data is it?
 4. How much RAM do you have?
 5. Are you on a 32 or 64 bit system?
 6 What happens if you cut your data in half?
 6. Can you provide a (very small) reproducible example of your data + code?
 ...

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







--
  Michael Hahsler
  email: mich...@hahsler.net
  web: http://michael.hahsler.net

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

2009-12-04 Thread d . m . perkins

Hello all,

Quick question: I want to do posthoc contrasts for a linear mixed  
effects model. However, when trying to use the csimtest function in  
multcomp package I receive an error message saying it cannot find the  
function, even after installing and loading package multcomp.


Any pointers would be greatly appreciated

Daniel

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Converting a Matrix in a colum vector

2009-12-04 Thread Jose Narillos de Santos
Hi all,

Imagine I have a matrix G

with N rows

and M columns

So L=NxM is the number of different cells in my  matrix.

I want to create a column vector F whose size will be F(L,1)

So the fisrt row in F is G(1,1)
Second row in F is G(1,2)
When we arrive to a point M
the element M+1 will be G(2, 1)
Element M+2 will be G(2,2) and so on.

I´m trying but allways error

Easy Example:


G=
2 3 4
8 8 9


N=2
M=3
L=6

F=
2
3
4
8
8
9

Can anyone guide me?


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.


Re: [R] stepAIC function

2009-12-04 Thread David Winsemius


On Dec 4, 2009, at 9:29 AM, Ashta wrote:


Hi All,

I am trying to run the following script  but have problem,

coxm- coxph(Surv(sdat$time, sdat$cens)~hd+nawtg+nwwg+ntpg+cy 
+nseas,data=sdat)

coxm-stepAIC(coxm,~.^2)

The error message is
Error: could not find function stepAIC


Perhaps you have not loaded the package that contains that function?




I tried to install the package  but I could not find it. Where can i  
get it?



The other question is that I want to get the Kaplan-Meier Estimate
for each covariate in the model,


Not exactly sure what that means. Kaplan-Meier estimate of ... what?

Like
covaraite   n Events   Mean, S.E.(mean) ,Median, 95% LCL, 95% UCL
  0 14  10   2.87   .03  2.2
   1.938 infi
  1 11  9  1.06  .67  1.1
0.29   2.48

I used

sdat.fit0 - survfit(Surv(sdat$time, sdat$cens)~sdat$ntpg, data =  
sdat,

type = kaplan-meier, conf.type=plain)
sdat.fit0

Instead I got the following,


Call: survfit(formula = Surv(sdat$time, sdat$cens) ~ sdat$ntpg, data  
= sdat,

   type = kaplan-meier, conf.type = plain)

  records  n.max   n.start  events   median
0.95LCL   0.95UCL
sdat$ntpg=03576  35763576311  NA   
NA  NA
sdat$ntpg=14851  48514851466  NA   
NA  NA


If you have a dataset with 300-400 events out of 3000-4000 subject,  
then why are you expressing surprise that you do not get a non- 
parametric estimate of the median survival? The median is the time at  
which half of the subjects would have experienced an event and you  
only have 1/10 of them with events.


--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


[R] Source code for some grid package documentation

2009-12-04 Thread Sebastien Bihorel

Dear R-users,

I was wondering if anybody would have the source code used to create the 
last figure in the frame.pdf documentation distributed with the grid 
package.


Thanks in advance.

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


Re: [R] csimtest function in multcomp package

2009-12-04 Thread Achim Zeileis

On Fri, 4 Dec 2009, d.m.perk...@qmul.ac.uk wrote:


Hello all,

Quick question: I want to do posthoc contrasts for a linear mixed effects 
model. However, when trying to use the csimtest function in multcomp package 
I receive an error message saying it cannot find the function, even after 
installing and loading package multcomp.


Any pointers would be greatly appreciated


The function is not part of the package interface anymore. The interface 
was generalized and streamlined compared to earlier versions. The the 
package vignettes for the current version.


hth,
Z


Daniel

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

2009-12-04 Thread Meyners, Michael, LAUSANNE, AppliedMathematics
Daniel,
quick guess: There has been a major change in the package some time ago,
with quite a few functions vanishing and others added. So I guess your
recycled code was based on an older version of multcomp. My current
version (1.1-0) does not have csimtest anymore either. I guess you want
to look into ?glht in the same package, and check the archives to find
out more about the changes (and yes, you will have to modify your code
to some extent, at least so had I, it's not just replacing the function
name).
HTH, Michael

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of 
 d.m.perk...@qmul.ac.uk
 Sent: Freitag, 4. Dezember 2009 16:47
 To: r-help@r-project.org
 Subject: [R] csimtest function in multcomp package
 
 Hello all,
 
 Quick question: I want to do posthoc contrasts for a linear 
 mixed effects model. However, when trying to use the csimtest 
 function in multcomp package I receive an error message 
 saying it cannot find the function, even after installing and 
 loading package multcomp.
 
 Any pointers would be greatly appreciated
 
 Daniel
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Problem with date x-axis

2009-12-04 Thread PtitBleu

Hello,

I have a friday problem.
I'm trying to plot the number of measures by day with this command between
the 2008-07-31 and the 2009-11-13 (it works) :
plot(unique(as.Date(strptime(data$date, format=%Y-%m-%d %H:%M:%S))),
measuresbyday)
then I would like to plot vertical lines for each month. 
But it doesn't work because
par()$usr gives
14071.16  14579.84  -7.16  213.16
and
as.numeric(as.POSIXct(unique(as.Date(strptime(data$date, format=%Y-%m-%d
%H:%M:%S)))[1])) corresponding to 2008-08-01 gives
1217376000

I think the last value is ok but I don't understand why the par()$usr values
are so low.

Any idea ?

Thanks in advance and have a nice week-end,
Ptit Bleu.





-- 
View this message in context: 
http://n4.nabble.com/Problem-with-date-x-axis-tp948642p948642.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] Converting a Matrix in a colum vector

2009-12-04 Thread Benilton Carvalho
matrix(t(G), nc=1)

b

On Dec 4, 2009, at 1:19 PM, Jose Narillos de Santos wrote:

 Hi all,
 
 Imagine I have a matrix G
 
 with N rows
 
 and M columns
 
 So L=NxM is the number of different cells in my  matrix.
 
 I want to create a column vector F whose size will be F(L,1)
 
 So the fisrt row in F is G(1,1)
 Second row in F is G(1,2)
 When we arrive to a point M
 the element M+1 will be G(2, 1)
 Element M+2 will be G(2,2) and so on.
 
 I´m trying but allways error
 
 Easy Example:
 
 
 G=
 2 3 4
 8 8 9
 
 
 N=2
 M=3
 L=6
 
 F=
 2
 3
 4
 8
 8
 9
 
 Can anyone guide me?
 
 
 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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Source code for some grid package documentation

2009-12-04 Thread Romain Francois

On 12/04/2009 04:28 PM, Sebastien Bihorel wrote:


Dear R-users,

I was wondering if anybody would have the source code used to create the
last figure in the frame.pdf documentation distributed with the grid
package.


 file.show( vignette( frame, package = grid )$file )


Thanks in advance.



--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/Gq7i : ohloh
|- http://tr.im/FtUu : new package : highlight
`- http://tr.im/EAD5 : LondonR slides

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


Re: [R] set working directory in Windows XP

2009-12-04 Thread Prof Brian Ripley
You set this on the properties of the shortcut you use to start R, 
just like any other Windows application.


R's working directory is always initially the directory it is started 
from.


This *is* in the FAQ:

http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-run-it_003f

even though we do not pretend to give a Windows tutorial.

On Fri, 4 Dec 2009, Ivan Calandra wrote:


Hello everybody,

I'm new in the R world and I'm struggling to set the working directory.
Up to now, I just set it up every time I start R ( 'setwd()' ) but I'd like 
it to be set automatically. I've read the FAQ as well as the help on Startup 
('?Startup') about the environment variables and profiles but I could not 
understand what to do: which command line, which variable, which file etc.


I hope you'll be able to help me.
Thanks a lot in advance,
Ivan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] z to r transformation within print.rma.uni and forest from the package metafor

2009-12-04 Thread Viechtbauer Wolfgang (STAT)
Dear Sebastian,

Glad to hear you find the package useful.

Before I get to your questions, just as an aside - you can leave default 
arguments out of the call. So:

MAergebnis-rma.uni(ri=PosOutc, ni=N, data=dm,
slab=c(dm$Article, dm$StudyNo), measure=ZCOR, method=DL)

would do exactly the same as your call.

As for your questions:

a) Correct. The tau2 argument is only there if you want to fix tau2 to a 
particular value (e.g., for sensitivity analyses). If tau2=NULL (the default), 
then tau2 is estimated from the data. Hmmm, I see how tau2=NULL could be 
misleading. Maybe I should change the default to something else.

b) Correct.

c) Correct (i.e., 1/(ni-3)).

d) And again correct.

e) Correct. Since the meta-analysis is conducted on the transformed values, 
they are also stored in the model object. The results shown (e.g., the model 
intercept) is the estimated value of mu in the transformed units.

Now, if you want the estimated value of mu in correlation units, use:

predict(MAergebnis, transf=transf.ztor)

When you draw a forest plot and you want to show the study results in 
correlation units (and not the transformed units), you have two options:

forest(MAergebnis, transf=transf.ztor)

will backtransform the transformed values (and the corresponding CI bounds). 
Since this is not a linear transformation, the CIs will not be symmetric.

Alternatively, you can use:

forest(MAergebnis, atransf=transf.ztor)

which will transform the x-axis appropriately so that you do get symmetric CIs 
(but a non-linear x-axis).

So, try out:

forest(MAergebnis)
forest(MAergebnis, transf=transf.ztor)
forest(MAergebnis, atransf=transf.ztor)

and see how the plot changes to better understand this.

I hope this helps!

Best,

--
Wolfgang Viechtbauerhttp://www.wvbauer.com/
Department of Methodology and StatisticsTel: +31 (0)43 388-2277
School for Public Health and Primary Care   Office Location:
Maastricht University, P.O. Box 616 Room B2.01 (second floor)
6200 MD Maastricht, The Netherlands Debyeplein 1 (Randwyck)


Original Message
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Sebastian Stegmann Sent: Friday, December 04, 2009 14:28
To: r-help@r-project.org
Subject: [R] z to r transformation within print.rma.uni and forest from the
package metafor

 Dear R community,

 I'm using the ,metafor'-package by Wolfgang Viechtbauer (Version: 0.5-5)
 to calculate random-effects meta-analyses using Correlations and Sample
 Sizes as the raw data.

 (By the way: Really a nice piece of work, Wolfgang! Thanks heaps.)

 I specified the rma.uni' function so that it looks like this:

 MAergebnis-rma.uni(ri=PosOutc, ni=N,
 mods=NULL,
 data=dm, intercept=TRUE, slab=c(dm$Article, dm$StudyNo),
 subset=NULL, measure=ZCOR, add=1/2, to=only0,
   vtype=LS,
 method=DL, weighted=TRUE, level=95, digits=4, btt=NULL,
 tau2=NULL, knha=FALSE, control=list())

 With PosOutc being the column containing the raw correlations and N being
 the column with the sample sizes.

 I assume that this will imply that

 a) although the 'tau2' value is set to NULL, still a random-effects
 analysis is calculated

 b) the raw correlation coefficients are transformed to fisher-z-values

 c) the according variances of the fisher-z-values are calculated from the
 sample sizes

 d) these calculated z-values and sample sizes are then used to calculate
 summary effect and confidence interval limits

 e) the resulting object contains z-values and not raw correlations


 Now, the problem is:

 How do I get the calculated results back into the form of raw correlation
 coefficients? (In order to report them in an article.)

 I see two cases, where this might be relevant:

 A) When reporting numeric results:

 I tried the following:

 print.rma.uni(MAergebnis, transf=transf.ztor)

 but then noticed that the following will bring up the same result:

 print.rma.uni(MAergebnis)

 (When using the z2r and r2z functions out of the
 psychometric-package on the separate numbers, the values change, so it
 can't simply be a matter of rounding.)

 B) When drawing a forest plot:

 forest(MAergebnis, ., transf=transf.ztor, .)

 should to the trick, right?

 Does anyone have any experience or greater insight knowledge regarding
 this little problem?

 Best regards

 Sebastian

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


Re: [R] Logistic geographical weighted regression

2009-12-04 Thread Paul Hiemstra

Pazur, Robert wrote:

Dear all,
is it possible to perform logstic type of geographical weighted
regression in R software?
 
thanks in advance.
 
robert.


[[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.
  
Can't answer your question, but reposting at the r-sig-geo mailing list 
might get you more responses.


cheers,
Paul

--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul

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


Re: [R] Error when running Conditional Logit Model

2009-12-04 Thread David Winsemius


On Dec 4, 2009, at 9:22 AM, Hien Nguyen wrote:


Dear R-helpers,

I am very new to R and trying to run the conditional logit model using
clogit  command.
I have more than 4000 observations in my dataset and try to predict  
the
dependent variable from 14 independent variables. My command is as  
follows


clmtest1 -
clogit(Pin~Income+Bus+Pop+Urbpro+Health+Student+Grad+NE+NW+NCC+SCC+CH 
+SE+MRD+strata(IDD),data=clmdata)



However, it produces the following errors:

Error in fitter(X, Y, strats, offset, init, control, weights =  
weights,  :

NA/NaN/Inf in foreign function call (arg 6)
In addition: Warning messages:
1: In Surv(rep(1, 4096L), Pinmig) : Invalid status value, converted  
to NA
2: In fitter(X, Y, strats, offset, init, control, weights =  
weights,  :

Ran out of iterations and did not converge

I search the error message from R forums but it does not say anything
for Conditional Logit Model.


With that many predictors in a small dataset, you may have created  
matrix singularities. Perhaps you created a stratum where all of the  
subjects experience the event and others where none did so. The  
coefficients might be driven to infinities. Try simplifying the model.





Please check for me what it says and what should I do to solve it.


--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


Re: [R] Source code for some grid package documentation

2009-12-04 Thread Sebastien Bihorel

Thank you Romain,

I appreciate the help.

Romain Francois wrote:

On 12/04/2009 04:28 PM, Sebastien Bihorel wrote:


Dear R-users,

I was wondering if anybody would have the source code used to create the
last figure in the frame.pdf documentation distributed with the grid
package.


 file.show( vignette( frame, package = grid )$file )


Thanks in advance.





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


Re: [R] Saving predict

2009-12-04 Thread Paul Hiemstra

?arima
?write.table

groet,
Paul

Jose Narillos de Santos wrote:

Hi all,,I´m using function arima()

I.e
series is my data

model-arima(series,c(1,0,0))
forecast-predict(model,80)
I want to create a variable:
b1-forecast$pred - 1.96*forecast$se
and save in a txt file

but using this:

save(b1, file= b1.txt)

creates afile butwith this  inside:

‹  ]Ò{H“Q ðï~Ÿß|¦›ùÊÊLJI³Ôi�W*¥þ‘�-l)˜%¤ )Š
mæ#)­±,›
É�¹RIñ¸åœÈÊiSÂfµd›bÒ�ôGuážß¹çr9p9œø´»4;‚ 
H‚´Å‘©‰¦­¥žL�#ÎR€ez´
ãÊ�¹1ìy‡÷3pN8Ä®°{,IÚ6¡¢˜ÊW²–ížà ôâ!ã“6éúžù=­à 
ê��žó{·â6ƒ½l?øß×OõƒMw_�Â�¬û—¯•5ãëK÷Ö�©ÀZ+òÛ×

ô=é„ëæ ÉÊ(•YV·‘÷BçXùÔ(²E2 †ua��z J
Yj±+P‘tSU[Pt­gí�ïoÆ...@¶,ŠËx�...@Þ)k¤$™TìÜ $/¼ÈA˜ 
dôz®‡p ÈÀù¢iþ
½Êw™�...@²räÖo�dœbë¤r@c¾�ån€~ô™óW§ }û\M*g -¹w�†
ûšÛŸìj
hfEs�! 4�¡»Q‘h’Ë6%G ÒöJ 
mhdiÃ...@ã­§‹Â�iÃ¥Â�...@êÃÂ�Ç/@£2Ôº èÂ�ÃœM³¡ ôV#
x=†Ã�Â¥l8 h¤jgɨkrÂ¥Â...@õŽ|u=ö¿Ùæ ¡Ånº2
ûÔEÙTŒ�©ËÔ¬c�õꙩX§(Õø,
�/ë2óM¬š°â°JIÄŠÛ°¬ºjÂÞ­î•~ÄŠ
—]êDØ|¹°¿{9£tnË*‘âÿäÈýõ\lr—oö*6a’Ǧ±1:e¨{¢Îˆû'öî°Ü‡{ZÎl^Bb6ØËÌWbGŽ¤¯aåÆeKÿƒ‰5ß—°Ú®ü7™Ta�cM*ŸØZ1…Â-£Wˆ?ëŸ'ô%�Å‚œ0ÿžðBKeÓ²7–å'



Can anyone help me to do  it?

Do you know also a document wich expalin how works and calculates
modelpredictions?

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



--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul

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


Re: [R] question about invers gamma trancted

2009-12-04 Thread David Winsemius


On Dec 4, 2009, at 9:02 AM, khaz...@ceremade.dauphine.fr wrote:


Hi
I want to generate from invers gamma distribution truncated but when  
I use

the rinvegamma() function, the system can not find this function.
Is ther someone to help me please?


Check your spledding.


thanks
soleiman

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


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


Re: [R] Dividing a pixel image into factors - (cut.im(), cut.default())

2009-12-04 Thread Glen Sargeant

Lauren,

I think (?) you mean to say that you wish to create a factor and control the
range of values assigned to each level.

The breaks argument can specify either the number of intervals you desire
OR the values you wish to use to define levels of your factor.  See '?cut'
and the following example:

 #A numeric vector
 x - 1:10
 
 #Assign equal number of values
 #2 each of 2 automatically 
 #determined intervals
 levels1 - cut(x,breaks=2)
 
 #User-specified intervals
 levels2 - cut(x,breaks=c(0,3,Inf))
 
 data.frame(x,levels1,levels2)
x levels1 levels2
1   1 (0.991,5.5]   (0,3]
2   2 (0.991,5.5]   (0,3]
3   3 (0.991,5.5]   (0,3]
4   4 (0.991,5.5] (3,Inf]
5   5 (0.991,5.5] (3,Inf]
6   6(5.5,10] (3,Inf]
7   7(5.5,10] (3,Inf]
8   8(5.5,10] (3,Inf]
9   9(5.5,10] (3,Inf]
10 10(5.5,10] (3,Inf]

'Inf' is an easy way to create an interval that contains all values larger
than some cutoff.

Good luck with your analysis,

Glen


Gough Lauren wrote:
 
 I have a numeric pixel image which I would like to divide into factors
 for analysis in Spatstat.  I have found that I can use cut.im() function
 to divide the range of pixel values into a series of equal length
 intervals (e.g. if my pixels values range from 0 to 60,
 cut.im(X.im,breaks=2) will produce two factors one containing pixel
 values 0-30 and one containing pixel values of 30 - 60, or thereabouts).
 
 However, I would like to specify the pixel value at which the factors
 are created - e.g. create one factor containing pixel values of 0-5 and
 another factor containing all other pixel values.  I have been
 struggling to work out how to do this using either cut.im() or
 cut.default().  Can anyone help?
 


-
Glen Sargeant
Research Wildlife Biologist
-- 
View this message in context: 
http://n4.nabble.com/Dividing-a-pixel-image-into-factors-cut-im-cut-default-tp948346p948676.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] Apparent different in symbol scaling between xyplot and grid.points

2009-12-04 Thread Sebastien Bihorel

Dear R-users,

For the past few days, I have been trying to find the reason why some of 
my plots were showing symbols of different sizes, while I thought I was 
using the same .cex arguments everywhere. The problem is exemplified by 
the following example code where the xyplot and grid.points functions 
are used. The scaling factor is set to 0.84 in both the functions 
settings, but one can see that, in the pdf file, the blue symbols 
plotted by xyplot are smaller than the single black symbol created by 
grid.points. Playing with the trellis settings did not seem to solve the 
problem. I am missing a hidden scaling factor somewhere, but don't know 
where to look anymore


I would greatly appreciate the feedback of the list on this issue.

library(lattice)
library(grid)

pdf(file=test.pdf)

df - data.frame(a=1:12,b=1:12,c=rep(1:4,each=3))

#trellis.par.set(superpose.symbol=list(cex=1))

xyplot(b~a|c,
  data=df,
  panel = function(x,y){
panel.xyplot(x,y,pch=3,cex=0.84)}
  )

str(trellis.par.get())  
str(get.gpar()) 


grid.points(x=100,y=85,pch=3,gp=gpar(cex=0.84))

dev.off()

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


Re: [R] Logistic geographical weighted regression

2009-12-04 Thread David Winsemius


On Dec 4, 2009, at 6:55 AM, Pazur, Robert wrote:


Dear all,
is it possible to perform logstic type of geographical weighted
regression in R software?


We even have a fortune for such questions:

 library(fortunes)
 fortune(Yoda)

Evelyn Hall: I would like to know how (if) I can extract some of the  
information from the summary of my nlme.

Simon Blomberg: This is R. There is no if. Only how.
   -- Evelyn Hall and Simon 'Yoda' Blomberg
  R-help (April 2005)

Try the geospatial Task View as a start:
http://finzi.psych.upenn.edu/views/Spatial.html

And perhaps:
RSiteSearch(spatial logistic)





David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


Re: [R] R and eclipse

2009-12-04 Thread karina lopez
Sorry, but i was out for two days!
I just want to call R scripts from java code. So i think i need to review
the jri and the REngine API.
I will tell you whatever i find.
Thank you so much, because i was really lost!

2009/12/4 Romain Francois romain.franc...@dbmail.com

 On 12/03/2009 08:43 PM, Gene Leynes wrote:


 I thought of your email when I ran across this link:

 http://romainfrancois.blog.free.fr/index.php?post/2009/09/02/R-capable-version-of-ant


 I don't understand why you post this link with regards to this question.
 The link is about the ant package that lets you have R code inside an ant
 build script.

 If you want to call R from java, look at jri (part of rJava) and the
 REngine API.

 If you want to call java from R, use rJava.


 I think that you would have word your question more carefully for a longer
 response.


 yes please.


 Also, I use StatEt almost everyday.  It works great with R.  I have not
 used
 Eclipse for any other language.

 On Wed, Dec 2, 2009 at 12:20 PM, catuxa-2catuxa...@gmail.com  wrote:


   I found the eclipse plugin for R StatEt, hass anyone already worked
 with
 it?
   It's posible to put inside of java code a R script with it?
   Thank you


 --
 Romain Francois
 Professional R Enthusiast
 +33(0) 6 28 91 30 30
 http://romainfrancois.blog.free.fr
  |- http://tr.im/Gq7i : ohloh
 |- http://tr.im/FtUu : new package : highlight
 `- http://tr.im/EAD5 : LondonR slides



[[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] Machine Learning and Sample Size

2009-12-04 Thread Richard Liu
In developing a machine learner to classify sentences in plain text
sources of scientific documents I have been using the caret  
package and
following the procedures described in the vignettes.  What I miss  
in the
package -- but quite possibly I am overlooking it! -- is functions  
that allow
me to estimate whether a model has too much variance or too much  
bias.  In
particular, I am looking for something that helps me compare the  
training and
test errors as functions of training set size.  Clearly, I can  
program
something in R, but if there is already a function in some package  
to do that,
I would prefer to use it, of course.
Regards,
Richard
[[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] Renaming columns of a data.frame

2009-12-04 Thread Kevin Wright
A question that has come up a few times on r-help is how to rename columns
of a data.frame.  There are several ways to do this by hand (see the list
archives).  There is also a 'rename' function in the reshape package.

I often use the 'transform' function shortly after reading in a data file
and wanted to have a renaming function that has a syntax consistent with the
'transform' function (unlike 'rename', whose arguments have a reverse syntax
compared to 'transform').

Here is my attempt at a rename function similar to 'transform'.
Improvements are welcome.

ren - function(`_data`, ...){
  # Influenced by transform.data.frame
  e - unlist(list(...))
  inx - match(e, names(`_data`))
  if(any(is.na(inx)))
stop(Couldn't find these columns in the data: ,
 paste(as.vector(e)[is.na(inx)], collapse= ) )
  names(`_data`)[inx] - names(e)
  return(`_data`)
}

d0 - data.frame(Year = c(2009, 2009, 2009),
 Mst = c(27.9, 28.9, 31.0),
 Yield = c(110, 180.1, 25))
ren(d0, yield='Yield')
ren(d0, 'yield'='Yield')
ren(d0, yield='Yield', year='Year')
ren(d0, yield='Yield', mst='Mst')
ren(d0, yield='YIELD', mst='MST') # Error caught.
# ren(d0, yield=Yield, year=Year)  # Fails.  Not caught.  Might be nice to
allow this syntax.


-- 
Kevin Wright

[[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] Three-dimensional (3D) movement using 'R'

2009-12-04 Thread David Winsemius


On Dec 4, 2009, at 7:07 AM, StRose, Suzanne wrote:


Hi again,

Apologies for the last email I forwarded. Apparently, my data was  
not legible. So, I have a question regarding the construction of 3D  
graphs in ‘R’, BUT these graphs also need to illustrate movement  
(with time) of the prostate gland (using radiological techniques).   
I am not sure how to do this in ‘R’ although I’m sure there is some  
way of doing it.


Below, I have copied and pasted some of the data on which I’m  
working. The data are for axial images of the prostate for one  
patient at 10 time points. On the axial images, A=anterior and  
positive; L=left and positive, so that A negative=posterior and L  
negative =right (see Figure 1 below). The signs (positive and  
negative) indicate movement away from or toward the baseline,  
respectively. So, any deviation away from the baseline is ‘+’ and  
any excursion toward baseline is negative (with the baseline  
indicated by Time=0). [Vector means the largest average directional  
change relative to the nominated direction of assessment; numbers  
are in mm].




It may be clear to radiographers in the audience, but what those 4 x n  
numbers represent is not clear to me. Are they the lateral and AP  
boundaries of the prostate? What you write suggests these might be  
called relative vectors, i.e. any point would be the vector sum? And  
why would we be plotting locations in 3d when this is an axial slice?


I would like to plot 3D graphs illustrating movement of the prostate  
with time for each of the four patients but do not know how.


Apologies again for the first email. I’ve attached an Excel file  
(hope this is okay) with the same data as in Table 1.


Hopefully this is a bit clearer.

Thanks.

Best wishes,
Suzanne


Table 1
Patient_Axial
Time
Vector L
Vector R
Vector A
Vector P
316868HO_DGE_cine1_ax_px

SNIPPED DATA that arrived as an xls file to my mail client ... since I  
suspect it did not reach most of the list: This is an R form of the  
data from what appears to be one patient as all rows are labeled:  
316868HO_DGE_cine1_ax_px. Note to Suzanne... do not use spaces in R  
variable names.


 dput(pat1)
structure(list(Time = 0:10, VectorL = c(0, 1.6, 0.4, 0.4, 0.4,
0.4, 0.4, 0.4, 0.3, 0, 0.2), VectorR = c(0, 1.5, 0.3, 0.3, 0.3,
1.6, 1.6, 1.8, 2.5, 2.3, -0.3), VectorA = c(0, 0, -0.3, -0.3,
-0.3, -0.3, -0.3, -0.3, -0.4, -0.3, -0.2), VectorP = c(0, 1.9,
-0.1, -0.1, -0.1, 0.1, 0.1, -0.1, 0.1, 0.4, 0.2)), .Names = c(Time,
VectorL, VectorR, VectorA, VectorP), class = data.frame,  
row.names = c(NA,

-11L))





Figure 1.


image001.gif



Suzanne St.Rose (DVM, MSc, PhD)





Data_Three dimensional_01.xls


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


Re: [R] Question about R Functions

2009-12-04 Thread Uwe Ligges



Stephanie Cooke wrote:

Is there a place to find the code for R functions like lsoda? Thanks



Yes, all code is in the source version of the package that contains that 
function.


Best,
Uwe Ligges




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


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


Re: [R] Apparent different in symbol scaling between xyplot and grid.points

2009-12-04 Thread baptiste auguie
Hi,

I think the size mismatch occurs because of a different default for
the fontsize (and grid.points has a size of 1 character by default).
Compare the following two examples,

# default
grid.newpage()
pushViewport(viewport(x=unit(0.5, npc), y=unit(0.5, npc)))
lplot.xy(data.frame(x=0.55,y=0.5),type=p, pch=3)
grid.points(x=0.45,y=0.5, pch=3, gp=gpar(col=red))


trellis.par.set(fontsize, list(points=12))

grid.newpage()
pushViewport(viewport(x=unit(0.5, npc), y=unit(0.5, npc)))
lplot.xy(data.frame(x=0.55,y=0.5),type=p, pch=3)
grid.points(x=0.45,y=0.5, pch=3, gp=gpar(col=red))

HTH,

baptiste

2009/12/4 Sebastien Bihorel sebastien.biho...@cognigencorp.com:
 Dear R-users,

 For the past few days, I have been trying to find the reason why some of my
 plots were showing symbols of different sizes, while I thought I was using
 the same .cex arguments everywhere. The problem is exemplified by the
 following example code where the xyplot and grid.points functions are used.
 The scaling factor is set to 0.84 in both the functions settings, but one
 can see that, in the pdf file, the blue symbols plotted by xyplot are
 smaller than the single black symbol created by grid.points. Playing with
 the trellis settings did not seem to solve the problem. I am missing a
 hidden scaling factor somewhere, but don't know where to look anymore

 I would greatly appreciate the feedback of the list on this issue.

 library(lattice)
 library(grid)

 pdf(file=test.pdf)

 df - data.frame(a=1:12,b=1:12,c=rep(1:4,each=3))

 #trellis.par.set(superpose.symbol=list(cex=1))

 xyplot(b~a|c,
      data=df,
      panel = function(x,y){
        panel.xyplot(x,y,pch=3,cex=0.84)}
      )

 str(trellis.par.get())      str(get.gpar())
 grid.points(x=100,y=85,pch=3,gp=gpar(cex=0.84))

 dev.off()

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

2009-12-04 Thread Allen L

Dear R forum,
I want to replace all the elements in a data frame (dd) which match the
character x with 0.
What's the most elegant way of doing this (there must be an easy way which
I've missed)? I settled on the following loop:

for(i in 5:12){# These are the column of dd I am interested
in
dd[which(dd[,i]==x),i]-0
}

The problem with this is that the columns which used to contain x are
still considered factors and I am unable to coerce them into numeric:

 mean.species.biomass-colMeans(as.numeric(dd.p[,5:12]))
Error in inherits(x, data.frame) : 
  (list) object cannot be coerced to type 'double'

I'm tried unclassing  reclassing, other functions etc. but nothing seems to
work. What is wrong?
Thanks in advance,
Allen
-- 
View this message in context: 
http://n4.nabble.com/Class-attributes-tp948693p948693.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] How to compute contrast where there are interaction terms in the linear model?

2009-12-04 Thread Peng Yu
On Tue, Dec 1, 2009 at 4:04 PM, Charles C. Berry cbe...@tajo.ucsd.edu wrote:
 On Tue, 1 Dec 2009, Peng Yu wrote:

 Could somebody recommend some textbook how to compute contrast when
 there are interactions terms? Applied Linear Regression Models
 (book) mentioned contrast, but I cannot extend it to the case where
 there are interaction terms.


 Textbook? Schmextbook!

 You have the power of R at your fingertips!

 Use it to explore concepts you are trying to wrap your brain around!


 df - expand.grid(x1=1:20,x2=factor(letters[1:2]))
 vanilla - model.matrix(~0+poly(x1,degree=3), df )
 matplot(row( vanilla) , vanilla, type='b')
 inter -  model.matrix(~0+poly(x1,degree=3):x2, df )
 matplot(row( inter ) , inter, type='b')

I don't understand. Where the contrast is?

BTW, what does 'schmextbook' mean?

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


Re: [R] Class attributes

2009-12-04 Thread jim holtman
Here a way of doing it:

for (i in 5:12){
# convert to character so you can substitute 'x'
a - as.character(dd[,i])
a[a == 'x'] - '0'  replace with zero
dd[,i] - as.numeric(a)
}

On Fri, Dec 4, 2009 at 11:55 AM, Allen L allen.laroc...@gmail.com wrote:


 Dear R forum,
 I want to replace all the elements in a data frame (dd) which match the
 character x with 0.
 What's the most elegant way of doing this (there must be an easy way which
 I've missed)? I settled on the following loop:

 for(i in 5:12){# These are the column of dd I am
 interested
 in
 dd[which(dd[,i]==x),i]-0
 }

 The problem with this is that the columns which used to contain x are
 still considered factors and I am unable to coerce them into numeric:

  mean.species.biomass-colMeans(as.numeric(dd.p[,5:12]))
 Error in inherits(x, data.frame) :
  (list) object cannot be coerced to type 'double'

 I'm tried unclassing  reclassing, other functions etc. but nothing seems
 to
 work. What is wrong?
 Thanks in advance,
 Allen
 --
 View this message in context:
 http://n4.nabble.com/Class-attributes-tp948693p948693.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.htmlhttp://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] Class attributes

2009-12-04 Thread David Winsemius


On Dec 4, 2009, at 11:55 AM, Allen L wrote:



Dear R forum,
I want to replace all the elements in a data frame (dd) which match  
the

character x with 0.
What's the most elegant way of doing this (there must be an easy way  
which

I've missed)? I settled on the following loop:

for(i in 5:12){# These are the column of dd I am  
interested

in

dd[which(dd[,i]==x),i]-0
}


The problem with this is that the columns which used to contain x  
are

still considered factors and I am unable to coerce them into numeric:


Converting the labels of fac.obj (a factor object) to numeric values  
is a FAQ (I forget the number, 7.something)


as.numeric(as.character( fac.obj ))

Factors are internally sets of numbers, but those numbers are not  
generally what people assign meaning to, and certainly not in your  
case where you assigned the character 0 to those rows where the  
labels were previously x.



mean.species.biomass-colMeans(as.numeric(dd.p[,5:12]))
Error in inherits(x, data.frame) :

 (list) object cannot be coerced to type 'double'

I'm tried unclassing  reclassing, other functions etc. but nothing  
seems to

work. What is wrong?
Thanks in advance,
Allen
--

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


[R] grep() exclude certain patterns?

2009-12-04 Thread Peng Yu
The external grep program has an option -v to select non-matching
lines. I'm wondering if how to exclude certain patterns in grep() in
R?

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


Re: [R] grep() exclude certain patterns?

2009-12-04 Thread Duncan Murdoch

On 04/12/2009 12:52 PM, Peng Yu wrote:

The external grep program has an option -v to select non-matching
lines. I'm wondering if how to exclude certain patterns in grep() in
R?
  


?grep

Duncan Murdoch

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


[R] Standard deviation for each element in a set of matrices

2009-12-04 Thread Muhammad Rahiz

Hello R-users,

I would like to know how to find the standard deviation for each element 
in a set of matrices.


Given the following files,

   File1File2File3
   1 1 1   4 4 4   7 7 7
   2 2 2   5 5 5   8 8 8
   3 3 3   6 6 6   9 9 9

I want to calculate the standard deviation for every cell in the file 
(I'm using gridded data). The desired output is


   Output
   3 3 3
   3 3 3
   3 3 3


Thanks.

Muhammad

--
Muhammad Rahiz  |  Doctoral Student in Regional Climate Modeling

Climate Research Laboratory, School of Geography  the Environment  
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom 
Tel: +44 (0)1865-285194	 Mobile: +44 (0)7854-625974

Email: muhammad.ra...@ouce.ox.ac.uk

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


[R] User's function

2009-12-04 Thread Lisa

Hello, All,

I want to write a function to do some works based on the arguments. For
example, bind some variables (arguments) as this:

myfunction - function(arg1, arg2, arg3, …)
{  
  x - cbind(arg1, arg2, arg3, …)  
}

myfunction(arg1, arg2, arg3, …)

The function can automatically determine the number of arguments and bind
them, which means if I assign 2 arguments, the function can bind those two
arguments, or if I assign 3 arguments, the function can bind those three
arguments, and so on. Here assume the arguments are all continuous variables
and have the same length. Is it possible?

I would appreciate if some one can help me. Thanks!

Lisa

-- 
View this message in context: 
http://n4.nabble.com/User-s-function-tp948737p948737.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Can we get rid of bar charts with error bars?

2009-12-04 Thread Greg Snow
This reminds me of a quote I saw once (I think it may have been in one of those 
Murphy's Laws calendars), my parahpase:

If you make someone think that they are thinking,
They will love you for it.
If you make them actually think,
They will hate you for it.

This explains why people love pie charts and hate more effective graphs.

-- 
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 Jim Lemon
 Sent: Thursday, December 03, 2009 7:58 PM
 To: Frank E Harrell Jr
 Cc: r-help@r-project.org
 Subject: Re: [R] Can we get rid of bar charts with error bars?
 
 On 12/04/2009 12:56 AM, Frank E Harrell Jr wrote:
  Bar charts with error bars are far inferior to dot charts and other
  types of displays.  One of many problems is demonstrated if you draw
 a
  bar chart displaying temperature in F then re-draw it on the degrees
 C
  scale.  See http://biostat.mc.vanderbilt.edu/DynamitePlots for much
  more information.  The error bars lull us into an assumption that
  symmetric confidence intervals are OK, among other things.
 
  Frank
 
 I could promote the dispersion function as capable of displaying
 asymmetric confidence intervals on whatever location indicators you
 prefer (have a look at the second example for hierobarp for example),
 but the problem is deeper than that. The point of graphic displays is
 to
 convey information to someone else, not to tell ourselves what we
 already know. Do people cheat with pie charts, bar charts, etc? Sure,
 and we could cheat with dot charts, too. Graphic displays are typically
 shown to an audience that knows less about the topic than the presenter
 in the hope that an obscure relationship will be clarified. If I am
 presenting to colleagues in my field, I will use much more informative
 and difficult to understand graphics than if I am summarizing the same
 results to the general public. If both groups leave the respective
 presentations enlightened, I have done well.
 
 Jim
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] User's function

2009-12-04 Thread baptiste auguie
Hi,

try ?do.call

do.call(cbind, replicate(3, 1:10, simplify=FALSE))

HTH,

baptiste

2009/12/4 Lisa lisa...@gmail.com:

 Hello, All,

 I want to write a function to do some works based on the arguments. For
 example, bind some variables (arguments) as this:

 myfunction - function(arg1, arg2, arg3, …)
 {
  x - cbind(arg1, arg2, arg3, …)
 }

 myfunction(arg1, arg2, arg3, …)

 The function can automatically determine the number of arguments and bind
 them, which means if I assign 2 arguments, the function can bind those two
 arguments, or if I assign 3 arguments, the function can bind those three
 arguments, and so on. Here assume the arguments are all continuous variables
 and have the same length. Is it possible?

 I would appreciate if some one can help me. Thanks!

 Lisa

 --
 View this message in context: 
 http://n4.nabble.com/User-s-function-tp948737p948737.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] shorten str() output for long list

2009-12-04 Thread Greg Snow
An alternative to str is the TkListView function in the TeachingDemos package.  
You still get the long listing, but it is in a separate window that you can 
control the scrolling on by hand.  For more complicated lists/objects it 
provides a tree structure so that you can look at only the detailed parts that 
you are interested in.

Hope this helps,

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


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Peng Yu
 Sent: Thursday, December 03, 2009 8:11 PM
 To: r-h...@stat.math.ethz.ch
 Subject: [R] shorten str() output for long list
 
  x=split(1:1000,1:1000)
  str(x)
 
 Although str() can suppress long output for vectors, but it can not
 suppress long output for list. I'm wondering how to suppress the
 output for long lists.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] How to compute contrast where there are interaction terms in the linear model?

2009-12-04 Thread Charles C. Berry

On Fri, 4 Dec 2009, Peng Yu wrote:


On Tue, Dec 1, 2009 at 4:04 PM, Charles C. Berry cbe...@tajo.ucsd.edu wrote:

On Tue, 1 Dec 2009, Peng Yu wrote:


Could somebody recommend some textbook how to compute contrast when
there are interactions terms? Applied Linear Regression Models
(book) mentioned contrast, but I cannot extend it to the case where
there are interaction terms.



Textbook? Schmextbook!

You have the power of R at your fingertips!

Use it to explore concepts you are trying to wrap your brain around!



df - expand.grid(x1=1:20,x2=factor(letters[1:2]))
vanilla - model.matrix(~0+poly(x1,degree=3), df )
matplot(row( vanilla) , vanilla, type='b')
inter -  model.matrix(~0+poly(x1,degree=3):x2, df )
matplot(row( inter ) , inter, type='b')


I don't understand. Where the contrast is?


The numbered curves are the terms of polynomial contrasts.

See

?poly
?contr.poly
and note

all( contr.poly(5) == poly(1:5,degree=4) )






BTW, what does 'schmextbook' mean?



Well, repeating a word and prepending 'schm' (in place of the initial 
consonant sound, if any) is a slang idiom for asserting low regard for the 
idea expressed by the word.


As in 'Birthday-Schmirthday' when moaning about getting older:


http://www.berkeleydailyplanet.com/issue/2009-01-29/article/32134?headline=First-Person-Birthday-Schmirthday-Whinings-on-Mortality


or  'Middle-schmiddle' which expresses low regard for the 'middle' 
policy, see


http://aussiethule.blogspot.com/2006/03/olmerts-middle-schmiddle.html

Or 'Nilsson-Schmilsson', a self-deprecating title for an album by Harry 
Nilsson:


http://en.wikipedia.org/wiki/Nilsson_Schmilsson

Or 'textbook-schmextbook', in which I express the idea that a textbook 
really isn't needed.


Chuck


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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:cbe...@tajo.ucsd.edu   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] Standard deviation for each element in a set of matrices

2009-12-04 Thread Phil Spector

Muhammad -
   Here's one way:

files = c('File1','File2','File3')
themats = lapply(files,read.table)
ans = matrix(0,3,3)
for(i in 1:3)for(j in 1:3)ans[i,j] = sd(sapply(themats,function(x)x[i,j]))

   Here's another

files = c('File1','File2','File3')
themats = lapply(files,read.table)
ans = 
outer(1:3,1:3,Vectorize(function(i,j)sd(sapply(themats,function(x)x[i,j]


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


On Fri, 4 Dec 2009, Muhammad Rahiz wrote:


Hello R-users,

I would like to know how to find the standard deviation for each element in a 
set of matrices.


Given the following files,

  File1File2File3
  1 1 1   4 4 4   7 7 7
  2 2 2   5 5 5   8 8 8
  3 3 3   6 6 6   9 9 9

I want to calculate the standard deviation for every cell in the file (I'm 
using gridded data). The desired output is


  Output
  3 3 3
  3 3 3
  3 3 3


Thanks.

Muhammad

--
Muhammad Rahiz  |  Doctoral Student in Regional Climate Modeling 
Climate Research Laboratory, School of Geography  the Environment 
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom Tel: +44 (0)1865-285194 
Mobile: +44 (0)7854-625974

Email: muhammad.ra...@ouce.ox.ac.uk

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



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

2009-12-04 Thread Brock Tibert
Hi Everyone,

I am new to R and just trying my hand at plotting a network from my dataset.  I 
am trying to teach myself network analysis, so this is probably an easy 
question.

Using the package network, I have successfully plotted my network.  I simply 
want to add labels to my vertices, with the label corresponding to the data I 
fed into the edgelist.  For simplicity sake, my edgelist looks like

1  4
3  4

I want to plot the labels, 1, 3, 4, and so on.

Here is my code.

library(network)
path - path
myedges - read.table(path)
net - network(myedges)
plot(net)

Any help will be greatly appreciated.  I am not looking to do advanced 
analysis, just plotting it to get going is all I really need.

Many thanks in advance for help and/or suggestions,

Brock

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


Re: [R] curve fitting to data

2009-12-04 Thread Peter Ehlers

Pascale,

If you do want an nls fit with the associated error structure
assumptions, check ?SSlogis.

 fm - nls(y ~ SSlogis(x, Asy, xmid, scal))
 summary(fm)
 xx - seq(123, 248, length = 101)
 yy - predict(fm, list(x = xx))
 plot(x, y)
 lines(xx, yy)

 -Peter Ehlers

Gabor Grothendieck wrote:

A simple y vs log(x) fit seems to work pretty well here:

fit - lm(y ~ log(x))
summary(fit)

plot(y ~ log(x))
abline(fit)

On Fri, Dec 4, 2009 at 9:06 AM, Pascale Weber pascale.we...@wsl.ch wrote:


Hi to all

This is the first time I am quoting a question and I hope, my question is
not too basic...

For the following data, I wish to draw a fitted curve.

x - c(123,129,141,144,144,145,149,150,158,159,163,174,183,187,242,248)

y -
c(14.42,26.96,31.3,19.95,36.36,15.4,24.76,35.39,28.07,40.97,26.23,42.83,46.53,14.79,49.18,48.08)

If I plot the data, it looks somehow that a logistic function would render
good results.

My questions are:

How do I use
 nls and/or SSlogis (or other)
to fit the curve?

How can I see the summary statistics of the fit?

How do I finally draw the line to my x,y (untransformed data) plot?

Any help would be highly appreciated.

Thank you and cheers

Pascale

--
..___

Dr. Pascale Weber
Swiss Federal Research Institute WSL
Zuercherstrasse 111
CH-8903 Birmensdorf
Switzerland

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



[[alternative HTML version deleted]]

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




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


Re: [R] Standard deviation for each element in a set of matrices

2009-12-04 Thread Gray Calhoun
Hi Muhammad,
  Load the data from all of the files into an array (probably using a
for loop), then call apply on the resulting array: ie

## replace the first line with code to load your data
 rr - array(c(rep(1:3,3), rep(4:6,3), rep(7:9,3)), c(3,3,3))
 apply(rr, c(1,2), sd)
 [,1] [,2] [,3]
[1,]333
[2,]333
[3,]333

--Gray

On Fri, Dec 4, 2009 at 11:56 AM, Muhammad Rahiz
muhammad.ra...@ouce.ox.ac.uk wrote:
 Hello R-users,

 I would like to know how to find the standard deviation for each element in
 a set of matrices.

 Given the following files,

   File1    File2    File3
   1 1 1   4 4 4   7 7 7
   2 2 2   5 5 5   8 8 8
   3 3 3   6 6 6   9 9 9

 I want to calculate the standard deviation for every cell in the file (I'm
 using gridded data). The desired output is

   Output
   3 3 3
   3 3 3
   3 3 3


 Thanks.

 Muhammad

 --
 Muhammad Rahiz  |  Doctoral Student in Regional Climate Modeling

 Climate Research Laboratory, School of Geography  the Environment
 Oxford University Centre for the Environment
 South Parks Road, Oxford, OX1 3QY, United Kingdom Tel: +44 (0)1865-285194
  Mobile: +44 (0)7854-625974
 Email: muhammad.ra...@ouce.ox.ac.uk

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




-- 
Gray Calhoun

Assistant Professor of Economics
Iowa State University

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


Re: [R] Standard deviation for each element in a set of matrices

2009-12-04 Thread David Winsemius


On Dec 4, 2009, at 1:27 PM, Gray Calhoun wrote:


Hi Muhammad,
 Load the data from all of the files into an array (probably using a
for loop), then call apply on the resulting array: ie


I like that idea a lot and it does not need an explicit loop:

apply( array(c(File1, File2, File3), dim=c(3,3,3) )  , 1:2, sd)



I had come up with this rather messy solution before seeing your much  
more elegant one:


matrix( apply(sapply(list(File1, File2, File3), [), 1,sd),  
nrow(File1), ncol(File1) )


--
David


## replace the first line with code to load your data

rr - array(c(rep(1:3,3), rep(4:6,3), rep(7:9,3)), c(3,3,3))
apply(rr, c(1,2), sd)

[,1] [,2] [,3]
[1,]333
[2,]333
[3,]333

--Gray

On Fri, Dec 4, 2009 at 11:56 AM, Muhammad Rahiz
muhammad.ra...@ouce.ox.ac.uk wrote:

Hello R-users,

I would like to know how to find the standard deviation for each  
element in

a set of matrices.

Given the following files,

  File1File2File3
  1 1 1   4 4 4   7 7 7
  2 2 2   5 5 5   8 8 8
  3 3 3   6 6 6   9 9 9

I want to calculate the standard deviation for every cell in the  
file (I'm

using gridded data). The desired output is

  Output
  3 3 3
  3 3 3
  3 3 3


Thanks.

Muhammad

--
Muhammad Rahiz  |  Doctoral Student in Regional Climate Modeling

Climate Research Laboratory, School of Geography  the Environment
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom Tel: +44  
(0)1865-285194

 Mobile: +44 (0)7854-625974
Email: muhammad.ra...@ouce.ox.ac.uk

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





--
Gray Calhoun

Assistant Professor of Economics
Iowa State University

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


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


Re: [R] User's function

2009-12-04 Thread Lisa

Thank you for your reply. But this is not what I want.

For example, I have several variables, like

arg1 - c(1, 2, 3, 5, 6, 6)
arg2 - c(3, 1, 5, 5, 7, 8)
arg3 - c(8, 10, 4, 0, 9, 1)
arg4 - c(11, 22, 30, 5, 61, 22)
…

I just want to bind some of these variables based on the arguments assigned
in myfunction()

myfunction - function(arg1, arg2, arg3, …)
{  
x - cbind(arg1, arg2, arg3, …)
}

myfunction(arg1, arg2, arg3, …)

If I assign 2 arguments, the function can bind those two arguments, or if I
assign 3 arguments, the function can bind those three arguments, and so on.

Lisa



baptiste auguie-5 wrote:
 
 Hi,
 
 try ?do.call
 
 do.call(cbind, replicate(3, 1:10, simplify=FALSE))
 
 HTH,
 
 baptiste
 
 2009/12/4 Lisa lisa...@gmail.com:

 Hello, All,

 I want to write a function to do some works based on the arguments. For
 example, bind some variables (arguments) as this:

 myfunction - function(arg1, arg2, arg3, …)
 {
  x - cbind(arg1, arg2, arg3, …)
 }

 myfunction(arg1, arg2, arg3, …)

 The function can automatically determine the number of arguments and bind
 them, which means if I assign 2 arguments, the function can bind those
 two
 arguments, or if I assign 3 arguments, the function can bind those three
 arguments, and so on. Here assume the arguments are all continuous
 variables
 and have the same length. Is it possible?

 I would appreciate if some one can help me. Thanks!

 Lisa

 --
 View this message in context:
 http://n4.nabble.com/User-s-function-tp948737p948737.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://n4.nabble.com/User-s-function-tp948737p948763.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] options(width=100) ignored on start-up

2009-12-04 Thread Liviu Andronic
Dear all
Is it normal that R ignores options(width=100) at start-up? Although
li...@debian-liv:~$ cat /usr/lib/R/etc/Rprofile.site | grep width
options(width = 100)

, R will start with
[Previously saved workspace restored]

 options()$width
[1] 80

Am I doing something wrong?
Liviu


 sessionInfo()
R version 2.10.0 (2009-10-26)
x86_64-pc-linux-gnu

locale:
 [1] LC_CTYPE=en_GB.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8
 [5] LC_MONETARY=C  LC_MESSAGES=en_GB.UTF-8
 [7] LC_PAPER=en_GB.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
 [1] fortunes_1.3-6   RcmdrPlugin.HH_1.1-25HH_2.1-32
 [4] leaps_2.9multcomp_1.1-2   mvtnorm_0.9-8
 [7] lattice_0.17-26  RcmdrPlugin.sos_0.1-0RcmdrPlugin.Export_0.3-0
[10] Hmisc_3.7-0  survival_2.35-7  xtable_1.5-6
[13] Rcmdr_1.5-4  car_1.2-16   relimp_1.0-1
[16] sos_1.1-7brew_1.0-3   hints_1.0.1-1

loaded via a namespace (and not attached):
[1] cluster_1.12.1



-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

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


  1   2   >