The meaning of parent.frame depends on where it is evaluated. So one
should not expect it to do the same thing in two equivalent expressions
(and nor should one expect deparse to do so, for example).
A pretty close analogy is that using a symbolic link in a file system is
equivalent to using
Hello,
The following script allows for Weibull plots using R.
Its output is similar to the output of the wblplot function (or weibplot
function) in MATLAB.
As opposed to the previously mentioned function it does not require proprietary
software. Instead, it is based on R.
My code also
Arun Kumar Saha wrote:
Dear all R users,
I got a strange problem while working with SPSS data :
I wrote following :
library(foreign)
data.original = as.data.frame(read.spss(file=c:/Program Files/SPSS/Employee
data.sav))
data = as.data.frame(cbind(data.original$MINORITY,
Hi all, I have a simple data frame, first list is a list of dates (in
%Y-%m-%d format) and second list an observation on that particular
date. There might not be observations everyday. Let's just say
there are no observations on saturdays and sundays. Now I want to
select the first
Here is one way of doing it:
x - DateObservation
+ 2007-05-23 20
+ 2007-05-22 30
+ 2007-05-21 10
+ 2007-04-10 50
+ 2007-04-09 40
+ 2007-04-07 30
+ 2007-03-05 10
x -
Use the zoo package to represent data like this.
Here time(z) is a vector of the dates and as.yearmon(time(z))
is the year/month of each date. With FUN=head1, ave picks out the first
date in any month and aggregate then aggregates over all
values in the same year/month choosing the first one.
I have only just able to dissect Jim's solution and realize I am
actually not very far away from the answer. One last step was to use
lapply. Jim, thanks again for the help.
Gabor, thanks for the suggestion. Let me have a read on what the zoo
package is about. Thanks a lot for the
One additional simplification. If we use simplify = FALSE then
tapply won't simplify its answer to numeric and we can
avoid using as.Date in the last solution:
window(z, tapply(time(z), as.yearmon(time(z)), head, 1, simplify = FALSE))
On 5/27/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
Here is one additional solution, also using zoo. Using z from
the prior solution as.yearmon(time(z)) is, as before, the year/month
of each date and tapply(time(z), as.yearmon(time(z)), head, 1)
gets the first date within each month; however, tapply converts it
to numeric so we use as.Date to
Dear all,
After going through the Lattice doc and R-help list and google, I got
the feeling that there is no function in lattice or other package to
compute a pie chart object of class trellis. Although pie charts are
obviously not considered optimal even in the pie() doc ;-) , pie chart
Check the documentation link from
http://cm.bell-labs.com/cm/ms/departments/sia/project/trellis/software.writing.html
Adrian
On 5/26/07, Tyler Smith [EMAIL PROTECTED] wrote:
Hi,
I've just produced my first lattice plot - the graphic is very
impressive, but I only partly understand how it
I wonder why the following code does not produce filled points in the
key, as I would have expected:
library(lattice)
x - 1:10
y - rnorm(10)
xyplot(y ~ x, pch = 21, col = black, fill = grey,
+key = list(space = top,
+ text = list(data),
+ points =
Would anybody kindly provide me with examples of code using the
argument legend in lattice plots (package lattice), in particular for
use inside the plot region ?
Thanks in advance,
Renaud
--
Renaud LANCELOT
Département Systèmes Biologiques du CIRAD
CIRAD, Biological Systems Department
Campus
Hello everybody,
I'm using the kernlab package, but I'm yet to find how to map existing
variables onto a kha representation.
here is an example:
names(dttest)
[1] rapCADuree CA DifferenceCommande
kha(~.,data=dttest[1:1000,],features=4,na.action=na.exclude)-khatest
Hi,
I have a object 'zoo':
dim(zz)
[1] 720 5551
where some columns only have NA's values (representing land data in a
sea surface temperature dataset) I find straightforward the use of
'na.approx' for individual columns from the zz matrix, but when applied
to the whole matrix:
na.approx uses approx and has the same behavior as it. Try this:
library(zoo)
# test data
z - zoo(matrix(1:24, 6))
z[,2:3] - NA
z[1, 2] - 3
z[2, 1] - NA
z
1 1 3 NA 19
2 NA NA NA 20
3 3 NA NA 21
4 4 NA NA 22
5 5 NA NA 23
6 6 NA NA 24
# TRUE for each column that has more than 1
Dear userRs,
Is there a way to explicitly set an argument to a function call as
missing?
E.g.,
histogram(foo,
bar,
endpoints=ifelse(!missing(limits),limits,NA/NULL/whatever)))
In this call I want to set a value to the endpoints argument only if the
`limits' variable has
Dear R-users,
I have a data.frame having NA (e.g., 2nd, 4th rows, etc).
Start End Length Variable_name
[1,] 1 1 1a
[2,] NANANA
[3,] 2 2 1b
[4,] NANANA
[5,] 3 6 4c
[6,] 7 10 4d
:
:
:
I like to remove the rows having NA in the first
R users
I found a solution for myself
if the data.frame name is x
x[!(is.na(x[,1])),]
I tend to rely on a looping thing, which is a bad habit.
Thanks
_
PC Magazines 2007 editors choice for best Web mailaward-winning Windows
First define a function which is like list() except it ignores all
NULL components. Using that we can write:
list.wo.null - function(...) list(...)[!sapply(list(...), is.null)]
library(lattice)
myhist - function(limits) do.call(histogram, list.wo.null(~ height, singer,
endpoints = if
On 2007-05-27, Adrian Dragulescu [EMAIL PROTECTED] wrote:
Check the documentation link from
http://cm.bell-labs.com/cm/ms/departments/sia/project/trellis/software.writing.html
Thanks Adrian, that looks great!
Tyler
__
R-help@stat.math.ethz.ch
I would also suggest Paul Murrell's book R Graphics.
http://www.amazon.com/Graphics-Computer-Science-Data-Analysis/dp/158488486X/
--sundar
Tyler Smith said the following on 5/27/2007 1:27 PM:
On 2007-05-27, Adrian Dragulescu [EMAIL PROTECTED] wrote:
Check the documentation link from
As I was working through elementary examples, I was using dataset
plasma of package HSAUR.
In performing a logistic regression of the data, and making the
diagnostic plots (R-2.5.0)
data(plasma,package='HSAUR')
plasma_1- glm(ESR ~ fibrinogen * globulin, data=plasma, family=binomial())
On 5/26/07, Zack Weinberg [EMAIL PROTECTED] wrote:
I find myself wanting to plot three graphs side by side 'as if' they
were panels -- that is, with the same y-axis limits, no space between
the graphs, and precise vertical alignment of the plot areas. However,
I don't want strip titles; I want
Dear R-users,
I want to perform a One-Sample parametric bootstrapped Kolmogorov-Smirnov
GoF test (note package Matching provides ks.boot which is a 2-sample
non-parametric bootstrapped K-S version).
So I wrote this code:
---[R Code] ---
ks.test.bootnp - function( x, dist, ...,
On 5/27/07, Adrian Dragulescu [EMAIL PROTECTED] wrote:
Check the documentation link from
http://cm.bell-labs.com/cm/ms/departments/sia/project/trellis/software.writing.html
Also, read the overview page
package?lattice
-Deepayan
__
On 5/27/07, Renaud Lancelot [EMAIL PROTECTED] wrote:
I wonder why the following code does not produce filled points in the
key, as I would have expected:
library(lattice)
x - 1:10
y - rnorm(10)
xyplot(y ~ x, pch = 21, col = black, fill = grey,
+key = list(space = top,
+
In that the meaning of parent.frame depends on where it is
evaluated, is there a nice way to figure out which frame an express
is evaluated? for example, I would like to konw what does
parent.frame(2) refer to.
f1 - function(x,digits=5) lapply(x, f2)
f2 - function(x)
Hi,Gabor Grothendieck, Thanks very much.
On 5/27/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
evalq looks like this:
evalq
function (expr, envir, enclos)
eval.parent(substitute(eval(quote(expr), envir, enclos)))
environment: namespace:base
so it seems the difference is
On 5/27/07, Robert A. LaBudde [EMAIL PROTECTED] wrote:
As I was working through elementary examples, I was using dataset
plasma of package HSAUR.
In performing a logistic regression of the data, and making the
diagnostic plots (R-2.5.0)
data(plasma,package='HSAUR')
plasma_1- glm(ESR ~
Hi everybody,
When I followed a practice example, I got an error as follows:
###
cc-read.table('example5_2.dat',header=TRUE)
cc
EXAM1 EXAM2 EXAM3 EXAM4 EXAM5
145342335
R-users
I need to create a txt file as input for another program using data.frame
values
Variable_name Start End
[1,] a 1 1
[2,] bbb 2 2
[3,] c 3 6
[4,] ddd 7 10
[5,] eee 11
On 5/27/07, ronggui [EMAIL PROTECTED] wrote:
Hi,Gabor Grothendieck, Thanks very much.
On 5/27/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
evalq looks like this:
evalq
function (expr, envir, enclos)
eval.parent(substitute(eval(quote(expr), envir, enclos)))
Thanks, Gabor.
I have to say I wouldn't have figured this out easily.
I'd summarize your comments by:
1. Remember to use arrays of logicals as indices.
2. Remember %in% for combination matches.
3. Remember which() to get indices.
It is the small tasks which appear most difficult to figure out
Another sample problem: In the Windows version of R-2.5.0,
data(GHQ,package='HSAUR')
layout(1)
GHQ_glm_1- glm(cbind(cases,non.cases) ~ GHQ, data=GHQ, family=binomial())
summary(GHQ_glm_1)
yfit_glm_1- predict(GHQ_glm_1, type='response')
layout(1)
plot(probs ~
That's great. I got it. Million thanks.
On 5/28/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
On 5/27/07, ronggui [EMAIL PROTECTED] wrote:
Hi,Gabor Grothendieck, Thanks very much.
On 5/27/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
evalq looks like this:
evalq
How about 'traceback'? (It does not necesssarily show all the frames, but
it does help and the exceptions are fairly esoteric.)
On Mon, 28 May 2007, ronggui wrote:
In that the meaning of parent.frame depends on where it is
evaluated, is there a nice way to figure out which frame an express
37 matches
Mail list logo