Dear R users,
I have three plots, so I tried, for exmple,
par(mfrow=c(2,2))
y1 <- rnorm(100)
y2 <- rnorm(100)
y3<- rnorm(100)
plot(y1);plot(y2);plot(y3)
Here, I'd like to put a legend on the bottom right hand side (empty space).
is it possible?
Thanks for helping,
Kathryn Lord
[[al
Hi everyone,
I have a data.table with 200 columns and few million rows and am trying to
calculate the .1 and .9 quantiles for each row across all 200 columns.
I have found different ways to do this, all with different performances. The
examples I used are below. I wonder whether there is a fast
On Sat, Jan 31, 2015 at 1:36 PM, Fisher Dennis wrote:
> followed by a series of errors:
> > gcc -m32 -shared -s -static-libgcc -o ../compiled/Windows32.so tmp.def
> ConvertSAS.o CKHashTable.o readstat_convert.o readstat_bits.o readstat_io.o
> readstat_sas.o -Ld:/RCompile/CRANpkg/extralibs64/local
On Feb 4, 2015, at 11:42 AM, Nick Jeffery wrote:
> Dear R users,
>
> I am having trouble finding a package and function to remove DNA sequences
> from a fasta file that are >99% similar and/or create an output of the
> remaining "unique" sequences. I found the uniquefasta function in phytools
>
Hi All,
I need to loop through and download the past 10 years of met data to a
temporary directory. I then need to unzip it and place it into another
directory.
year = (2005:2015)
for (i in year)
tmpdir = tempdir()
file[i] = file.path(tmpdir, sprintf('724927-23285-%4i.gz', i))
url = spri
Of course you are correct the second answer should be
c(2,2,1,1,1,3)
Thanks everyone.
On Wed, 2015-02-04 at 20:53 +, David L Carlson wrote:
> How about?
>
> > ave(dat$D, dat$S, FUN=order)
> [1] 2 1 1 1 2 3
> > ave(dat_2$D, dat_2$S, FUN=order)
> [1] 2 2 1 1 1 3
>
> Note, your answer for the
Dear Z and Nikolaus,
Thank you for your help.
Here is my R codes:
>data("MunichBnd")
>N <- length(MunichBnd); n <- N*5
>dat <- data.frame(x1 = runif(n, -3, 3),id = as.factor(rep(names(MunichBnd),
>length.out = n)))
>dat$sp <- with(dat, sort(runif(N, -2, 2), decreasing = TRUE)[id])
>dat$re_poi <
Steve (and any others still paying attention to this thread),
Larry Wall (author of Perl) said something along the lines of:
things that are similar should look similar, things that are different
should look different.
Ironically one of the first places I saw that quote was in a Perl vs.
Python
A potential problem with
ave(dat_2$D, dat_2$S, FUN=order)
is that it will silently give the wrong answer
or give an error if dat_2$D is not numeric.
E.g., if D is a Date vector we get
> dat_3 <- dat_2[,1:2]
> dat_3$D <- as.Date(paste0("2015-02-", dat_2$D))
> with(dat_3, ave(D, S, FUN=orde
How about?
> ave(dat$D, dat$S, FUN=order)
[1] 2 1 1 1 2 3
> ave(dat_2$D, dat_2$S, FUN=order)
[1] 2 2 1 1 1 3
Note, your answer for the second example is incorrect since row 2 (c, 3) and
row 5 (c, 2) are both assigned 2.
-
David L Carlson
Department of Anthrop
I have some materials at http://tutorials.iq.harvard.edu , you're welcome
to use or adapt.
On Feb 3, 2015 6:12 AM, "Michael Haenlein" wrote:
> Dear all,
>
> I am Professor at a business school and I would like to develop a course
> about quantitative research using R.
>
> My current plan is that
A useful technique when it is easy to compute a vector from an ordered
data.frame but you need to do it for an unordered one is to compute the
order
vector 'ord', compute the vector from df[ord,], and use df[ord,...] <-
vector
to reorder the vector. In your case you could do:
> dat_2<-data.frame
Sorry Jim,
That messes up on S=='a'. Should be 2,1 not 1,2
Neat answer though and looks like it should be pretty quick after I
apply some sorting.
On Wed, 2015-02-04 at 15:37 -0500, jim holtman wrote:
> >
> dat<-data.frame(S=factor(c(rep('a',2),rep('b',1),rep('c',3)),levels=c('b','a','c')),
> +
>
dat<-data.frame(S=factor(c(rep('a',2),rep('b',1),rep('c',3)),levels=c('b','a','c')),
+ D=c(5,1,3,2,3,4))
> dat
S D
1 a 5
2 a 1
3 b 3
4 c 2
5 c 3
6 c 4
> dat$visit <- ave(seq(nrow(dat)), dat$S, FUN = seq_along)
> dat
S D visit
1 a 5 1
2 a 1 2
3 b 3 1
4 c 2 1
5 c
It's hard to say from your description what the situation is. The error
simply means the plot area is too small for the figure margins to fit. Try
closing the graphics (plot) window before you run the section that causes
the error, or you can try maximizing the plotting window.
You can also contact
Is there a way for me to use the Swirl course "Data_Visualization"? This
is my main reason for learning R, for the plotting ability but can't use
the course. I've already been through the following (Programming,
Programming Alt, Getting_and_Cleaning_Data).
I get the following
===
Dear R users,
I am having trouble finding a package and function to remove DNA sequences
from a fasta file that are >99% similar and/or create an output of the
remaining "unique" sequences. I found the uniquefasta function in phytools
but R can't find this function and also doesn't allow me to set
Hi,
To complete the last part:
> dist <- function(x)
+ {
+
return(c(rep(x[1],15),rep(x[2],15),rep(x[3],25),rep(x[4],20),rep(x[5],25)))
+ }
> x <- dist(c(2,3,2,5.3,7.3))
> x
[1] 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 3.0 3.0
3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0
[29
No problem with disguise, I'm looking for pretty.
On Wed, 2015-02-04 at 12:06 -0800, Bert Gunter wrote:
> tapply() (of which by() is essentially a wrapper) **is** a (disguised)
> loop (at the R level, of course).
>
> Cheers,
> Bert
>
>
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
> (6
Thanks, I was not aware of order().
I did deliberately mess up the order of S. The following example breaks
your solution
dat_2<-data.frame(S=factor(c('a','c','a','b','c','c')),
D=c(5,3,1,3,2,4))
which should give the answer c(2,2,1,1,2,3)
Your solution does indicate that sortin
tapply() (of which by() is essentially a wrapper) **is** a (disguised)
loop (at the R level, of course).
Cheers,
Bert
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
Clifford Stoll
For the introduction to R I strongly suggest you look at the materials
published by software-carpentry www.software-carpentry.org. The lessons
are all open-source, hosted on github and are under active development.
On Tue, 2015-02-03 at 12:08 +0100, Michael Haenlein wrote:
> Dear all,
>
> I am Pr
Hello,
Aren't the levels of your example wrong? If the levels are
levels=c('a','b','c'), not c('b', 'a', 'c'), then the following will do
the job.
unname(unlist(tapply(dat$D, dat$S, order)))
Hope this helps,
Rui Barradas
Em 04-02-2015 19:34, Tom Wright escreveu:
Given a dataframe:
dat<-d
Given a dataframe:
dat<-data.frame(S=factor(c(rep('a',2),rep('b',1),rep('c',3)),levels=c('b','a','c')),
D=c(5,1,3,2,3,4))
where S is a subject identifier and D a visit (actually a date in my
real dataset). I would like to generate another column giving the visit
number
R=c(2,1,1,1
On 04/02/2015 10:16 AM, michael.laviole...@dhhs.state.nh.us wrote:
I'm preparing some reports for substate regions from BRFSS survey data. I
can get estimates easily enough, but am having problems putting the results
in convenient form. Here's some code using the New Hampshire portion of the
publ
I'm preparing some reports for substate regions from BRFSS survey data. I
can get estimates easily enough, but am having problems putting the results
in convenient form. Here's some code using the New Hampshire portion of the
public BRFSS "SMART" data:
library(foreign)
library(survey)
# download
Hello R-Help folks. I'm fairly new to R and particularly the graphing
functions. The figures I have made look great though and so I want to use it
more.
I am using bargraph.CI and have made several charts successfully using raw
data. I have a figure, however that doesn't lend itself to the fu
Shanley:
I am trying to run STAR logistic/binomial model using R2BayesX . A
warning message came up every time when i included a random effect,
bs='re', (unstructured spatial effect) into the model. The warning
message is : Warning message: running command
'"C:/Users/ChongS/Documents/R/win-li
28 matches
Mail list logo