Hi
I'm learning R language from past one month .As R is used highly for data
analysis ,mining and modeling ,I want to know few real time examples in R in
order to make my learning fun filled and practical .Any quick suggestions are
appreciated .
Regards,
Lalitha Kristipati
Associate
Hello dear R-helpers,
I have a small problem in my algorithm. I have sequences of 0 and 1
values in a column of a huge data frame, and I just would like to keep the
first value of each sequences of 1 values, such like in this example:
data -
Dear jeff6868,
Here is one way:
ifelse(with(data, c(0, diff(mydata))) != 1, 0, 1)
You could also take a look at ?rle
HTH,
Jorge.-
On Mon, Dec 15, 2014 at 9:33 PM, jeff6868 geoffrey_kl...@etu.u-bourgogne.fr
wrote:
Hello dear R-helpers,
I have a small problem in my algorithm. I have
If you are testing H0: p = 0.6 vs H1: p != 0.6 with a sample of size 10 and you
observe X=2, then Pr(X = 2) + Pr(X = 8) is not what you want. You can argue
that you want Pr(X = 2) + Pr(X = 10). Both 2 and 10 are 4 away from the null.
binom.test(2, 10, 0.6, alternative=two.sided) # 0.01834
we can speed this up a lot
system.time(for (i in 1:2000) ifelse(c(0, diff(data$mydata)) != 1, 0, 1))
user system elapsed
0.122 0.012 0.132
system.time(for (i in 1:2000) as.numeric( c(0, diff(data$mydata))==1))
user system elapsed
0.073 0.007 0.078
ifelse(c(0,
On Fri, Dec 12, 2014 at 11:00 AM, Kathryn Lord kathryn.lord2...@gmail.com
wrote:
Dear all,
Suppose that I have natural numbers 1 through 28.
Based on these numbers, choose 4 numbers 7 times without replacement and
make a 4 by 7 matrix, for example,
After a relaxing weekend, it came to me
I would recommend finding some tutorials on line in areas that you enjoy, read
http://r-bloggers.com every day, find introductory texts in the statistical
areas of interest, and study some texts on R programming. I really enjoyed The
Art of R Programming: A Tour of Statistical Software Design
Subscribers,
What is my mistake with the following example:
library(lattice)
testmatrix-matrix(c(1,2,3,4,3,6,12,24),nrow=4,ncol=2)
testylabels-c('w1','x1','y1','z1')
dotplot(testmatrix, scales=list(y=list(testylabels)), xlab=NULL)
#testylabels not shown, instead 'D' 'C' 'B' 'A'
Thanks in
Actually there are not so many matrices as you suggest.
comb - combn(28, 4)
dim(comb)
[1] 4 20475
sum(comb[1,]==1)
[1] 2925
comb[, 1]
[1] 1 2 3 4
There are 20,475 combinations, but you cannot choose any four to make a 4x7
matrix since each value can be used only once. The combn()
On Mon, Dec 15, 2014 at 10:06 AM, David L Carlson dcarl...@tamu.edu wrote:
Actually there are not so many matrices as you suggest.
comb - combn(28, 4)
dim(comb)
[1] 4 20475
sum(comb[1,]==1)
[1] 2925
comb[, 1]
[1] 1 2 3 4
There are 20,475 combinations, but you cannot choose any
You are very close. The argument scales(list(y=list())) supports multiple
arguments for the y axis so you need to tell lattice how to use testylabels:
dotplot(testmatrix, scales=list(y=list(labels=testylabels), xlab=NULL))
-
David L Carlson
Department of
Great! Both ways works well for my whole data!
Thanks guys!
--
View this message in context:
http://r.789695.n4.nabble.com/keep-only-the-first-value-of-a-numeric-sequence-tp4700774p4700783.html
Sent from the R help mailing list archive at Nabble.com.
Hi, Dr. Gu,
I am trying to highlight some axis labels, for example, 72hL3 as bold, using
the following command:
circos.initialize(factors=female.f, xlim=c(1.8,6.2))
circos.trackPlotRegion(factors=female.f,
On 15/12/2014 05:33, Spencer Graves wrote:
Hello, All:
What do people do to strip accents from latin characters, returning
vanilla ASCII?
I think the devil is the detail here: what is Latin? Latin-1 has
characters for which this is unclear, let alone Latin-2 or Latin-7.
What I
How do the rows in the summary (e.g. 1 == 0) correspond to the model? The
answer is buried *contrast::contrast()*, but I can't figure it out.
Consider this modified example I stole from here
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q4/003061.html...
options(contrasts = c(factor =
Hi everyone,
I'm sure this question has been asked before, but I'm unable to find a
definitive answer (if there is any). I've been trying to put back to
CRAN a package (grasp-r). The package uses many functions that share a
lot of common variables. For instance, a model call is created by the
Thanks Henrik! Adding the line
library(methods)
to the list of required libraries did indeed solve the problem. My next
comment will show my naivety when it comes to R dependency management, but
I noticed that including `library(rJava)` in place of methods also solves
the problem. This confuses
On 15/12/2014 12:28 PM, Fabien Fivaz wrote:
Hi everyone,
I'm sure this question has been asked before, but I'm unable to find a
definitive answer (if there is any). I've been trying to put back to
CRAN a package (grasp-r). The package uses many functions that share a
lot of common variables.
On Mon, Dec 15, 2014 at 12:33 AM, Spencer Graves
spencer.gra...@prodsyse.com wrote:
Hello, All:
What do people do to strip accents from latin characters, returning
vanilla ASCII?
I find the stringi package works well for this sort of thing, e.g.,
library(stringi)
x - c(!, \, #,
On Dec 15, 2014, at 8:41 AM, Fix Ace wrote:
Hi, Dr. Gu,
I am trying to highlight some axis labels, for example, 72hL3 as bold,
using the following command:
circos.initialize(factors=female.f, xlim=c(1.8,6.2))
circos.trackPlotRegion(factors=female.f,
Thanks for the quick answer. Your second guess was right, I only need
one environment.
I learned one thing: I can create a .R file in my package that is NOT a
function. Something that contains just
dummyEnv - new-env(parent=emptyenv())
And it works!
Thanks again
Le 15. 12. 14 19:47, Duncan
Hi,
In current version, `labels.font` in `circos.axis` can only be a scalar ( a
vector with length one).
But you can first add axes with no labels and then add labels by `circos.text`:
female.f = c(a, b)
circos.initialize(factors=female.f, xlim=c(1.8,6.2))
Duncan,
Thank you very much.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 12/13/14, 1:06 PM, Duncan Temple Lang dtemplel...@ucdavis.edu wrote:
Hi Don
library(XML)
readxmldate =
function(xmlfile)
{
doc =
Thanks!
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 12/13/14, 1:22 PM, Boris Steipe boris.ste...@utoronto.ca wrote:
Or ...
txt -
docCreaDate20120627/CreaDateCreaTime07322600/CreaTime/doc
if (!require(XML)) {
On Mon, Dec 15, 2014 at 9:44 AM, Jeff Hansen dsche...@gmail.com wrote:
Thanks Henrik! Adding the line
library(methods)
to the list of required libraries did indeed solve the problem. My next
comment will show my naivety when it comes to R dependency management, but I
noticed that including
Hi ,
As the OP was asking for examples , I would also recommend Modeling
Techniques in Predictive Analytics by Thomas Miller.
That book is full of examples + R scripts. Its on Amazon.
Regards
Billy
--
|
26 matches
Mail list logo