[R] replicating C example from the Extensions Manual problem

2012-03-15 Thread Erin Hodgess
Dear R People: Here is something that I am sure is very simple. I'm just trying to re-create the C convolution example in the Extensions manual. Here is the subroutine: void convolve(double *a, int *na, double *b, int *nb, double *ab) { R_len_t i, j, nab = *na + *nb - 1; for(i = 0; i nab;

Re: [R] replicating C example from the Extensions Manual problem

2012-03-15 Thread Berwin A Turlach
G'day Erin, On Thu, 15 Mar 2012 01:03:59 -0500 Erin Hodgess erinm.hodg...@gmail.com wrote: What is wrong, please? Missing #include R.h #include Rinternals.h In particular the latter is defining R_len_t. Guess that code snippet in the manual is only showing the code of the function, but not

Re: [R] replicating C example from the Extensions Manual problem

2012-03-15 Thread Joshua Wiley
Hi Erin, If you are just starting with including compiled code, I would highly recommend the Rcpp + inline packages. I attached a small example of how it works, but basically you get to inline C++ code in R files. Cheers, Josh P.S. I wrote this snippet awhile ago when I did not know much

Re: [R] replicating C example from the Extensions Manual problem

2012-03-15 Thread Jeff Newmiller
Do you really expect is to know how to figure out the error if you don't give us the code that the error is pointing at (or the code preceding the error, which may be at fault)? Please think before posting. --- Jeff

Re: [R] replicating C example from the Extensions Manual problem

2012-03-15 Thread Peter Langfelder
Seems you're missing the required header(s). Can't find the example in the extensions manual but you probably need #include Rinternals.h or #include Rdefines.h HTH, Peter On Wed, Mar 14, 2012 at 11:03 PM, Erin Hodgess erinm.hodg...@gmail.com wrote: Dear R People: Here is something that I

[R] how to dev.off() all devices

2012-03-15 Thread Alaios
Dear all, I would like at the beginning of my code to turn off all the remaining open devices. How can I do that by using dev.off()? I would like to thank you in advance for your help B.R Alex [[alternative HTML version deleted]] __

Re: [R] Help with operation on list of matrices

2012-03-15 Thread Petr Savicky
On Wed, Mar 14, 2012 at 09:10:49PM -0400, Axel Urbiz wrote: I'll appreciate your help on this. I have values stored in a list as in mylist below. I need to sum the values over all elements of the list aggregated by the names of the matrices. mylist - list(matrix(c(0.2, 0.4), 1, 2, dimnames =

Re: [R] how to dev.off() all devices

2012-03-15 Thread baptiste auguie
Hi, Try this, replicate(sample(10,1), dev.new()) graphics.off() HTH, baptiste On 15 March 2012 20:36, Alaios ala...@yahoo.com wrote: Dear all, I would like at the beginning of my code to turn off all the remaining open devices. How can I do that by using dev.off()? I would like to

Re: [R] how to dev.off() all devices

2012-03-15 Thread Prof Brian Ripley
On 15/03/2012 07:36, Alaios wrote: Dear all, I would like at the beginning of my code to turn off all the remaining open devices. How can I do that by using dev.off()? See the help page. Hint: there is a function graphics.off() on the same page. I would like to thank you in advance for

Re: [R] Improving help in R

2012-03-15 Thread Patrick Connolly
On Wed, 14-Mar-2012 at 11:39PM +0100, Tomáš Křehlík wrote: | Hello R people | [...] | The best documentation that I ever used is probably one of | Mathematica, look for example here | http://reference.wolfram.com/mathematica/ref/Fit.html (it is | somehow related to the stuff below). [...]

Re: [R] aggregate

2012-03-15 Thread Petr PIKAL
Hi Dear all I am having a vector with large length and I would like to ask you if I can aggregate the values by constant sized windows. For example for the following vector, I would like to take 30 points until the end and find their mean. myData-seq(1:10)

[R] substituting own test statistics in a built-in function

2012-03-15 Thread Aparna Sampath
Hi All I would like to compute the raw p-value from permutation tests and I found mt.sample.rawp() from the package multtest almost similar to what I want to do. But in the function definition: mt.sample.rawp(V,classlabel,test=t,side=abs,fixed.seed.sampling=y,B=1,na=.mt.naNUM,nonpara=n)

[R] Equation as a character string

2012-03-15 Thread Emily Weiser
I'm trying to figure out if it's possible to use a character string as an equation, e.g: eqn1string - x^2 + x + 5 Then I want to tell R: 1) that eqn1string is actually an equation (even though it was stored as a character string), and 2) to apply the equation to a specified value of x (e.g.

[R] Source code

2012-03-15 Thread AnaKar
Hi everyone, I need to see the source code of function Does anybody know how can I find so. Thanks a lot. -- View this message in context: http://r.789695.n4.nabble.com/Source-code-tp4474173p4474173.html Sent from the R help mailing list archive at Nabble.com.

[R] Error in prune in the rEMM package

2012-03-15 Thread vioravis
I am trying to use rEMM package for the Extensible Markov Models. I tried the following sequence of code: emmt=EMM(measure=euclidean,threshold=0.75,lambda=0.001) emmt=build(emmt,data) new_threshold=sum(cluster_counts(emmt))*0.002 emmt_ new=prune(emmt,new_threshold) However, I get the following

Re: [R] Equation as a character string

2012-03-15 Thread Joshua Wiley
Hi Emily, Yes (see below), but you might be better off by writing a simple function. Here are examples both ways (usually eval parse is highly discouraged). Cheers, Josh # eqn1string - x^2 + x + 5 x - 6 ## works eval(parse(text = eqn1string)) ## better f - function(x)

[R] Creat a new list with names of other list

2012-03-15 Thread ali_protocol
Hi all, I want to create a new list with names of another list. Eeach sublist from both lists is a matrix, but the matrices with the same name (eg. list.1 [[1]] and list.2 [[1]]) have different dimensions. How can I create the 2nd list? tSE = list () Norm - names(Normal) names(tSE) - Norm

Re: [R] Improving help in R

2012-03-15 Thread Barry Rowlingson
2012/3/14 Tomáš Křehlík tomas.kreh...@gmail.com: Hello R people I get the feeling (by some experience with learning programming languages when I am not primarily a programmer but economist/statistician) that structure of help really helps and I would like to have it to go in the way basic

Re: [R] Source code

2012-03-15 Thread Petr PIKAL
Hi Hi everyone, I need to see the source code of function Does anybody know how can I find so. Thanks a lot. What function? mean.default function (x, trim = 0, na.rm = FALSE, ...) { if (!is.numeric(x) !is.complex(x) !is.logical(x)) { warning(argument is not numeric or

Re: [R] Source code

2012-03-15 Thread Joshua Wiley
Hi, function is a primitive, so seeing its source will take some work. See page 43 of http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf for a guide on viewing compiled code sources. Cheers, Josh On Thu, Mar 15, 2012 at 1:05 AM, AnaKar lupasa...@gmail.com wrote: Hi everyone, I need to see

Re: [R] Creat a new list with names of other list

2012-03-15 Thread Petr Savicky
On Thu, Mar 15, 2012 at 01:44:10AM -0700, ali_protocol wrote: Hi all, I want to create a new list with names of another list. Eeach sublist from both lists is a matrix, but the matrices with the same name (eg. list.1 [[1]] and list.2 [[1]]) have different dimensions. How can I create the

[R] Integrate inside function

2012-03-15 Thread Mauro Rossi
Dear R users, first I take this opportunity to greet all the R community for your continuous efforts. I wrote a function to calculate the pdf and cdf of a custom distribution (mixed gamma model). The function is the following: pmixedgamma3 - function(y, shape1, rate1, shape2, rate2, prev)

Re: [R] Improving help in R

2012-03-15 Thread Berend Hasselman
On 14-03-2012, at 23:39, Tomáš Křehlík wrote: Hello R people I always wander what other people say about the R help. Finally after some years of using, I decided that it is probably time to try to do something about it, because the feeling of gritting teeth does not go away with years

Re: [R] Visualising multiple response contingency tables

2012-03-15 Thread Marcos Pelenur
Dear Ilai, Thank you for your helpfulresponse. My question had two parts. 1. Are mosaic plots a good way to visualise multiple response data? Or are there better alternatives? 2. How can I do my modified chi-square tests in R (which you were able answer, so thank you very much :) ) All the

Re: [R] substituting own test statistics in a built-in function

2012-03-15 Thread Sarah Goslee
Hi, On Mar 15, 2012 4:28 AM, Aparna Sampath aparna.sampat...@gmail.com wrote: Hi All I would like to compute the raw p-value from permutation tests and I found mt.sample.rawp() from the package multtest almost similar to what I want to do. But in the function definition:

[R] climate data, Netcdf

2012-03-15 Thread Amen
I am a PhD student working on global scale. I am working at INRA in France.I am new to R I downloaded a netcdf file cruncep_tair_2010.nc.gz from http://dods.extra.cea.fr/data/p529viov/cruncep/t2m/ in this file, temperature was measured every 6 hours for 2010, I want to convert to

[R] Using Metropolis Hastings to calculate integration

2012-03-15 Thread Dinh Tuan
Hi list members, I have a question about application of Metropolis-Hastings (MH) algorithm in R. It is said that using this kind of algorithm (MCMC), one can integrate any complexe function. Is it true ? And how can I proceed with a whole new one function, which does not include any obvious

[R] how to bind uneven column (not equal length) into matrix without recycling values

2012-03-15 Thread sagarnikam123
i have x [1] 1 2 3 4 5 6 y [1] 34 5 6 z-cbind(x,y) z x y [1,] 1 34 [2,] 2 5 [3,] 3 6 [4,] 4 34 [5,] 5 5 [6,] 6 6 i don't want recycling, instead can we put NA /0 like below z x y [1,] 1 34 [2,] 2 5 [3,] 3 6 [4,] 4 NA [5,] 5 NA [6,] 6 NA want distance matrix -- View

[R] How to choose the most 2 different samples in an array experiment

2012-03-15 Thread ali_protocol
Dear all, What test should be done on ~40 samples (matrixes of 400x1), each in triplicate, to determine which sample is the most different to all samples? and What test should be done to determine the two samples which are most different? -- View this message in context:

[R] how to assign writeLines function

2012-03-15 Thread mrzung
hi, what I want to do is assigning following code to any object. k-paste(thank) writeLines(strwrap(k, width = 80,indent = 7,exdent = 6)) To assign the writeLines code, I try this a-writeLines(strwrap(k, width = 80,indent = 7,exdent = 6)) or assign(a,writeLines(strwrap(k, width = 80,indent =

[R] Subtract Date Between columns

2012-03-15 Thread MSousa
Hello I have this little dataset, my goal is create one column in the data.frame with between the diference DataTime and Duration. I'm using the next code to make do this TIME_STAMP SESSIONTIMETime TimeStart 1162343932 83202006-10-31 19:01:34

Re: [R] lme code help

2012-03-15 Thread ONKELINX, Thierry
You want lme(logSSP~logM + K,random=~logM + K|species,data=data1) Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium +

[R] PCA R

2012-03-15 Thread Samantha Allcock
Hello can anyone help, I have been running the following script to obtain a PCA plot but the end result is rather disappointing as the points are very very small and there are no titles etc geochemdata-read.csv(file.choose(),header=TRUE) names(geochemdata) library(vegan) bstick-function(n,

[R] Average row and column

2012-03-15 Thread MSousa
Hello I have this code for the count the occurrences between V_source and V_destine, its can possible make the same, but in local the total the occurrences to appear the mean or the minimum Dataset df.v_source df.v_destine df.dif 1 33 4 2 7

Re: [R] how to bind uneven column (not equal length) into matrix without recycling values

2012-03-15 Thread Berend Hasselman
On 15-03-2012, at 10:08, sagarnikam123 wrote: i have x [1] 1 2 3 4 5 6 y [1] 34 5 6 z-cbind(x,y) z x y [1,] 1 34 [2,] 2 5 [3,] 3 6 [4,] 4 34 [5,] 5 5 [6,] 6 6 i don't want recycling, instead can we put NA /0 like below z x y [1,] 1 34 [2,] 2 5 [3,] 3 6

[R] expand.grid using a matrix and a vector as input

2012-03-15 Thread eugen pircalabelu
  Hello R-users,   I have the following question, for which my search did not really return any usable result. If I have a matrix a1, and a vector a2 like below   a1-matrix(c(1:4),2,2) a2-c(8,9)   is there any function like the expand.grid (or some clever calling of the function) such that it

Re: [R] gam - Y axis probability scale with confidence/error lines

2012-03-15 Thread ONKELINX, Thierry
I find plogis() is easier to remember all.equal(binomial()$linkinv(seq(-2, 2, length = 101)), plogis(seq(-2, 2, length = 101))) ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality

Re: [R] Subtract Date Between columns

2012-03-15 Thread Jim Holtman
use POSIXct instead Sent from my iPad On Mar 15, 2012, at 6:21, MSousa ricardosousa2...@clix.pt wrote: Hello I have this little dataset, my goal is create one column in the data.frame with between the diference DataTime and Duration. I'm using the next code to make do this

Re: [R] R CMD Rd2pdf [options] files

2012-03-15 Thread Duncan Murdoch
On 12-03-14 11:58 PM, casperyc wrote: Hi all, Sorry if I seem a bit pissed because I am! I'd recommend calming down, and explaining the problem clearly. You tell us about the research you did, but you don't say: 1. What exactly did you do? 2. What was the result? Without those two

Re: [R] Integrate inside function

2012-03-15 Thread R. Michael Weylandt
I believe the difficulty is that the integrate function isn't vectorized: add this line and you should be good pmixedgamma3 - Vectorize(pmixedgamma3) Read ? Vectorize for details if you only need to vectorize certain arguments. Michael On Thu, Mar 15, 2012 at 6:08 AM, Mauro Rossi

Re: [R] how to bind uneven column (not equal length) into matrix without recycling values

2012-03-15 Thread Gabor Grothendieck
On Thu, Mar 15, 2012 at 5:08 AM, sagarnikam123 sagarnikam...@gmail.com wrote: i have x [1] 1 2 3 4 5 6 y [1] 34  5  6 z-cbind(x,y) z     x  y [1,] 1 34 [2,] 2  5 [3,] 3  6 [4,] 4 34 [5,] 5  5 [6,] 6  6 i don't want recycling, instead can we put NA /0 like below z     x  y [1,] 1

Re: [R] how to assign writeLines function

2012-03-15 Thread R. Michael Weylandt
I'm not sure what writeLines is for here(); just a - strwrap(k, width = 80, indent = 7, exdent = 6) if I understand you correctly. cat(a, \n) Michael On Thu, Mar 15, 2012 at 5:13 AM, mrzung mrzun...@gmail.com wrote: hi, what I want to do is assigning following code to any object.

Re: [R] climate data, Netcdf

2012-03-15 Thread Roy Mendelssohn
Hi Amen: On Mar 15, 2012, at 2:19 AM, Amen wrote: I am a PhD student working on global scale. I am working at INRA in France.I am new to R I downloaded a netcdf file cruncep_tair_2010.nc.gz from http://dods.extra.cea.fr/data/p529viov/cruncep/t2m/ in this file, temperature

Re: [R] Improving help in R

2012-03-15 Thread Duncan Murdoch
On 12-03-14 6:39 PM, Tomáš Křehlík wrote: Hello R people I always wander what other people say about the R help. Finally after some years of using, I decided that it is probably time to try to do something about it, because the feeling of gritting teeth does not go away with years of usage.

Re: [R] Average row and column

2012-03-15 Thread Petr PIKAL
Hi Hello I have this code for the count the occurrences between V_source and V_destine, its can possible make the same, but in local the total the occurrences to appear the mean or the minimum Your question is rather cryptic and I am rather confused what you really want. For row/column

Re: [R] expand.grid using a matrix and a vector as input

2012-03-15 Thread Dimitris Rizopoulos
One possibility is to use something like the following: a1 - matrix(1:4, 2, 2) a2 - c(8, 9) cbind(a1[rep(1:nrow(a1), length(a2)), ], rep(a2, each = nrow(a1))) I hope it helps. Best, Dimitris On 3/15/2012 1:33 PM, eugen pircalabelu wrote: Hello R-users, I have the following question, for

[R] where I can find more color names or color definition?

2012-03-15 Thread Henrik Pärn
Another alternative: http://research.stowers-institute.org/efg/R/Color/Chart/ColorChart.pdf http://research.stowers-institute.org/efg/R/Color/Chart/ Best regards, Henrik hi everyone . Now I want to draw several lines in one frame.And it seems needs more colors except for blue red,black

Re: [R] Integrate inside function

2012-03-15 Thread David Winsemius
On Mar 15, 2012, at 6:08 AM, Mauro Rossi wrote: Dear R users, first I take this opportunity to greet all the R community for your continuous efforts. I wrote a function to calculate the pdf and cdf of a custom distribution (mixed gamma model). The function is the following:

Re: [R] Needing a better solution to a lookup problem.

2012-03-15 Thread Davis, Brian
Thanks for the point in the right direction. I now have a great solution. library(GenomicRanges) system.time({ + snplist-with(snp, GRanges(CHR, IRanges(POS, POS))) + locations-with(targets, GRanges(CHR, IRanges(START, STOP))) + olaps-findOverlaps(snplist, locations) + }) user system

[R] line plot over a barplot

2012-03-15 Thread anupam sinha
Dear all, I have data in the following format : X-axisY-axis 010% 0-20 20% 20-4030% 40-6040% . and so on. I want to plot a bar graph of the above. Also I would want to add a trendline passing either through the

[R] can anyone tell me what is the meaning of the x and y axis ?

2012-03-15 Thread Jie Tang
hi ,I am trying to using wavelet package. require(wavelets) wt - dwt(aa, n.levels=4, boundary=reflection, fast=TRUE) plot(wt) and we can get the figure as the attachment. aa is a data array that came from the one day obvervation in 1HZ and has the length of 86400 . Can anyone tell me what is

Re: [R] ROC Analysis

2012-03-15 Thread Camille Leclerc
Hi, I made a mistake, effectively Pascal your method given to the first message is correct. I didn't use the good data, so it's sure that it could not work ! But, I have an another question : Can I obtain a same graph except that the y-axis represents the likelihood ratio ? All the best,

Re: [R] Average row and column

2012-03-15 Thread MSousa
Sorry, I ll explain better. For example in the next dataset, x-data.frame(v_source=3,v_destine=3,dist=4) x-rbind(x,data.frame(v_source=7,v_destine=7,dist=0)) x-rbind(x,data.frame(v_source=6,v_destine=6,dist=0)) x-rbind(x,data.frame(v_source=4,v_destine=4,dist=56))

[R] Adding mean values to boxplots

2012-03-15 Thread Cleland
Hello there, I was wondering if anyone might be able to help me as I'm pretty new to R. I'm trying to create a boxplot from a data table returned from an sproc. I have the following code, which generates the plot as I'd like it: library(RODBC); conn - odbcConnect(datawarehouse); # connect to

[R] A question about loglik in GLMM

2012-03-15 Thread Freddy Hernández
Hi All, I am using the glmer function to adjust a simple model (mod1) with Poisson response variable and random intercept. When I use logLik(mod1) I obtain a value different from if I calculate the log-likelihood using the pdf. Someone could explain if I have an error? This is the code for the

Re: [R] Problem reading a graph file

2012-03-15 Thread Marc Marí Dell'Olmo
I obtain this message: Error: C stack usage is too close to the limit Marc Marí-Dell'Olmo CIBER Epidemiología y Salud Pública Servei de Sistemes d'Informació Sanitària (SeSIS) Agència de Salut Pública de Barcelona Pl. Lesseps 1. 08023 Barcelona Tel. 93 2027775 | Fax. 93 3686943 www.aspb.cat

[R] how to hide code of any function

2012-03-15 Thread mrzung
hi I'm making some program and it need to be hidden. it's not commercial purpose but it is educational, so i do want to hide the code of function. for example, if i made following function: a-function(x){ y-x^2 print(y) } i do not want someone to type a and take the code of the function.

Re: [R] Average row and column

2012-03-15 Thread MSousa
Sorry, I ll explain better. For example in the next dataset, x-data.frame(v_source=3,v_destine=3,dist=4) x-rbind(x,data.frame(v_source=7,v_destine=7,dist=0)) x-rbind(x,data.frame(v_source=6,v_destine=6,dist=0)) x-rbind(x,data.frame(v_source=4,v_destine=4,dist=56))

[R] How to change the number of axis?

2012-03-15 Thread qiao xue
Hi, I use R to plot a graph with 2 frames. Because the limit of pixel or others, the screen fail to show the graph. So I have to draw a point every 10 frames. So the total of x axis becomes 2000. So when imaging the picture, I still hope that the total of x-axis is 2. I need to find a

Re: [R] Average row and column

2012-03-15 Thread David Winsemius
On Mar 15, 2012, at 10:23 AM, MSousa wrote: Sorry, I ll explain better. For example in the next dataset, x-data.frame(v_source=3,v_destine=3,dist=4) x-rbind(x,data.frame(v_source=7,v_destine=7,dist=0)) x-rbind(x,data.frame(v_source=6,v_destine=6,dist=0))

Re: [R] can not use plot.Predict {rms} reproduce figure 7.8 from Regression Modeling Strategies (http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RmS/course2.pdf)

2012-03-15 Thread John Smith
Sorry. I am still using the 9-11 March 2011 version of course2.pdf. On Wed, Mar 14, 2012 at 5:52 PM, David Winsemius dwinsem...@comcast.netwrote: On Mar 14, 2012, at 4:09 PM, John Smith wrote: With most current version of R and RMS, the 4 curves are drew in 4 separate panels. Can anyone

Re: [R] how to hide code of any function

2012-03-15 Thread Duncan Murdoch
On 15/03/2012 8:53 AM, mrzung wrote: hi I'm making some program and it need to be hidden. it's not commercial purpose but it is educational, so i do want to hide the code of function. for example, if i made following function: a-function(x){ y-x^2 print(y) } i do not want someone to type

[R] single, double or no quotes in expression

2012-03-15 Thread capy_bara
Dear all, I am confused about how to create an expression. I use a package (rsbml) which uses expressions and seems to make a difference if there is a quote around the expression or not. For example, package works with expressions such as expression(A + B) but not with expression(A + B) I

[R] Extending a group of S4 classes by setClassUnion ?

2012-03-15 Thread Alexander
Hi, I would like to create some S4 classes as follows setClass(Father,representation(name=character)) setClass(Son1,contains=Father,representation(par=numeric)) setClass(Son2,contains=Father,representation(par=logical)) Son1-new(Son1) Son1@name-Son1 Son1@par-3 Son2-new(Son2) Son2@name-Son2

Re: [R] Moore-Penrose Generalized determinant?

2012-03-15 Thread Sean O'Riordain
My colleague asked me to thank those of you who responded. Kind regards, Sean -- View this message in context: http://r.789695.n4.nabble.com/Moore-Penrose-Generalized-determinant-tp4471629p4475415.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Using the mantel test in Ape Package

2012-03-15 Thread Sarah Goslee
Hi, You didn't copy the main r-help list on this email, so I've added them back it. Beyond that, I don't see anything grossly wrong. You don't provide enough information to reproduce the problem: mantel.test() works with the 7x7 parts you provided. So you'll need to provide a small reproducible

Re: [R] single, double or no quotes in expression

2012-03-15 Thread Sarah Goslee
Hi, You don't provide a reproducible example, but I suspect what you need is parse(): parse(text = A + B) expression(A + B) Sarah On Thu, Mar 15, 2012 at 10:55 AM, capy_bara hettl...@few.vu.nl wrote: Dear all, I am confused about how to create an expression. I use a package (rsbml) which

Re: [R] Adding mean values to boxplots

2012-03-15 Thread ilai
You want to assign your call to boxplot as an object that contains the plot information set.seed(1) b - matrix(rgamma(100,(1:4)/2,.5),nc=4) (bxp - boxplot(b)) Now you can use the info in bxp for placement, e.g.: text(1:length(bxp$names),bxp$stats[3,],round(bxp$stats[3,],2),pos=3) By the way,

Re: [R] single, double or no quotes in expression

2012-03-15 Thread David Winsemius
On Mar 15, 2012, at 10:55 AM, capy_bara wrote: Dear all, I am confused about how to create an expression. I use a package (rsbml) which uses expressions and seems to make a difference if there is a quote around the expression or not. For example, package works with expressions such as

Re: [R] single, double or no quotes in expression

2012-03-15 Thread capy_bara
Many thanks, parse is exactly what I was looking for!! Hannes -- View this message in context: http://r.789695.n4.nabble.com/single-double-or-no-quotes-in-expression-tp4475247p4475475.html Sent from the R help mailing list archive at Nabble.com. __

[R] Ggplot barchart drops factor levels: how to show them with zero counts?

2012-03-15 Thread Bart6114
Hello, When plotting a barchart with ggplot it drops the levels of the factor for which no counts are available. For example: library(ggplot) mtcars$cyl-factor(mtcars$cyl) ggplot(mtcars[!mtcars$cyl==4,], aes(cyl))+geom_bar() levels(mtcars[!mtcars$cyl==4,]) This shows my problem. Because no

[R] Accessing variable's name as an attribute?

2012-03-15 Thread Rob Forsyth
Sorry - I suspect this is a very basic query. I have a data frame structured flat (i.e. separate observations for a given subject ID on separate lines). Using the nlme library I create a groupedData object suitable for further analysis thus: dataset - groupedData(VARIABLE ~ TIME|ID, data=sfa)

Re: [R] Adding mean values to boxplots

2012-03-15 Thread Cleland
Great. Thanks very much for that... and for pointing out the obvious error! Much appreciated. Tom -- View this message in context: http://r.789695.n4.nabble.com/Adding-mean-values-to-boxplots-tp4474700p4475472.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Average row and column

2012-03-15 Thread MSousa
Thank you. Works perfectly -- View this message in context: http://r.789695.n4.nabble.com/Average-row-and-column-tp4474524p4475438.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Ggplot barchart drops factor levels: how to show them with zero counts?

2012-03-15 Thread Sarah Goslee
One possibility: update to ggplot2. The original ggplot isn't even on CRAN any longer. When I tried your example with ggplot2, the empty bar for 4 was plotted as you'd expect. Thanks for the small reproducible example. Sarah On Thu, Mar 15, 2012 at 11:47 AM, Bart6114 bartsmeet...@gmail.com

Re: [R] Using the mantel test in Ape Package

2012-03-15 Thread Dorothea Hill
Hi, okay thanks. I've attempted the commands you suggested (I have provided all of the dput results - I am not sure how to provide a smaller example). I hope this is ok. sessionInfo() R version 2.14.2 (2012-02-29) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United

Re: [R] Extending a group of S4 classes by setClassUnion ?

2012-03-15 Thread Martin Morgan
Hi Alexander -- On 03/15/2012 07:57 AM, Alexander wrote: Hi, I would like to create some S4 classes as follows setClass(Father,representation(name=character)) setClass(Son1,contains=Father,representation(par=numeric)) setClass(Son2,contains=Father,representation(par=logical)) Son1-new(Son1)

Re: [R] Apt-get

2012-03-15 Thread Scott Raynaud
My IS people insist that the latest version of R avaialble via apt-get is 2.13.1.  Anything later they claim will have to be compiled.  True? Will I have to compile every time I update R?  Seems like a lot of work. Surely there's a way around it. - Original Message - From: Jeff Newmiller

Re: [R] Using the mantel test in Ape Package

2012-03-15 Thread Sarah Goslee
Hi Dorothea, I've copied the ape maintainer on this, because I believe you may have found a bug. Your analysis works without warning in ape 2.8, but gives warnings in the current ape_3.0.1. But what makes me think that this is a problem with the new version is that the example given in

Re: [R] coloring wireframe plot with independent/separate matrix of color values.

2012-03-15 Thread ilai
On Wed, Mar 14, 2012 at 9:47 PM, Alex Miller alexjcmil...@gmail.com wrote: Dear R Users, I am trying to plot a matrix (a Digital Elevation Model) using wireframe [lattice] and color that matrix based on a separate/independent matrix of the same resolution This makes no sense. the values in

Re: [R] Apt-get

2012-03-15 Thread Sarah Goslee
Try this: Go to your favorite CRAN mirror. Click on R Binaries then linux then ubuntu and send the link with directions to install current ubuntu binaries to your IS people. Which, you'll note, is exactly what Jeff Newmiller suggested. Sarah On Thu, Mar 15, 2012 at 12:50 PM, Scott Raynaud

[R] How to add grid lines at specific position to a plot?

2012-03-15 Thread Michael
How to add grid lines at specific position to a plot? Hi all, [Disclaimer: I have done extensive and intensive searching on Google and asked around but couldn't find a solution to this problem. Please help me instead of just pointing out how simple and stupid my question is. God bless good

Re: [R] Equation as a character string

2012-03-15 Thread Rui Barradas
Hello, Hi Emily, Yes (see below), but you might be better off by writing a simple function. Here are examples both ways (usually eval parse is highly discouraged). Cheers, Josh Yes, eval/parse is discouraged but there's a way of using it, that is less troublesome, to create a

[R] handling missing values

2012-03-15 Thread Mintewab Bezabih
Dear R users, I have problems handling missing values. THe problem is that after running my codes the result I get just skips the missing values. What I want is for the missing values to appear in my results as well. I have put a workable example below and as you could see the missing value

Re: [R] Extending a group of S4 classes by setClassUnion ?

2012-03-15 Thread Alexander
Hi Martin, thanks for your quick answer. I didn't know that '.' could be missleading. Is there any standard way to name function for S4 objects? get,set etc..? I saw your example, and I was wondering, why get.par(ext) put out Son1, and not the same as get.par(new(Son1, name=Son1, par=3)) If I

Re: [R] How to add grid lines at specific position to a plot?

2012-03-15 Thread Sarah Goslee
abline(h=0) On Thu, Mar 15, 2012 at 1:05 PM, Michael comtech@gmail.com wrote: How to add grid lines at specific position to a plot? Hi all, [Disclaimer: I have done extensive and intensive searching on Google and asked around but couldn't find a solution to this problem. Please help me

Re: [R] How to add grid lines at specific position to a plot?

2012-03-15 Thread Luke Miller
abline(h = 0) will do what you want. abline(h = c(0,1,2)) would draw additional lines at y = 1 and y = 2. abline(v = 0) would draw a vertical line at x = 0. All of these lines will be plotted on top of whatever you plotted previously, so you may have to replot your points or lines so that they're

Re: [R] Equation as a character string

2012-03-15 Thread Gabor Grothendieck
On Thu, Mar 15, 2012 at 12:58 PM, Rui Barradas rui1...@sapo.pt wrote: Hello, Hi Emily, Yes (see below), but you might be better off by writing a simple function.  Here are examples both ways (usually eval parse is highly discouraged). Cheers, Josh Yes, eval/parse is discouraged but

Re: [R] Extending a group of S4 classes by setClassUnion ?

2012-03-15 Thread Martin Morgan
On 03/15/2012 09:51 AM, Alexander wrote: Hi Martin, thanks for your quick answer. I didn't know that '.' could be missleading. Is there any standard way to name function for S4 objects? get,set etc..? Hi Alexander -- it's usually better to include the original email in the reply, to provide

Re: [R] Accessing variable's name as an attribute?

2012-03-15 Thread Rui Barradas
Hello, What I want to do with each iteration of the loop I want to create another uniquely named groupedData object - I just don't know how to assign a unique variable name. The best way should be to create a list of groupedData objects. Along the lines of library(nlme) n - 100 df1 -

[R] Generation of correlated variables

2012-03-15 Thread Filoche
Hi everyone. Based on a dependent variable (y), I'm trying to generate some independent variables with a specified correlation. For this there's no problems. However, I would like that have all my regressors to be orthogonal (i.e. no correlation among them. For example, y = x1 + x2 + x3 where

[R] survival - deviance of test set

2012-03-15 Thread Saturated Funk
Hello, I am performing cross-validation on a number of survival models fitted with the coxph function and would like to use the likelihood ratio test on the left-out cases as the criteria for comparison of PCA, SPCA, ridge, lasso, etc.  Is there an easy way to do this?  I think predict.coxph

Re: [R] Ggplot barchart drops factor levels: how to show them with zero counts?

2012-03-15 Thread Bart6114
Thanks for the fast reply. I'm using ggplot2 (it was a typo in my code example). However, using exactly the same example as I mentioned before, it only shows the bars for cyl=68. How can the behaviour be different on differing machines? I just checked for updates and I have the latest ggplot2.

Re: [R] Generation of correlated variables

2012-03-15 Thread Rui Barradas
Hello, However, I would like that have all my regressors to be orthogonal (i.e. no correlation among them. ?poly poly(cbind(x1, x2, x3), degree=1) Hope this helps, Rui Barradas -- View this message in context:

[R] Importing multiple worksheets from one Excle/ csv file into R

2012-03-15 Thread HJ YAN
Dear R experts, I am trying to import some data from some Excle files into R. My Excle file contains about 50 sheets. One solution I can think about is to convert my Excle file into csv file first and then load data into R using 'read.csv'. But it seems to me that 'read.csv' only supports

Re: [R] Importing multiple worksheets from one Excle/ csv file into R

2012-03-15 Thread R. Michael Weylandt
I don't use xlsReadWrite, but I've found XLConnect rather handy for things like this: once you're going, you can just loop over all sheets like so: do.call(rbind, lapply(1:50, function(n) readWorksheet(wb, sheet = n, OtherArgumentsGoHere))) which will gather them all in a list (from lapply) and

Re: [R] Apt-get

2012-03-15 Thread Tyler Ritchie
Beltrand was also on the mark, suggesting you add Michael Rutter's ppa to your repository sources. In both cases (adding the CRAN Ubuntu repositories or Michael Rutter's ppa), an additional package repository is added to your system's packages. apt then checks that repository along with the

Re: [R] handling missing values

2012-03-15 Thread R. Michael Weylandt
Try adding na.action = na.exclude to your call to gam. Michael On Thu, Mar 15, 2012 at 1:00 PM, Mintewab Bezabih mintewab.beza...@economics.gu.se wrote: Dear R users, I have problems handling missing values. THe problem is that after running my codes the result I get just skips the missing

Re: [R] Generation of correlated variables

2012-03-15 Thread Filoche
Hi there. This is not really working. Here what I have for the moment. library(ecodist) x - 1:100 y1 - corgen(x=x, r=.85, epsilon=.01)$y y2 - corgen(x=x, r=.5, epsilon=.01)$y y3 - corgen(x=x, r=.25, epsilon=.01)$y a = poly(cbind(y1, y2, y3), degree=1) cor(a[,1], a[,2]) In that case, the

Re: [R] Importing multiple worksheets from one Excle/ csv file into R

2012-03-15 Thread R. Michael Weylandt
The line I gave you will read them in, store them in an object called a list (which is just a generic holding structure, like a struct in C or a list in Python) and, once it's got them all in one list, rbind the whole list together to make one super-data.frame. If you want to keep them separately,

  1   2   >