Displaying 20 results from an estimated 4000 matches similar to: "xyplot: Can I identify groups but not use them for regression?"
2010 Mar 05
4
conditioning variable in panel.xyplot?
I wish to create a multipanel plot (map) from several datasets ("d" and
"q" in the example below). I can condition the main xyplot statement on
the "site" variable, but I don't know how to pass a conditioning variable
to panel.xyplot plot so that the x-y coordinates from dataset q are only
plotted at the appropriate site.
library(lattice)
d <-
2009 Dec 29
4
subsetting by groups, with conditions
I have a data set similar to this:
P1id Veg1 Veg2 AreaPoly2 P2ID
1 p p 1 1
1 p p 1.5 2
2 p p 2 3
2 p h 3.5 4
For each group of "Poly1id" records, I wish to output (subset) the record
which has largest "AreaPoly2" value, but only if
2011 Mar 01
2
Does POSIXlt extract date components properly?
I would like to use POSIX classes to store dates and extract components of
dates. Following the example in Spector ("Data Manipulation in R"), I
create a date
> mydate = as. POSIXlt('2005-4-19 7:01:00')
I then successfully extract the day with the command
> mydate$day
[1] 19
But when I try to extract the month
> mydate$mon
[1] 3
it returns the wrong month. And
2010 Mar 15
1
Eliminate border in wireframe plot
How can I eliminate the border drawn by default around a wireframe plot? I've tried using border=NA and box=FALSE to no avail.
Scott Waichler
Pacific Northwest National Laboratory
scott.waichler at pnl.gov
2011 Sep 09
1
Adding groups to regression line panel function in Lattice
I wish to display a single-panel Lattice figure with grouped data and fitted regression lines. I don't seem to be able to get the
individual regression lines to display, e.g.;
d <- data.frame(q = rep(1:6, each=10), cc = rep(seq(10,100, 10),6)) # create data frame with group identifier 'q', independent variable cc
d$ba = d$q*0.1*d$cc + 5*rnorm(nrow(d))
2010 Jun 22
2
Lattice legend
I have a moderately complex graph with three panels. There are data points
plotted, and fitted lines are added using a panel function, which includes
"with(alt.data[[which.packet()[1]]]" statements. It all graphs out
beautifully, but none of the usual tricks to get the proper legend to plot
are working, i.e., using auto.key, key, etc.
One message I keep getting is
Error in
2007 Dec 13
2
Overlaying trellis xyplot on contourplot
Friends: I wish to overlay data points on a contour graph. The following
example produces a nice contour plot, but I have not mastered the concept
of using panel functions to modify plots. Can someone show me how to
overlay the data points (given after contour plot statement) on the
contourplot?
--Seth
model <- function(a,b,c,X1,X2) # provide model
function for contour
2011 May 25
3
Accessing elements of a list
I have a list that is made of lists of varying length. I wish to create a
new vector that contains the last element of each list. So far I have used
sapply to determine the length of each list, but I'm stymied at the part
where I index the list to make a new vector containing only the last item
of each list
mylist =
2010 Sep 21
1
Doing operations by grouping variable
I'm writing an expression that requires searching a vector according to
group. As an example, I want to find the maximum value in each of 5
groups.
group=rep(1:5, each=5) # create grouping variable
variable=rnorm(25) # generate data
d <- data.frame(group,variable) # make data frame
2012 Mar 23
1
Remove wireframe outer box but keep ticks
I would like to eliminate the outer box around a lattice wireframe graph, but the usual recommended solution, which is to assign a color of 'transparent' to the axis.line parameter,
eliminates ticks if the 'arrows=F' command is used, as shown in the following example:
test = data.frame(expand.grid(c(1:10), c(1:10)))
z = test[,1] + test[,2]
test = cbind(test, z)
names(test) =
2007 May 09
1
How to remove outer box from Wireframe plots?
I would like to remove the outermost box from my wireframe plots -- this is
the box that is automatically generated, and is not the inner cube that
frames the data. There was a thread on this 4 yrs ago but none of the fixes
work (e.g., grid.newpage(), grid.lines(gp = gpar(col = NA)) or
par.box=list(col=1),col=NA. These just make the data or the cube disappear.
Has anyone solved this issue?
2008 Dec 03
1
how do I eliminate excess levels in lattice contourplot key / legend?
I'm working on a contourplot( ) graph, the subject of several previous
posts to this list. The contours express probabilities from 0 - 1, but the
key that is automatically generated by contourplot pads the probability
scale with values that are impossible (i.e, range goes from -0.2 to 1.2),
which will be confusing to those who view the plot. How can I get the
scale to just run from 0 - 1?
2003 May 13
1
several regression lines in panel of xyplot (trellis graphics)
Dear r-help,
I need to draw xyplot() graphs with several regression lines:
one line for the whole range of x (the variable on the horizontal
axis) and two additional lines for subranges of x.
Is it possible to make first regression line (panel.lmline(x,y,...);)
to be drawn on the whole graph
and regression lines of the subsets to be drawn only over their subsets?
I have defined
2018 Jan 02
1
httr::content without message
Thanks to all that replied. I had just looked through the httr code and sure enough for a .csv mime time it calls readr::read_csv(). The httr::content docs suggest not using automatic parsing in a package, rather to determine mime type and parse yourself and Ben's suggestion also works if I do:
junk <- readr::read_csv(r1$content, col_types = cols())
Perfect. Using httr rather than
2018 Jan 02
4
httr::content without message
Hi All:
I am using httr to download files form a service, in this case a .csv file. When I use httr::content on the result, I get a message. Since this will be in a package. I want to suppress the message, but haven't figured out how to do so.
The following should reproduce the result:
myURL <-
2009 Sep 28
1
xyplot & lmline: error message.
Hi, I am trying to produce an xyplot with a regression line. The data should
be represented as log/log but when I fit the lmline I receive an error
message - the plot is fine without the log transformation, but the then the
plot is meaningless. I know it must be something simple, but I just can't
see it. Hope someone can help...
Thanks.
xyplot(log(Pk)~log(k),data=rwpk,cex=1,
2018 Jan 02
0
httr::content without message
Ahoy!
That's a message generated by the readr::read_table() function (or it's friends). You can suppress it a number of ways, but this should work as httr::content() will pass through arguments, like col_types = cols(), to the file reader.
junk <- httr::content(r1, col_types = cols())
See more here...
https://blog.rstudio.com/2016/08/05/readr-1-0-0/
2005 Feb 10
1
xyplot() question
Dear R Users,
I have an xyplot() where different plotting symbols are used for
subgroups (originally used within S-Plus, but hopefully it?s also
applicable to R users).
How can I fit separate regression lines for every subgroup? So far, I
can only plot the overall fitted line.
The code looks like this:
trellis.device()
sps<-trellis.par.get("superpose.symbol")
sps$pch<-1:7
2002 Mar 05
2
identify in lattice
Does identify work in lattice plots? I tried this in R 1.4.1 (original
release) on my Win2000 machine with lattice 0.4-0 and grid 0.5-1.
> xyplot(y ~ x,
+ panel=function(x, y, ...){
+ panel.xyplot(x, y, col=2, pch=20, ...)
+ panel.lmline(x, y, type = "l")
+ identify(x, y)
+ })
I get a change of cursor after the data points and the LS line are plotted
2010 Feb 08
3
What is the equivalent function in R to xyplot in S?
Page 140 of MASS uses the function xyplot. But I don't find it in R.
Is there a package that I should load to use xyplot. Or there is a
function with a different name in R that does the same thing as xyplot
in S.
xyplot(Gas ~ Temp | Insul, whiteside, panel =
function(x, y, ...) {
panel.xyplot(x, y, ...)
panel.lmline(x, y, ...)
}, xlab = "Average external temperature (deg. C)",
ylab