Re: [R] help plsr function

2014-06-24 Thread Bjørn-Helge Mevik
annie Zhang annie.zhang2...@gmail.com writes: ## the predicted scores from the model (pred - predict(data.cpls,n.comp=1:2,newdata=x.new,type=score)) ## the predicted scores using x%*%projection cbind(x.new.centered%*%data.cpls$projection[,1],x.new.centered%*%data.cpls$projection[,2]) Can

Re: [R] Help partimat()

2014-06-24 Thread Uwe Ligges
On 23.06.2014 19:28, daniel_st...@operamail.com wrote: I am a bit late for this discussion but hope that I might still get an answer. I tried to follow your advice and had a look at drawparti but could not find the relevant section about how to plot specific pairs of variables I am trying to

Re: [R] Custom sampling method in R XXXX

2014-06-24 Thread Dan Abner
Hi Daniel, Great! Many thanks! Dan On Mon, Jun 23, 2014 at 8:23 PM, Daniel Nordlund djnordl...@frontier.com wrote: Something like this could work x - 0.250 new_sample - function(xx) { j-c(0.000,0.125,0.250,0.375,0.500,0.625,0.750,0.875,1.000)

[R] matrix built by diagonal matrices with a given structure

2014-06-24 Thread CAMARDA Carlo Giovanni
Dear R-users, I have a matrix with a series of not-overlapping in a row dimension vectors in a given structure. Something like: |a1, 0, 0, 0| | 0, a2, a3, 0| |a4, 0, 0, a5| where ai are column-vectors of the equal length, m. My aim is to construct a new matrix formed by diagonal

Re: [R] Dead link in the help page of as.Date()

2014-06-24 Thread Prof Brian Ripley
On 23/06/2014 20:41, Christofer Bogaso wrote: Hi, I was reading the help page for as.Date() function for some reason, and noticed a Matlab link: http://www.mathworks.com/help/techdoc/matlab_prog/bspgcx2-1.html It looks like this link is dead. So may be it would be better to put a correct link

[R] Problem with nlm function to minimize the negative log likelihood

2014-06-24 Thread Prof J C Nash (U30A)
This is almost always user error in setting up the problem, but without a reproducible example, you won't get any real help on this list. JN On 14-06-24 06:00 AM, r-help-requ...@r-project.org wrote: Message: 11 Date: Mon, 23 Jun 2014 09:14:23 -0700 From: Ferra Xu ferra...@yahoo.com To:

[R] Making several plots using a loop function

2014-06-24 Thread li li
Hi all, When making a bunch of plots using a loop function, how to add title to reflect different plots. Specifically, for the code below, I generated 9 plots. I would like to add a title to each plot. For example, the titles will be respectively, plot1, plot 2, … plot 9. Thank you very

Re: [R] Making several plots using a loop function

2014-06-24 Thread Kehl Dániel
Hi, try something like main=paste(plot,i) in the plot command. HTH, kd Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; meghatalmaz#243;: li li [hannah@gmail.com] Küldve: 2014. június 24. 15:17 To: r-help Tárgy: [R] Making

Re: [R] Making several plots using a loop function

2014-06-24 Thread Sarah Goslee
What about title(paste(plot, i)) ? Sarah On Tue, Jun 24, 2014 at 9:17 AM, li li hannah@gmail.com wrote: Hi all, When making a bunch of plots using a loop function, how to add title to reflect different plots. Specifically, for the code below, I generated 9 plots. I would like to

Re: [R] help plsr function

2014-06-24 Thread cindy Guo
Ok, yes, I can match them now. Thank you very much! On Tue, Jun 24, 2014 at 3:58 AM, Bjørn-Helge Mevik b.h.me...@usit.uio.no wrote: annie Zhang annie.zhang2...@gmail.com writes: ## the predicted scores from the model (pred - predict(data.cpls,n.comp=1:2,newdata=x.new,type=score)) ##

Re: [R] Making several plots using a loop function

2014-06-24 Thread Frede Aakmann Tøgersen
Well you can use the main argument of the plot function together with a call to sprintf(). Like this: main = sprintf(Plot %s, i) Best regards Frede Sendt fra Samsung mobil Oprindelig meddelelse Fra: li li Dato:24/06/2014 15.19 (GMT+01:00) Til: r-help Emne: [R] Making

[R] non-interactive error in .First function

2014-06-24 Thread Brian Chalfant
Hi all - Long-time user, first-time poster. I added a .First function to my Rprofile.site file to check for updates, clean the console, and put some fun quotes on startup.  This used to work without error.  I hadn't used R (which I usually play with in RStudio) in a few weeks, but when I

[R] Retaining the original document id in #topicmodels in R

2014-06-24 Thread 张伦
Hi all, I am currently using package topicmodels to find the topics of a given text. The dataset contains 8523 documents. I would like to see which documents belong to which topic. Here is my code: get the documentTermMatrix# tdm=DocumentTermMatrix(corpus,control)

[R] Retaining the original document id in #topicmodels in R

2014-06-24 Thread 张伦
Hi all, I am currently using package topicmodels to find the topics of a given text. The dataset contains 8523 documents. I would like to see which documents belong to which topic. Here is my code: get the documentTermMatrix# tdm=DocumentTermMatrix(corpus,control)

[R] (no subject)

2014-06-24 Thread Zayd Farah
I hope the following script is reproducible enough to highlight my issue, which is to automatically (in this case by loop, but it does not necessarily have to be by a loop) add geom_line layers for each column of mydata to the ggplot variable p1. for some reason doing this only works by manually

Re: [R] (no subject)

2014-06-24 Thread Anthony Damico
the loop is 1 thru 9 but the manual is just 1, 2, 3, 4? change the loop from 1:dim(mydata)[2] to 1:4 and it works :) On Tue, Jun 24, 2014 at 9:43 AM, Zayd Farah zaydfa...@gmail.com wrote: I hope the following script is reproducible enough to highlight my issue, which is to automatically (in

Re: [R] (no subject)

2014-06-24 Thread Jeff Newmiller
Reproducibility == good (except for mixing in invalid code and failing to set RNG seed) HTML email == bad Missing subject == bad Using matrices with ggplot == pushing a rope Using for loops to build a ggplot == missing the point Using wide-form data with ggplot == pushing a rope Study the

Re: [R] non-interactive error in .First function

2014-06-24 Thread Jeff Newmiller
Suggestions: a) Don't post in HTML format... your code appears corrupt. b) Don't do this. Read the Note in ?.First On Tue, 24 Jun 2014, Brian Chalfant wrote: Hi all - Long-time user, first-time poster. I added a .First function to my Rprofile.site file to check for updates, clean the

Re: [R] c() with POSIXlt objects and their timezone is lost

2014-06-24 Thread Jeff Newmiller
This is a rope. Don't push it. Been there, been swatted. The current structure of R cannot support vectors of POSIXt timestamps that have different tzones in different elements. You can keep a parallel vector of tzones separately and manage environment variable TZ as needed if you really must

Re: [R] Dead link in the help page of as.Date()

2014-06-24 Thread Ista Zahn
Fortunately we have the wayback machine: https://web.archive.org/web/20120425004417/http://www.mathworks.com/help/techdoc/matlab_prog/bspgcx2-1.html Best, Ista On Tue, Jun 24, 2014 at 8:53 AM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On 23/06/2014 20:41, Christofer Bogaso wrote: Hi,

[R] Need help to understand ecdf (empirical cumulative distribution function)

2014-06-24 Thread Nourhène Alaya
Hi, I m a new user of R. I need to plot distribution of some computed centrality metrics of my network. I used ecdf to compute the cumulative distribution of degrees and then plotted the resultat. However, i got a different distribution from the one computed using the degree.distribution function

Re: [R] rfImpute

2014-06-24 Thread Julian Karch
I am having the same problem trainImp - rfImpute(train[,!colnames(train)==score],train$score) yields Error in randomForest.default(xf, y, ntree = ntree, ..., do.trace = ntree, : NA not permitted in predictors any ideas? -- View this message in context:

[R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread Tahira Jamil
Hi, I am interested in generating all possible contingency table (2 by 2) with fixed row margins and column margins. Can anyone help me. Best regards, Tahira [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] ASA Conf. on Stats Practice - deadline THURSDAY

2014-06-24 Thread Adams, Jean
R users, Abstracts are now being accepted for the 2015 ASA Conference on Statistical Practice, February 19-21, New Orleans, Louisiana, USA. Each presentation will have a 45-minute time slot. If you are interested, you may submit your abstract on the website,

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread Gabor Grothendieck
On Tue, Jun 24, 2014 at 10:41 AM, Tahira Jamil tahja...@gmail.com wrote: Hi, I am interested in generating all possible contingency table (2 by 2) with fixed row margins and column margins. Can anyone help me. If the reason you want this is to sample them then r2dtable can do that directly.

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread peter dalgaard
On 24 Jun 2014, at 16:41 , Tahira Jamil tahja...@gmail.com wrote: Hi, I am interested in generating all possible contingency table (2 by 2) with fixed row margins and column margins. Can anyone help me. It's pretty easy, just find one compatible solution and add or subtract 1 -1 -1

Re: [R] non-interactive error in .First function

2014-06-24 Thread Brian Chalfant
(a) Sorry, that was my first post.  I'll be sure to plain text from here on. (b) Hmm.  It is not intended that there be interaction with the user during startup code.  Attempting to do so can crash the R process, especially so prior to R 3.0.2.  I had been using this with 3.0.1. with no

[R] converting a list with named member to a vector maintaining original names

2014-06-24 Thread C Lin
Dear R users, I have a list that I'd like to convert to a vector while preserving the original names. For example: test - list(ABCC2=37280,ABCC5=c(12268,13308)); If I do unlist, it automatically renamed the ABCC5 to ABCC51 and ABCC52 unlist(test)  ABCC2 ABCC51 ABCC52   37280  12268  13308 

[R] Query

2014-06-24 Thread Anchal
Dear Sir, I wish to use the ltm package but it gives the following error Error in library(ltm) : there is no package called ‘ltm’ How to resolve this issue in R Looking forward to your reply. Thanks Regards anchal [[alternative HTML version deleted]]

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread David L Carlson
Since a 2x2 table with fixed row and column margins has only one degree of freedom, it is pretty easy to enumerate them: AB A acM[3] B bdM[4] M[1] M[2] N Create a vector of the margins: M - c(a+b, c+d, a+c, b+d) The number of possible tables is min(M[c(1, 3)])+1

Re: [R] Query

2014-06-24 Thread Sarah Goslee
Have you installed it, perhaps with install.packages(ltm) ??? If you have, and it installed correctly, then we'll need the information on your system requested in the posting guide linked at the end of this message. Sarah On Tue, Jun 24, 2014 at 1:49 PM, Anchal garg.anc...@gmail.com wrote:

Re: [R] converting a list with named member to a vector maintaining original names

2014-06-24 Thread Ista Zahn
How about x - unlist(test) (names(x) - rep(names(test), times = sapply(test, length))) ? See also unlist2 from http://www.bioconductor.org/packages/release/bioc/html/AnnotationDbi.html Best, Ista On Tue, Jun 24, 2014 at 12:56 PM, C Lin bac...@hotmail.com wrote: Dear R users, I have a list

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread Michael Peng
David gave a great solution. I think it is better to start from 0 to min(M) instead of from min(M[c(1,3)]) to avoid negative values in the table. If the minimum is in M[1] or M[3], a = 1:min(M). Otherwise, d=1:min(M). Best, Gang 2014-06-24 13:18 GMT-05:00 David L Carlson dcarl...@tamu.edu:

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread David L Carlson
Michael is correct. I answered too quickly. This will correct the original suggestion: M - c(15, 5, 15, 5) # New example where M[2] and M[4] are smaller M[1]+M[2] == M[3]+M[4] [1] TRUE upper - min(M[c(1,3)]) lower - 0 if (min(M) upper) lower - upper - min(M) all.2x2s -

[R] Fortune nomination; was Re: (no subject)

2014-06-24 Thread David Winsemius
On Jun 24, 2014, at 7:52 AM, Jeff Newmiller wrote: Jeff Newmiller's rhelp/ggplot strategy checklist: Reproducibility == good (except for mixing in invalid code and failing to set RNG seed) HTML email == bad Missing subject == bad Using matrices with ggplot == pushing a rope Using for

Re: [R] converting a list with named member to a vector maintaining original names

2014-06-24 Thread C Lin
You're amazing. Thanks so much! That's exactly what I am looking for. From: istaz...@gmail.com Date: Tue, 24 Jun 2014 14:32:27 -0400 Subject: Re: [R] converting a list with named member to a vector maintaining original names To: bac...@hotmail.com

[R] saving a 'get' object in R

2014-06-24 Thread David Stevens
R community, Apologies if this has been answered. The concept I'm looking for is to save() an object retrieved using get() for an object that resulted from using assign. Something like save(get(foo),file=paste(foo,'rData',sep='')) where assign(foo,obj) creates an object named foo with the

Re: [R] saving a 'get' object in R

2014-06-24 Thread Michael Peng
You can use the following command: tmp - get(foo) save(tmp,file=paste(foo,'.rData',sep='')) Best, Mike 2014-06-24 15:35 GMT-05:00 David Stevens david.stev...@usu.edu: R community, Apologies if this has been answered. The concept I'm looking for is to save() an object retrieved using

Re: [R] saving a 'get' object in R

2014-06-24 Thread Greg Snow
I think that you are looking for the `list` argument in `save`. save( list=foo, file=paste0(foo, '.Rdata') ) In general it is best to avoid using the assign function (and get when possible). Usually there are better alternatives. On Tue, Jun 24, 2014 at 2:35 PM, David Stevens

[R] force dialog window to front?

2014-06-24 Thread Brian Chalfant
Howdy - I'm wondering if there is a way to force an R dialog window to the front in a Windows OS.  In particular, I defined a .Last function in my Rprofile.site file that consists only of the updateR() function so as to check for R updates on close.  However, the dialog window for this pops up

[R] Biplot interpretation

2014-06-24 Thread javad bayat
Dear all; I did biplot in R. How can I interpret them in order that i can create two or more groups in each biplot. I wanna determine the variables that have the same origin. please help me. many thanks. -- Best Regards Javad Bayat M.Sc. Environment Engineering Shahid Beheshti (National)

Re: [R] saving a 'get' object in R

2014-06-24 Thread Henrik Bengtsson
I recommend to use saveRDS()/readRDS() instead. More convenient and avoids the risk that load() has of overwriting existing variables with the same name. /Henrik On Tue, Jun 24, 2014 at 1:45 PM, Greg Snow 538...@gmail.com wrote: I think that you are looking for the `list` argument in `save`.

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread tahira jamil
Hi, Thank you all! Best regards, Tahira On Tue, Jun 24, 2014 at 9:07 PM, David L Carlson dcarl...@tamu.edu wrote: Michael is correct. I answered too quickly. This will correct the original suggestion: M - c(15, 5, 15, 5) # New example where M[2] and M[4] are smaller M[1]+M[2] ==

Re: [R] saving a 'get' object in R

2014-06-24 Thread David Stevens
Thanks to all for the replies. I tried all three and they work great. I was misinterpreting the list = parameter in save(...) and I get your point about overwriting existing objects. I've heard about not using assign/get before. Can anyone point me to why and what alternatives there are?

Re: [R] saving a 'get' object in R

2014-06-24 Thread Bert Gunter
Have you read An Introduction to R (ships with R) or other online R tutorial (there are many good ones). Looks to me like you haven't these are pretty basic R basics. But maybe I misinterpret... Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not

Re: [R] saving a 'get' object in R

2014-06-24 Thread Greg Snow
The main reason to avoid assign/get is that there are better ways. You can use a list or environment more directly without using assign/get. Also the main reason to use assign/get is to work with global variables which are frowned on in general programming (and prone to hard to find bugs).

Re: [R] rfImpute

2014-06-24 Thread Jeff Newmiller
Ideas: Read the Posting Guide (http://www.R-project.org/posting-guide.html) for this mailing list (one of the gems in there warns you to not post using HTML email) Provide a reproducible example (e.g. per [1]) that includes the library/require statements that load your packages Consider

[R] Generating Patient Data

2014-06-24 Thread Abhinaba Roy
Dear R helpers, I want to generate data for say 1000 patients (i.e., 1000 unique IDs) having suffered from various diseases in the past (say diseases A,B,C,D,E,F). The only condition imposed is that each patient should've suffered from *atleast* two diseases. So my data frame will have two

Re: [R] converting a list with named member to a vector maintaining original names

2014-06-24 Thread arun
To get the vector setNames(stack(test)[,1],stack(test)[,2]) #ABCC2 ABCC5 ABCC5 #37280 12268 13308 #or setNames(unlist(test),stack(test)[,2]) #ABCC2 ABCC5 ABCC5 #37280 12268 13308 A.K. On , arun smartpink...@yahoo.com wrote: You could do: stack(test)[,2:1] #    ind values #1 ABCC2 

[R] Assigning document id to each document containing in the Document Term Matrix (R Package tm)

2014-06-24 Thread 张伦
Dear All, When I do DocumentTermMatrix analysis, can I assign a document id to the document (i.e., the row in the attached matrix marked in red)? Here is my code: tdm=DocumentTermMatrix(corpus,control) inspect (tdm2[5:20,9:14]) Terms Docs 002089 002223 002236 002268 002415 002439 5

Re: [R-es] asignacion de un valor a un elemento de una lista

2014-06-24 Thread Jose Ramirez Costa
Gracias Daniel y Carlos, el problema de mi lista es q la columna que queria modificar estaba como factor entonces no podia modificarla elemento a elemento. La solucion que encontre fue primero asignar como character la columna y luego si modificarla l3[[1]][1,5]-as.character(l3[[1]][,5])