Hi David,
I was thinking something like this:
ID Disease
1 A
2 B
3 A
1C
2D
5A
4B
3D
2A
....
How can this be done?
On Wed, Jun 25, 2014 at 11:34 AM, David Winsemius
wrote:
>
> On Jun 24, 2014, at 10:14 PM, Abhinaba Roy wrote:
>
> > Dear R helpers,
> >
On Jun 24, 2014, at 10:14 PM, Abhinaba Roy wrote:
> 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 fro
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
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 wrote:
You could do:
stack(test)[,2:1]
# ind values
#1 ABCC2 37280
#2 ABCC5 12268
#3 AB
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
columns
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 subscr
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).
Consid
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 inf
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?
Reg
Hi,
Thank you all!
Best regards,
Tahira
On Tue, Jun 24, 2014 at 9:07 PM, David L Carlson 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] == M[3]+M[4]
> [1]
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`.
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)
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 u
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 wrote:
> R commun
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 :
> 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
>
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 con
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.co
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 fo
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 <- t(sapply
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 :
> Since a 2x2 table w
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 wrote:
> Dear R users,
>
> I have a list that I'd like
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 wrote:
> Dear Sir,
>
> I wis
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
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]]
_
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
(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 probl
On 24 Jun 2014, at 16:41 , Tahira Jamil 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 1
until one o
On Tue, Jun 24, 2014 at 10:41 AM, Tahira Jamil 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.
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,
http://www.amstat.org/meetings/c
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
https://s
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:
http://r.789695.n4.nabble.com/r
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
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
wrote:
> On 23/06/2014 20:41, Christofer Bogaso wrote:
>>
>> Hi,
>>
>> I was reading
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
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 console
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 follow
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 wrote:
> I hope the following script is reproducible enough to highlight my issue,
> which is to automatically (in this case by loop
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 ad
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)
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 start
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)
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 sev
Ok, yes, I can match them now. Thank you very much!
On Tue, Jun 24, 2014 at 3:58 AM, Bjørn-Helge Mevik
wrote:
> annie Zhang 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%*%projec
What about
title(paste("plot", i))
?
Sarah
On Tue, Jun 24, 2014 at 9:17 AM, li li 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 add
> a title to
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ó: li li [hannah@gmail.com]
Küldve: 2014. június 24. 15:17
To: r-help
Tárgy: [R] Making severa
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 much!
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
> To: "r-sig-...@r-proje
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
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 diagona
Hi Daniel,
Great! Many thanks!
Dan
On Mon, Jun 23, 2014 at 8:23 PM, Daniel Nordlund
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)
> probs<-c(0.02307692,0.20769231,0.53846154,0.20769231,0
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
annie Zhang 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 someone please tell
52 matches
Mail list logo