You might want to look at package plyr and use ddply.
HTH,
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapprove
> -Original Message-
> From: r-help-boun...@r-project.org [ma
y the
variables selected in the previous step.
Good luck!
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapprove
> -Original Message-
> From: r-help-boun...@r-project.org [ma
to name any variable t, as this is also
the function for transposing a matrix, and could end up being confusing at
the least. Second: for most practical purposes, it's better to leave out the
*100.
Good luck,
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure
making the new behavior optional (through
a new parameter na.action or similar, with the default the original
behavior) is an option?
Feel free to run your own version of rle in any case. I suggest you rename
it, though, as it may cause problems for some packages.
Nick Sabbe
--
ping: nick.sa
You might want to send this message to the Rcpp mailing list at:
Rcpp-devel mailing list
rcpp-de...@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
It will improve your chances of getting a swift (if not helpful) reply.
Nick Sabbe
--
ping
Try
(df1[order(-df1[,2]),])
Adding the minus within the [ leaves out the column (in this case column 2).
See ?"[".
HTH.
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapprove
---
you're interested about, based
on graph object g
#for now I'm just returning edge and vertex counts
return(c(v=vcount(g), e=ecount(g)))
})
colnames(result)<-unique(dfr$Graph.ID)
print(result)
HTH,
Nick Sabbe
--
ping: nick.sa...@ugent.be
(invisible(factorsToDummyVariables.old (ds[20:30,])))
## user system elapsed
## 2.110.002.15
If you have to do this quite often, the difference surely adds up...
More improvements may be possible.
This function only works if you don't include interactions, though.
Nick Sabbe
--
orks. I set
col.ticks to match the color of my abline (in the nonsimplified code), and
this works too, but unfortunately, the label below the tick is not in this
color, and a parameter for this is not present in axis.
Suggestions for either? Note: I'm on windows 7 with R 2.13.
Nick Sabbe
-
Hi Michael.
This is a classic :-)
ObjectsOfInterest<- list(one_df, two_df, three_df)
for(namedf in ObjectsOfInterest){...}
or probably even better
sapply(ObjectsOfInterest, function(namedf){...})
hth.
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coup
No, that does not work.
You cannot do assignment within (l)apply.
Nor in any other function for that matter.
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapprove
-Original Message
#columnsOfInterest or similar, and pass that instead of c(xvarname,
yvarname) )
return(indextable)
}
myfunct.better("yes", lvarname="lvar", xvarname="xvar", yvarname="yvar",
dataframe=Fulldf)
HTH,
Nick Sabbe
--
ping: nick.sa...@ugent.be
li
subset(Fulldf, lvar==subgroup, select=c("xvar","yvar"))
Which should become something like (untested but should be close):
Data.tmp <- Fulldf[Fulldf[,"lvar"]==subgroup, c("xvar","yvar")]
This should be a lot easier to translate based on column n
. And
similarly depending, I may be better still if you remove the rows that
you're not interested in as well (some more but similar index trickery
required then.
HTH,
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring
ing box is in cube-form
(scaling variables)
#note: if you want to flip an axis, use -1 in the statement above
axes3d() #Show axes
title3d(main = main, sub=paste("Green is low", ulab, ", red is
high")
xlab = xlab, ylab = ylab, zlab = zlab)
d, like: given a
matrix with two columns, create a vector holding the differences and the
sums of the columns - I know this can be done without *apply as well, but
apart from that it is a more attainable exercise).
Good luck to you on that!
HTH,
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http:
he L1 penalty is not differentiable).
Some 'solutions' exist (bootstrap, for one), but they have all been shown to
have (statistical) properties that make them - at the least - doubtful. I
know, because I'm working on this. Short answer: there is no way to do this
(at this time).
HTH (and ha
Hello Vincy.
You probably want
y[match(z,x)]
Or, more instructional:
whereAreZInX<-match(z, x)
y[whereAreZInX]
HTH,
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapprove
-Original Mess
terrible
misunderstanding of what comprises a generic function?
Thx,
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: <http://biomath.ugent.be/> http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapp
b=names(mydata1)[k])
lapply(seq_along(mydata_list), function(j){
foo_reg(dat=mydata_list[[j]], xvar=ind.xvar, yvar=k, mycol=j,
pos=mypos[j], name.dat=names(mydata_list)[j])
return(NULL)
})
invisible(NULL)
})
HTH,
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomat
t the 'best' value for the penalization parameter
from the plot (see ?plot.cv.glmnet), or you can use some numerical argument
to find the reasonable extreme value for the criterion.
Really boilerplate, I guess.
Good luck.
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ug
taframe, I don't have the option to do this conversion
before the imputation, so I really need the conversion itself to work
quickly.
Thanks,
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disappro
n-package bound copy of the function, I want to make sure that when I
call pkg::plot.something, this works as before, but when, from within this
function, pkg:: plot.something.internal is called, I want it to call _my_
version of it.
Any takes?
Nick Sabbe
--
ping: nick.sa...@ugent.b
Vito Muggeo (UniPa) [mailto:vito.mug...@unipa.it]
Sent: vrijdag 28 januari 2011 14:42
To: Nick Sabbe
Cc: r-help@r-project.org
Subject: Re: [R] plot not generic
dear Nick,
getAnywhere("plot.glmnet")
Note the message you get when you type
methods(plot)
...
>>> Non-visible
noticed that R does not recognize 'plot'
as a generic function, and as such, showMethods does not work.
This seems to conflict with the documentation for plot.
So 2 questions:
. How can I find the code of plot.glmnet
. Why is plot not seen as generic?
Thx.
t;a",].
I tried some variants of
Ind3<-list(Mm,"b",NULL)
do.call("[", Ind3)
But all of these return integer(0).
So the actual new question is: how do I pass a 'missing' argument through a
do.call?
Thanks for any pointers,
Nick Sabbe
--
ping: nick.sa...@ugent
("b","g")
This holds, for each dimension, an indexer for that dimension.
Now I would like to get the element pointed at by the list.
The obvious solutions don't seem to work, and I can't seem to get do.call to
call the indexer ('[') on my mul
-c(rv,NA)
}
#cat("levels with na: ", rv, "\n")
return(rv)
}
expand.combs<-function(dfr, includeNA=FALSE, onlyOccurring=FALSE)
{
expand.grid(lapply(dfr, getLevels, includeNA, onlyOccurring))
}
Thx.
Nick Sabbe
--
ping: nick.sa...@ugent.be
link
t;). It would also be nice to be able to choose
whether or not NA's are included.
I'm convinced that some package holds a readymade solution, and I'm trying
to switch from always writing my own stuff (get the number of levels per
column, then use some apply magic) to using what is t
ern<- c(-1,0,1,0)
rep(pattern, ceiling(n/length(pattern)))[1:n]
If you want a sequence of random real numbers between -1 and 1, use
runif(10, min=-1, max=1)
Here's hoping I haven't just solved your homework...
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink:
Hi Felipe,
gsub("[^0123456789]", "", "AB15E9SDF654VKBN?dvb.65")
results in "15965465".
Would that be what you are looking for?
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
Hello Germán.
You probably want something like:
sapply(vmat, function(curMat){
curMat[,999] != 0
})
Or if you want the indices, just surround this with a which.
HTH.
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653
f R? Or is there any way in which this
depends on the specifics of my function (for nontrivial functions and list
sizes)?
Thanks!
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: <http://biomath.ugent.be/> http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/
ent, you can access g by:
lamda["g"]
as in:
> Q<-exp(lamda["g"])
It looks like you've got a misunderstanding of how R variables work, but
maybe I just misunderstood your question...
HTH,
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
and search for <<-, for more information).
* apart from that: you may want to avoid the for loop here altogether:
y[i:10]<-(i:10)+1
f[i:10]<-y[(i-1):9]/2
gives you the same result, but more in the R fashion (in general, you want
to avoid explicit for loops in R)
HTH,
Nick Sabbe
--
ld also like to
see an example where they prove to be the better way to go (by any criteria,
but preferably speed or perhaps other resource usage)
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapp
hecked whether the rest of your
code is OK)
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapprove
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org
Whenever you use a recursion (that cannot be expressed otherwise), you
always need a (for) loop.
Apply and the like do not allow to use the intermediary results (i.e. a[i-1]
to calculate a[i]).
So: no, it cannot be avoided in your case, I guess.
Nick Sabbe
--
ping: nick.sa...@ugent.be
link
For simple searches, use grep with fixed=TRUE.
Check ?grep.
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapprove
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help
return(val)
}
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapprove
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Sa
Check ?sample.
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapprove
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Gundala
diately.
A likely consequence will be that your code will run somewhat slower.
For using some output as 'progress control' you definitely want to turn the
option off.
Nick Sabbe
--
ping: nick.sa...@ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/
42 matches
Mail list logo