lm(height ~ ., data=X)
works fine.
However
nnn - height ; lm(nnn ~ . ,data=X)
fails
How do I write such a formula, which depends on the value of a string variable
like nnn above?
A typical application might be a program that takes a data frame containing
only numerical data, and figures out
I am working with Sweave and would like to print out into my latex document the
result of the R command
version$platform
So what I first tried in my .Rnw document was \Sexpr{print(version$platform)}.
However, the output from this command is the string x86_64-apple-darwin10.8.0
(without the
I tried example('apply'). Among the various examples, there was the following:
apply z - array(1:24, dim = 2:4)
apply zseq - apply(z, 1:2, function(x) seq_len(max(x)))
apply zseq ## a 2 x 3 matrix
[,1] [,2] [,3]
[1,] Integer,19 Integer,21 Integer,23
[2,] Integer,20
(version$platform))}
Best regards,
Thierry
Van: r-help-boun...@r-project.org [r-help-boun...@r-project.org] namens
David Epstein [david.epst...@warwick.ac.uk]
Verzonden: maandag 2 september 2013 17:38
Aan: r-help@r-project.org
Onderwerp: [R] Sweave
I have two data frames, train and response. Here is my attempt to do a
linear regression. All entries of both data frames are numeric. I am
expecting the intercept value to lie between 2 and 3 (in particular,
non-zero).
Here is a record of my interaction with R:
class(response)
[1] data.frame
I tried using various versions of the 'edit' command. Here is an account of
how this failed. I hope I have included all relevant information.
I haven't used R for a couple of years. Before restarting with R, I
downloaded the latest version I could find in its binary version, and
installed it
Hello,
I am using lmer (LME4) to build a model from data for 19 different
neighborhoods drawn, in part, from the American Communities Survey
(ACS). The ACS data is static while other variables change over the
five years under investigation. I am new to mixed effects models and
was hoping that
Hi everyone,
I need to recode multiple columns in a dataframe into a single column in a
variety of different ways. Often the values will be TRUE/FALSE and I want a
list of the columns that are true as in the Result column below:
P1 P2 P3 P4 Result
1 0011P3,P4
2
Jim,
Wow, that does it! I think I can use strsplit and unlist
to convert the string of row names into a R list.
thank you!
-david
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
Hello,
I want to create side-by-side maps of similar attribute data in two
different cities using a single legend.
To simply display side-by-side census block group boundary
(non-thematic) maps for Minneapolis Cleveland I do the following:
library(rgdal)
library(sp)
Hello,
The code below works fine up until I try to use the IN statement in
the last line. The proper SQL format is:
SELECT * FROM this_table WHERE this_column IN (1,2,3,4,5)
But, I think I may be getting something like:
SELECT * FROM this_table WHERE this_column IN c(1,2,3,4,5)
Which makes
thank you! I was able to get it to work with
collapse=,
On Wed, 2011-10-19 at 01:52 -0500, Jeff Newmiller wrote:
paste(SELECT * FROM this_table WHERE this_column IN (,
paste(org_table$id, collapse=TRUE),),sep=)
__
R-help@r-project.org mailing list
Gabor,
thank you. I just got the script working using paste but your solution
looks good as well. I was not familiar with gsubfn. Appears very useful.
-david
With gsubfn if you preface your function with fn$ as shown below then
it turns on a quasi-perl style string interpolation:
A quick question for the gurus...
Given:
a=c(58,73,100,40,70)
b=c(40,70,73,100,58,70,70,58)
How can I replace the elements of b with the corresponding index
numbers from a that start at 1? All values in a are unique. So, I
end up with:
b=c(4,5,2,3,1,5,5,1)
I believe I need to use one of the
thank you! that is straight forward.
On Wed, 2011-10-19 at 22:37 +, William Dunlap wrote:
match(b, a)
[1] 4 5 2 3 1 5 5 1
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
Hi,
I am trying to create a treemap for a non-symmetric tree where some
branches have more sub-branches than others. I have tried tools in two
packages, but have encountered some problems that I hope more
experienced users on this list can help address.
The PORTFOLIO package offers MAP.MARKET,
Here are the error messages:
install.packages('plotrix')
Warning in install.packages(plotrix) :
argument 'lib' is missing: using '/Users/dbae/Library/R/library'
--- Please select a CRAN mirror for use in this session ---
Error in .install.macbinary(pkgs = pkgs, lib = lib, contriburl =
David Epstein wrote:
Here are the error messages:
install.packages('plotrix')
Warning in install.packages(plotrix) :
argument 'lib' is missing: using '/Users/dbae/Library/R/library'
--- Please select a CRAN mirror for use in this session ---
Error in .install.macbinary(pkgs = pkgs
I have a few hundred files of formatted data. Unfortunately most of them end
with a spurious CONTROL-Z. I want to rewrite the files without the spurious
character. Here's what I've come up with so far, but my code is unsafe
because it assumes without justification that the last row of df contains
Murray Cooper wrote:
This may be a case of If all you have is a hammer, everything looks like
a
nail.
If all you want to do is remove the last line if it contains a CONTROL-Z,
why
not use something like perl to process the files?
My first thought was to use perl, and this would have
I'm sure I've read about the difference between a[[i]] and a[i] in R, but I
cannot recall what I read. Even more disturbing is the fact that I don't
know how to search the newsgroup for this. All the different combinations I
tried were declared not to be valid search syntax.
1. What sort of
I use a Mac (10.4.11 Mac Os X).
In my .tcshrc I define an environmental variable MY.
Is it possible to find out its value from inside R? When one loads
R for Mac OS X Cocoa GUI written by:
Simon Urbanek
Stefano M. Iacus
are files like .tcshrc read by R?
Can I make the value of
How do I make a picture that is a horizontal strip? I tried
plot(x=c(1,2,3,4),y=c(1,1,1,1)) #works but screen image is square.
pdf(ratio.pdf,height=1,width=6)
plot(x=c(1,2,3,4),y=c(1,1,1,1))
I got the following error message:
Error in plot.new() : figure margins too large
Is it possible to
Prof Brian Ripley wrote:
How about dev.copy2pdf ?
I put the following into a script:
quartz(...)
#many graphics commands
dev.copy2pdf(pdf,file=ratio1.pdf)
and then sourced the script. I got the error message
Error in pdfFonts(family) :
invalid arguments in 'pdfFonts' (must be font
Is there a good and concise way of making simultaneous plots that are
identical, but directed to different devices?
I'm writing an R-script that produces a pdf file. I would really like to
check visually whether the pdf file shows what I expect. So I would like the
same commands to produce a
I wanted to install the package gdata. Here are the commands I gave and the
responses:
install.packages(gdata)
Warning in install.packages(gdata) :
argument 'lib' is missing: using '/Users/dbae/Library/R/library'
trying URL
Suppose x and y are numeric vectors of the same length.
plot(x,y) #scatterplot
lmObj1 - lm(y~x) # best fit line
abline(lmObj1) # good
lmObj2 - lm(x~y) #get best fit but with axes interchanged
abline(lmObj2) # not what I want. I want the correct line, drawn on the same
graph, but with
hope that at
least that part is correct.
Thanks for any help.
David Epstein
--
View this message in context:
http://www.nabble.com/options%28%22contrasts%22%29-tp19158786p19158786.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help
and hence its aspect ratio is
determined -- see the figures in 'An Introduction to R'.
On Sun, 20 Jul 2008, David Epstein wrote:
#See David Williams' book Weighing the odds, p286
y - c(1.21, 0.51, 0.14, 1.62, -0.8,
0.72, -1.71, 0.84, 0.02, -0.12)
ybar - mean(y)
ylength - length(y)
ybarv - rep
at eqscplot() in package MASS for a different approach.
You last para forgets that once you have set the device region and
the margins the physical plot region and hence its aspect ratio is
determined -- see the figures in 'An Introduction to R'.
On Sun, 20 Jul 2008, David Epstein wrote:
#See David
A really great answer to my concerns! I'll get hold of the Paul
Murrell book, and see how far I can get.
On 21 Jul, 2008, at 10:48, Martin Maechler wrote:
Play around resizing your graphics window..
This is very instructive, with an 'asp = .' using traditional
graphics plot().
OK, but I
for any help
David Epstein
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
is addressable in whatever directory you
are in.
On Sun, Jul 20, 2008 at 7:19 AM, David Epstein
[EMAIL PROTECTED] wrote:
Can anyone help me with the following attempt to use an external
editor from
within R
vi(file=p286.R)
Error in edit(name, file, title, editor) : unable to open file
the segments command first,
but then no segment appeared at all.
In general, is there a method of laying a drawing on top of
another. I tried inserting add=T as an argument to plot, and R
objected strongly.
Thanks for any help
David Epstein
(type=b) might be what was wanted.
y - c(1.21, 0.51, 0.14, 1.62, -0.8,
0.72, -1.71, 0.84, 0.02, -0.12)
ybar - mean(y)
ll - length(y)
ybarv - rep(ybar, ll)
x - 1:ll
plot(x, ybarv, type=n)
segments(x[1], ybar, x[ll], ybar)
points(x, ybarv, pch=21, bg=white)
Uwe Ligges
David Epstein wrote
#See David Williams' book Weighing the odds, p286
y - c(1.21, 0.51, 0.14, 1.62, -0.8,
0.72, -1.71, 0.84, 0.02, -0.12)
ybar - mean(y)
ylength - length(y)
ybarv - rep(ybar, ylength)
x - 1:ylength
plot(x,y,asp=1,xlab=position,ylab=ybar,type=n,ylim=c(-1,1))
segments(x[1], ybar, x[ylength],
36 matches
Mail list logo