similar to: subsetting based on vector

Displaying 20 results from an estimated 1000 matches similar to: "subsetting based on vector"

2005 Mar 23
4
sampling from a mixture distribution
Dear R users, I would like to sample from a mixture distribution p1*f(x1)+p2*f(x2). I usually sample variates from both distributions and weight them with their respective probabilities, but someone told me that was wrong. What is the correct way? Vumani
2003 May 09
1
manipulating elements of a matrix
Dear R users: I have the following matrix. 0 1 1 0 1 0 2 1 0 3 0 0 I would like to spread the matrix such that whenever the row sum is greater than 1 the row is repeated the number of times given by the row sum. Furthermore I would like to split the following cases: 0 1 1 such that it map to the following matrix 0 1 0 0 0 1 such that each row adds up to 1. I have no problems with cases
2006 Mar 08
2
fitting a distribution using glm
it is easy to fit a distribution using fitdistr poisdata <- rpois(n = 100, lambda = 2) poismle <- fitdistr(poisdata, "Poisson") poismle but i would like to know whether its possible to get an identical result using glm. I use poistab <- data.frame(table(poisdata)) colnames(poistab) <- c("width","freq"); poistab[,"width"] <-
2003 Jan 29
1
Scoping rule problem -- solved
Thanks to some comments from Brian D. Ripley, I found my error: I should not have given a data argument to lm() after creating a formula-object. This obviously confused things... Thanks again, I've really learnt again a bit more on R-programming... Cheers, Winfried --------------------------------------------------------------------- E-Mail: Winfried Theis <theis at
2001 May 02
2
rcode and latex
I have discovered the listings package for including code in your latex documents. The default languages do not include R or Splus, but the definition is pretty simple, this is what I did for R: \lst at definelanguage{R}% {morekeywords={TRUE,FALSE,T,F,NA,NULL,Inf,NaN,library,% attach,detach,source,while,for,in,% repeat,switch,break,next,return,stop,function,% if,else,warning,error},%
2000 Aug 31
2
Multiv / hierclust / plclust
I use hierclust (hierarchical clustering) in multiv package. In the documentation it is said that plclust (plotting a dendrogram) is available in S-plus. Can I find it anywhere (I have searched through http://lib.stat.cmu.edu/S and found only quotations of plclust in multiv) or is it only part of the S package (which I don't have)? Thanks --------------- Charles RAUX, Laboratoire
2003 Jan 22
1
something wrong when using pspline in clogit?
Dear R users: I am not entirely convinced that clogit gives me the correct result when I use pspline() and maybe you could help correct me here. When I add a constant to my covariate I expect only the intercept to change, but not the coefficients. This is true (in clogit) when I assume a linear in the logit model, but the same does not happen when I use pspline(). If I did something similar
2007 Jun 20
2
"xtable" results doesn't correspond to data.frame
Dear useRs, Am trying to use xtable on the following data.frame and I don't get what I expect: example.table <- data.frame(rbind( c("Gender"," "," "," "), cbind(rep(" ",2),c("Male","Female"),c(3.0,4.0),c(3/7,4/7)) )) colnames(example.table) <- c(" "," ","number of
2002 Aug 06
2
help with lagged scatterplot
Hi, How do I can make a lagged scatterplot of two variables: Yt (nao) versus Xt-h (mei) if they have the following structure: >series mei nao Jan 1950 -1.036 0.55 Feb 1950 -1.133 3.31 Mar 1950 -1.259 0.81 Apr 1950 -1.027 1.60 May 1950 -1.399 -1.73 Jun 1950 -1.366 1.26 Jul 1950 -1.300 -0.87 . . . I've tried with lag.plot but I don't understanf how to use it Thanks in
2000 Dec 21
1
statistical quality control
Hi all, could anybody tell me whether there exist any packages about statistical quality control. Thanks very much. Stefano Tonellato -- Stefano Tonellato Dipartimento di Statistica Universita' Ca' Foscari di Venezia Campiello S. Agostin, S. Polo 2347 30125 Venezia - ITALY Phone +39-041-2577422 Fax +39-041-710355 E-mail stone at unive.it -------------- next part -------------- An
2000 Oct 18
1
Help oo sink
---------------------- Forwarded by Pan Yuming/Extern/AAM on 18.10.2000 12:58 --------------------------- Pan Yuming 18.10.2000 11:41 To: Prof Brian Ripley <ripley at stats.ox.ac.uk> cc: Subject: Help oo sink (Document link: Pan Yuming) Dear professor, continue with the example i used, i want to save the prediction results but when i run a R file containing the following code, it
2001 Apr 30
2
R mode for emacs
Hi all, I wonder if there is a R mode for emacs which highlights the R syntax. If there is one, I would be interested in downloading the latest version . regards, Olivier -- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- Olivier MARTIN phone: (33) 04 76 61 53 55 Projet IS2 06 08 67 93 42 INRIA Rhone-Alpes fax : (33) 04 76
2001 May 30
2
Graphics
Please, will someone tell me why graphics are not displayed at all when I use a graphical function. Is there some additional software required to see the graphics? ThankYou CJoseBento Portugal -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or
2001 Sep 27
1
cuts and breaks
Hi I'm using the "image" function to produce a plot and I want to define the breaks using "cut" and the colors using "heat.colors". > image(interp(mat2[,2],mat2[,1],mat2[,3]),breaks=cut(mat2[,3],30),col=heat.colors(29)) Error in image.default(interp(mat2[, 2], mat2[, 1], mat2[, 3]), breaks = cut(mat2[, : must have one more break than colour The
2002 Aug 13
2
loess()
One more question... I need to use the Loess() function in the package modreg. What is the argument "formula" meant to be? A -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the
2002 Aug 15
1
sorry!~I have a question
I have a question. I can find a function about "Gaussian hypergeometric function" in sofeware Maple V. I need this function to calculate. Is there a similar function in R ? Or I have to design such a function. Thanks! Jimmy Cheng
2002 Oct 10
2
Help?
Dear Sir : I would ask if R contains some propreties to write the greeks(lambda, theta,xsi,......) en also if R can also the mathematics signs like integrals, indices....... Your sincerly: H.Zmarrou University of Amsterdam: -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send
2003 Jan 23
2
Exporting graphics window
Hi I'm working on a remote computer with R (SuSE 8.1) and I want to do some ploting. Does anyone knows if it is possible to export the graphics window in to my display and how I can do it ? Thanks EJ -- Ernesto Jardim <ernesto at ipimar.pt> Marine Biologist Research Institute for Agriculture and Fisheries Lisboa, Portugal Tel: +351 213 027 000 Fax: +351 213 015 948
2003 Jan 31
2
Varying texts in expression(paste())
Hi, I am using R a lot to make plots relating to radioactivity, I am often using expression() to label the plots with nuclide names written with superscripts, e.g. expression(paste("Releases of ", { }^{99},Tc," (TBq/year)"))->ywtext But, is there any simple way to change the number and name of the nuclide through a variable? I tried nuccode=expression({ }^{99},Tc)
2001 Oct 31
3
Quick question!
Thanks very much to all who answered my question yesterday on loops. Just a further quick question: If I have this: for(i in 1:n) { subset <- data[which(data$id==i),] which returns the rows where I have the variable ID=1, how can I tell the same statement to return just column Y where ID=i? I have tried this for(i in 1:n) { subset <- data[which(data$id==i),data$Y] but it