I wonder if the hcl colour space is useful? Varying hue while keeping chroma
and luminosity constant should give varying colours of perceptually the same
"colourness" and brightness.
?hcl
pie(rep(1,12),col=hcl((1:12)*30,c=70),border=NA)
-Original Message-
From: R-help [mailto:r-help-b
Dear R-helpers,
Does anyone know if the likelihoods calculated by these two packages are
comparable in this way?
That is, is this a valid likelihood ratio test?
# Reproducable example:
library(MASS)
library(nnet)
data(housing)
polr1 = MASS::polr(Sat ~ Infl + Type + Cont, weights=Freq, data=ho
Using return() within a for loop makes no sense: only the first one will be
returned.
How about:
alldf.B = subset(alldf, stream=='B') # etc...
Also, have a look at unique(alldf$stream) or levels(alldf$stream) if you want
to use a for loop on each unique value.
cheers,
Steve
-Original
Note that objects can have more than one class, in which case your == and %in%
might not work as expected.
Better to use inherits().
cheers,
Steve
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Steven Yen
Sent: Wednesday, 24 June 2015 11:37a
To:
Have you tried:
library(effects)
plot(allEffects(ines),ylim=c(460,550))
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Andre Roldao
Sent: Saturday, 2 May 2015 2:50p
To: r-help@r-project.org
Subject: [R] Plotting Confidence Intervals
Hi Guys,
It's the
This works for me...
get0 = function(x) get(x,pos=1)
sapply(big.char, get0)
The extra step seems necessary because without it, get() gets base::cat()
instead of cat.
cheers,
Steve
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Erin Hodgess
Sent:
How about letting a standard function decide which are numbers:
which(!is.na(suppressWarnings(as.numeric(myvector
Also works with numbers in scientific notation and (presumably) different
decimal characters, e.g. comma if that's what the locale uses.
-Original Message-
From: R-help
> today <- as.Date("2015-03-04") # default format
Better is:
today <- Sys.Date()
S
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap
Sent: Thursday, 5 March 2015 7:47a
To: Brian Hamel
Cc: r-help@r-project.org
Subject: Re: [R] Using dates
= `<-` # this is going in my .Rprofile
x := 1
-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
Sent: Tuesday, 3 February 2015 3:54p
To: Steve Taylor; r-h...@stat.math.ethz.ch
Subject: Re: [R] the less-than-minus gotcha
I did not start out liking <-, but I
I disagree. Assignments in my code are all lines that look like this:
variable = expression
They are easy to find and easy to read.
-Original Message-
From: Ista Zahn [mailto:istaz...@gmail.com]
Sent: Tuesday, 3 February 2015 3:36p
To: Steve Taylor
Cc: r-h...@stat.math.ethz.ch
Subject
Responding to several messages in this thread...
> > All the more reason to use = instead of <-
> Definitely not!
Martin and Rolf are right, it's not a reason for that; I wrote that quickly
without thinking it through. An "=" user might be more likely to fall for the
gotcha, if not spacing the
All the more reason to use = instead of <-
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ben Bolker
Sent: Monday, 2 February 2015 2:07p
To: r-h...@stat.math.ethz.ch
Subject: Re: [R] the less-than-minus gotcha
Mike Miller gmail.com> writes:
>
> I've
Dear R-helpers
Has anyone successfully used the Webdings font on a pdf or postscript device?
I'm tearing my hair out trying to figure out how to make it work.
# It works on a png() device:
windowsFonts(Webdings = windowsFont("Webdings"))
png('Webdings.png', family = 'Webdings')
plot(-3:3,-3:3,t
> From: Duncan Murdoch...
> Don't use a bitmap format (png).
I disagree. Each vector format comes with its own problems.
> Don't produce your graph in one format (screen display), then convert to
> another (png). Open the device in the format you want for the final file.
Agreed.
> Use a vect
Unfortunately the win.metafile() device does not support semi-transparent
colours, which I like using.
In my experience, the best way to get R graphics into Word is to use compressed
high-resolution tiff, like this:
word.tif = function(filename="Word_Figure_%03d.tif", zoom=4, width=17,
height=
The function crossprod() might be useful?
crossprod(X) is a more efficient way of producing t(X) %*% X
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Praveen Surendran
Sent: Thursday, 15 August 2013 10:30p
To: r-help@r-project.
How about this:
df1000cols =
setNames(as.data.frame(matrix(numeric(0),ncol=1000)),paste0("V",1:1000))
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Pooya Lalehzari
Sent: Friday, 16 August 2013 8:27a
To: Bert Gunter
Cc: r-help@r
How's this:
big.gap = diff(test) > 1
cbind(test[c(TRUE, big.gap)], test[c(big.gap, TRUE)])
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Lizzy Wilbanks
Sent: Tuesday, 14 May 2013 1:18p
To: r-help@r-project.org
Subject: [R] Bound
Does anyone know if there's an easy facility to create and specify a template
file to be used for new R scripts?
I found myself creating this function which works well (in RStudio on Windows).
newR = function(filename=tempfile(tmpdir='.',fileext='.R'), open=TRUE) {
template = paste(Sys.getenv(
Have a look thru the Time Series task view...
http://cran.r-project.org/web/views/TimeSeries.html
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Janesh Devkota
Sent: Wednesday, 20 February 2013 5:52a
To: r-help@r-project.org
Subj
Have you tried
suppressWarnings(sem(mod, S = as.matrix(dataset), N = 1000, maxiter = 1,
warn = FALSE))
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Dustin Fife
> Sent: Saturday, 19 January 2013 5:32a
> To: r-help
> Su
> On 13-01-20 2:28 PM, Steve Taylor wrote:
> >> From: Duncan Murdoch
> >> Maybe we just need a manual on how to use the existing help system. But
> >> I suspect people who won't read the existing manuals won't read that
> >> one, either.
> >
> From: Duncan Murdoch
> Maybe we just need a manual on how to use the existing help system. But
> I suspect people who won't read the existing manuals won't read that
> one, either.
Duncan, I assume you're being facetious. Every R user soon learns to use
help() and help.search() or their equiv
Here's a link (on my local CRAN)...
http://cran.stat.auckland.ac.nz/doc/manuals/r-release/R-intro.html#The-three-dots-argument
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Bert Gunter
Sent: Friday, 18 January 2013 4:54a
To: iva
The ellipsis object is not listed in the base help pages!
help(`+`) # this works - help on arithmetic operators
help("+") # also works
help(`...`) # fails with Error: '...' used in an incorrect context
help("...") # fails also with No documentation for '...' in specified packages
and libraries: y
Have you tried: options(digits=9)
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Rich Shepard
Sent: Wednesday, 8 August 2012 5:51a
To: r-help@r-project.org
Subject: [R] Setting Number of Displayed Digits
Some chemicals have co
This will work:
model2007 <-
You can't start an identifier with a digit.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of msherwood
Sent: Thursday, 26 July 2012 9:44a
To: r-help@r-project.org
Subject: [R] Package 'nlme' linear mixed
This (and William's solution) is so good, I must ask:
Is there a good reason why this is not the default functionality in the
graphics package?
The default displays the number 1 as 1+e00 which is hideous!
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
him about the survey package.
-Original Message-
From: peter dalgaard [mailto:pda...@gmail.com]
Sent: Friday, 25 May 2012 9:37p
To: ilai
Cc: Steve Taylor; r-help@r-project.org
Subject: Re: [R] glm(weights) and standard errors
Weighting can be confusing: There are three standard forms of
You probably want to use paste or paste0 instead of cat.
paste0(cit,dia,extension)
Also, this might work:
tail(dir("C:/Bonos/",patt="csv$"),1)
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Minerva Mora
Sent: Friday, 25 May 2012
2 3:37p
To: Steve Taylor
Cc: r-help@r-project.org
Subject: Re: [R] glm(weights) and standard errors
On May 21, 2012, at 10:58 PM, Steve Taylor wrote:
> Is there a way to tell glm() that rows in the data represent a certain
> number of observations other than one? Perhaps even fractional
>
/sim.3177
Other suggestions would be most welcome.
___
Steve Taylor
Biostatistician
Pacific Islands Families Study
Faculty of Health and Environmental Sciences
AUT University
__
R-help@r-project.org mailing list
]ti[f]+$", filename,ignore.case=TRUE) filename =
paste(filename,"tif",sep='.')
tiff(filename=filename, res=96*zoom, width=width, height=height, units='cm',
pointsize=pointsize, compression="lzw", ...)
}
Note the zoom, which creates high quality imag
I have found the TIF format (with lossless compression) most suitable for
inclusion in Word documents.
Here's my function for producing a tif plot...
word.tif <- function(filename="Word_Figure.tif", zoom=5, res=96*zoom, width=17,
height=10, pointsize=10, bg='white') {
if (!filename %like% "
suppressWarnings() will get rid of them for you.
Note that in R a factor cannot have duplicate levels. Compare the results with
use.value.labels turned on or off, to see which you prefer.
I also get the "unknown type" warnings, but I ignore them as my data seems to
arrive into R intact.
Hope
"" is a character vector with one element in it.
?nchar
?length
>>>
From: Worik R
To:r-help
Date: 11/Nov/2011 1:21p
Subject: [R] Why does length("") == 1?
It seems obvious to me that the empty string "" is length 0.
cheers
Worik
[[alternative HTML version deleted]]
__
This might help: if x is a vector of the race days then max(diff(sort(x)))
finds the biggest gap between consecutive values.
>>>
From: "Jana.K"
To:
Date: 7/Oct/2011 4:47a
Subject: [R] Urgent help needed for honours project - breaks between races in
one year
Hi to anyone who is willing to he
My solution to the clutter problem is this: at start-up time, create a list of
functions, attach the list and then delete the list. I haven't delved into
making packages yet.
if (any(search()=="MyFunctions")) detach(MyFunctions)
MyFunctions <- list()
MyFunctions$
"%like%" <- function(x,y) { s
You can copy it with the following function and then paste into Excel...
copy = function (df, buffer.kb=256) {
write.table(df, file=paste("clipboard-",buffer.kb,sep=""),
sep="\t", na='', quote=FALSE, row.names=FALSE)
}
>>>
From: maxsilva
To:
Date: 2/Mar/2011 8:50a
Subject: [R] Export
A=matrix(0,nr=3,nc=4)
A[sample(prod(dim(A)),1)]=1
>>>
From: "Barroso, Judit"
To:"r-help@r-project.org"
Date: 10/Nov/2010 11:12a
Subject: [R] Change a value in a matrix randomly
I have a matrix of ceros, for example:
0 0 0 0
0 0 0
Note that R is case sensitive, so cov and Cov are different.
>>>
From: "Barth B. Riley"
To:"r-help@r-project.org"
Date: 12/Oct/2010 3:31a
Subject: [R] Trouble accessing cov function from stats library
Dear all
I am trying to use the cov function in the stats library. I have no problem
using t
You might have to use segments() to place the line segments precisely.
?segments
>>>
From: Henrik Bengtsson
To:Peter Alspach
CC:r-help
Date: 11/Oct/2010 1:23p
Subject: Re: [R] Line Type Specification: lty="" but lty=""?
Thanks both, but unfortunately not.
Here is a better illustration on w
â â â â â â â â
Steve Taylor
Biostatistician
Pacific Islands Families Study
Faculty of Health and Environmental Sciences
Auckland University of Technology
â â â â â â â â â â â â â â â â â
[[alternative HTML version deleted
Would this be suitable?
http://en.wikipedia.org/wiki/File:Rlogo.png
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-projec
Have a look at the Task View for spatial data...
http://cran.ms.unimelb.edu.au/web/views/Spatial.html
>>>
From: "chris howden"
To:,
Date: 13/Jul/2010 2:01p
Subject: [R] do the standard R analysis functions handle spatial "grid" data?
Hi everyone,
I'm doing a resource function analysis with r
How about this:
these = which(vec2 < x1[1] | vec2 > x1[2])
vec2[these]
# Or using logical indexation directly:
vec2[vec2 < x1[1] | vec2 > x1[2]]
>>>
From: Bryan Hanson
To:R Help
Date: 13/Jul/2010 9:28a
Subject: [R] findInterval and data resolution
Hello Wise Ones...
I need a clever way aroun
The original question was about a matrix, not a vector and this is much slower:
x <- sample(10, size=13584763, replace=T)
dim(x) <- c(13584763, 1)
system.time(unique(x))
So the solution would be:
unique(as.vector(x))
>>>
From: Duncan Murdoch
To:G FANG
CC:
Date: 22/Jun/2010 1:20p
Subjec
Ted wrote:
> In the second, 0.08953 rounds (to 2 significant digits) to 0.090,
> which can be printed without further loss of precision as 0.09
> while giving the other numbers 2 significant digits.
I guess I'm disagreeing with the idea of dropping the trailing zero. It should
be retained, since
0.08953 to two significant figures is "0.090" not "0.09".
Thanks, I'll sprintf instead.
From: Duncan Murdoch
To:Steve Taylor
CC:
Date: 29/Apr/2010 9:53a
Subject: Re: [R] unexpected result from format(x, digits)
On 28/04/2010 5:45 PM, Steve Taylor wrote:
>
>
Is this a bug somewhere? The format function, using a specific number of
digits, doesn't give sensible results:
R> set.seed(2);print(x<-rexp(5))
[1] 1.86535 0.40475 0.14665 1.73071 0.08953
R> format(x,digits=1)
[1] "1.87" "0.40" "0.15" "1.73" "0.09"
R> format(x,digits=2)
[1] "1.87" "0.40" "0.
Thanks Ben. Putting that code into my .Rprofile file helped; then it gets
executed whenever R starts up.
>>>
From: Ben Bolker
To:
Date: 20/Apr/2010 10:05a
Subject: Re: [R] Tinn-R
Robert Ruser gmail.com> writes:
> I want to use the free distribution of R (R REvolution 3.2)
[this is a littl
How about this for a more generalised matrix rotation function (works with
1-column and 1-row matrices too) ...
rotate = function(mat) t(mat[nrow(mat):1,,drop=FALSE])
>>>
From:
To:
Date: 19/Mar/2010 10:15a
Subject: Re: [R] can I rotate a matrix
> Now that *is* neat!
Thanks!
Unfortunately, i
You can create a right-mouse menu command to run an R program as follows
(although the details may be different for different versions of Windows).
In Windows Explorer:
1. Tools / Folder Options / File Types
2. find the extension for R files and push Advanced
3. add a new action called "Run" w
Ah, those can be used to index the rows:
# create a new column with TRUE for the first row of each Vin:
ladata2$First <- !duplicated(ladata2$Vin)
# view only those rows:
ladata2[ladata2$First,]
>>>
From: wookie1976
To:
Date: 24/Feb/2010 2:53 p.m.
Subject: Re: [R] First. Last. Data row selec
These tell you the first and last row for each plate:
!duplicated(df$plate)
!duplicated(df$plate, fromLast=TRUE)
Hope that helps.
Steve
>>>
From: wookie1976
To:
Date: 24/Feb/2010 6:54 a.m.
Subject: [R] First. Last. Data row selection
I am in the process of switching from SAS over to R.
Is anyone else using the 'geepack' package?
>>>
From: "Steve Taylor"
To:
Date: 11/Feb/2010 11:28 a.m.
Subject: [R] using step() with package geepack
I'm using the package geepack to fit GEE models.
Does anyone know of methods for add1 and drop1 for a 'gee
Here's another way to have different behaviour only for interactive sessions:
if (interactive()) {
winMenuAdd(menuname, NULL, NULL) # etc.
}
>>>
From: Duncan Murdoch
To:
CC:
Date: 13/Feb/2010 6:15 a.m.
Subject: Re: [R] Selective load of .First() function just for Rgui.exe
On 12/02/2010 11:
I'm using the package geepack to fit GEE models.
Does anyone know of methods for add1 and drop1 for a 'geeglm' model object, or
perhaps a method for extractAIC based on the QIC of Pan 2001? I see there has
been some mention of this on R-help a few years ago (RSiteSearch("QIC")).
The package
Hi all,
I'm producing some pie charts (Yes I know!) and plotting them into a Windows
metafile. This is for insertion into a Word document.
The circles come out rather jagged when you zoom in on them, the cause of which
I have perhaps narrowed down to the way polygon() works in the metafile d
yourdataframe = subset(yourdataframe, !(n2==0 & n3==0 & n4==0 & n5==0))
>>>
From: karena
To:
Date: 14/Jan/2010 12:24 p.m.
Subject: [R] a question about deleting rows
I have a file like this:
idn1n2 n3 n4 n5 n6
1 3 47 8 102
2 4 12 4
Try this:
substr(Data,1,nchar(Data)-1)
Steve
>>>
From: LCOG1
To:
Date: 13/Jan/2010 9:15 a.m.
Subject: [R] Drop last numeral
Hello all,
Frustrated and i know you can help
I need to drop the last numeral of each of my values in my data set. So for
the following i have tried the ?substri
Or copy a rectangle of data in Excel, then grab it from the clipboard in R as
follows:
my.data <- read.table("clipboard",head=TRUE,sep='\t')
cheers,
Steve
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https:
62 matches
Mail list logo