Displaying 20 results from an estimated 10000 matches similar to: "Overlaying lattice graphs (continued)"
2007 Aug 01
1
Problem to remove loops in a routine
Dear R-users,
I have written the following code to generate some trellis plots. It
works perfectly fine except that it is quite slow when it is apply to my
typical datasets (over several thousands of lines). I believe the
problem comes from the loops I am using to subset my data.frame. I read
in the archives that the tapply function is often more efficient than a
loop in R. Unfortunately ,
2007 Jun 24
2
matlab/gauss code in R
Hi all!
I would like to import a matlab or gauss code to R.
Could you help me?
Bye,
Sebasti?n.
2007/6/23, r-help-request en stat.math.ethz.ch <r-help-request en stat.math.ethz.ch>:
> Send R-help mailing list submissions to
> r-help en stat.math.ethz.ch
>
> To subscribe or unsubscribe via the World Wide Web, visit
>
2007 Jun 11
2
Overlaying lattice graphs
Hello
I apologize in advance if this question has already be posted on the
list, although I could not find a relevant thread in the archives.
I would like to overlay xyplots using different datasets for each plot.
I typically work on the following data.frame (mydata) structure
>mydata
Drug Time Observed Predicted
1 A 0.05 10
2007 Oct 01
3
mean of subset of rows
Dear list,
this must be an easy one:
I have a data.frame of two columns, "ID" with four different levels (A
to D) and numerical "size", and each of the 4 different IDs is
repeated a
different number of times. I would like to get the mean size for each
ID as another data.frame. I have tried the following:
>ID= as.character(unique(data[,1])) # I use unique() because
2012 Sep 24
0
stop on rows where !is.na(mydata$ti_all)
Dear R experts,
I got help to build a loop but there is a bug inside it that causes
one part of the mechanism to fail.
It should grow once, but if keep growing on rows where $ti_all is not NA.
Here is a wall of code that very crudely demonstrates the problem,
there is a couple of dim() outputs at the end where you can see how it
the second time around keeps adds (2) rows, but this does not
2024 May 15
2
Extracting values from Surv function in survival package
OS X
R 4.3.3
Colleagues
I have created objects using the Surv function in the survival package:
> FIT.1
Call: survfit(formula = FORMULA1)
n events median 0.95LCL 0.95UCL
SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0 18 13 345 156 NA
SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1 13 5 NA 186 NA
SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2 5
2024 May 16
1
Extracting values from Surv function in survival package
Hi Dennis,
look at the help page for summary.survfit, the Value n.event.
G?ran
On 2024-05-15 22:41, Dennis Fisher wrote:
> OS X
> R 4.3.3
>
> Colleagues
>
> I have created objects using the Surv function in the survival package:
>> FIT.1
> Call: survfit(formula = FORMULA1)
>
> n events median 0.95LCL 0.95UCL
>
2011 Mar 19
1
lattice histogram function and groups
Hi,
>From the following code (tweaked from another user):
variable<-sample(rep(1:2,100))
individual<-rep(1:3, length(variable))
group<-rep(LETTERS[1:2],length(variable)/2)
mydata<-data.frame(variable,individual,group)
individual<-as.factor(individual)
group<-as.factor(group)
histogram(~variable|individual+group)
I get six panels, one for each of individuals
2009 Sep 14
3
Eliminate cases in a subset of a dataframe
Hi folks,
I created a subset of a dataframe (i.e., selected only men):
subdata <- subset(data,data$gender==1)
After a residual diagnostic of a regression analysis, I detected three
outliers:
linmod <- lm(y ~ x, data=subdata)
plot(linmod)
Say, the cases 11,22, and 33 were outliers.
Here comes the problem: When I want to exclude these three cases in a
further regression analysis,
- for
2011 Aug 17
3
How to apply a function to subsets of a data frame *and* obtain a data frame again?
Dear all,
First, let's create some data to play around:
set.seed(1)
(df <- data.frame(Group=rep(c("Group1","Group2","Group3"), each=10),
Value=c(rexp(10, 1), rexp(10, 4), rexp(10, 10)))[sample(1:30,30),])
## Now we need the empirical distribution function:
edf <- function(x) ecdf(x)(x) # empirical distribution function evaluated at x
##
2003 Mar 25
2
Help with data.frame subsets
Hello all,
I'm trying to get a subset of a data frame by taking all rows where the 2nd
column is >= Min and <= Max. I can do that by a 2 step process similar to
the following:
subData <- dataFrame[dataFrame[,2] >= Min,]
subData2 <- subData[subData[,2] <= Max,]
Then I try to graph the results where col 2 is the X var and col 3 is the Y
var. Therefore I do the following:
X
2011 Oct 31
1
googleVis motionchart - slow with Date class
Hi,
I am trying to create a googleVis motion chart with monthly data. When formatting the date column as a Date class variable, the plot as presented in the browser becomes considerably slower and very prone to crashing the browser. To illustrate this issue I have modified the WorldBank demo.
### objects from demo("WorldBank", package = "googleVis")
M <-
2008 Jun 19
2
Advanced Filtering problem
http://www.nabble.com/file/p18018170/subdata.csv subdata.csv
I've attached 100 rows of a data frame I am working with.
I have one factor, id, with 27 levels. There are two columns of reference
data, x and y (UTM coordinates), one column "date" in POSIXct format, and
one column "diff" in times format (chron package).
What I am trying to do is as follows:
For each day
2007 Aug 06
3
Error in using nlevels in apply function
Dear R users,
I am currently trying to create my first personnal function and use it
with the apply function. The purpose of this function is to create a
vector summarizing the number of levels in a given selection of
data.frame columns.
I tried to transpose the indexation method used by the nlevels function
but it doesn't seem to work. I did not find anything uesful in the
archives so
2009 Nov 08
2
Counting non-empty levels of a factor
Hi everyone,
I'm struggling with a little problem for a while, and I'm wondering if
anyone could help...
I have a dataset (from retailing industry) that indicates which brands
are present in a panel of 500 stores,
store , brand
1 , B1
1 , B2
1 , B3
2 , B1
2 , B3
3 , B2
3 , B3
3 , B4
I would like to know how many brands are present in each store,
I tried:
result <-
2006 Apr 29
1
splitting and saving a large dataframe
Hi,
I searched for this in the mailing list, but found no results.
I have a large dataframe ( dim(mydata)= 1297059 16, object.size(mydata=
145280576) ) , and I want to perform some calculations which can be done by
a factor's levels, say, mydata$myfactor. So what I want is to split this
dataframe into nlevels(mydata$myfactor) = 80 levels. But I must do this
efficiently, that is, I
2008 Apr 28
1
error in summary.Design
Dear list,
after fitting an lrm with the Design package (stored as "mymodel") I
try running a summary, but I get the following error:
dim(mydata)
[1] 235 9
names(mydata)
[1] "id" "VAR1" "VAR2" "VAR3" "VAR4" "VAR5" "VAR6" "VAR7" "VAR8"
summary(mymodel)
Error in `contrasts<-`(`*tmp*`,
2007 Nov 12
4
time plotting problem
I am completely misunderstanding how to handle dates.
I want to plot a couple of data series against some
dates. Simple example 1 below works fine.
Unfortunately I have multiple observations per day (no
time breakdowns) and observations across years.
(example 2 very simplistic version )
Can anyone suggest a quick fix or point me to
something to read? I thought that zoo might do it but
I seem
2006 Dec 14
2
xyplot: discrete points + continuous curve per panel
I have a number of x, y observations (Time, Conc) for a number of Subjects
(with subject number Subj) and Doses. I can plot the individual points with
xyplot fine:
xyplot(Conc ~ Time | Subj,
Groups=Dose,
data=myData,
panel = function(x,y) {
panel.xyplot(x, y)
panel.superpose(???) # Needs more here
}
)
I also like to plot on
2006 Apr 26
1
help using tapply
Dear R-mates,
# Here's what I am trying to do. I have a dataset like this:
id = c(rep(1,8), rep(2,8))
dur1 <- c( 17,18,19,18,24,19,24,24 )
est1 <- c( rep(1,5), rep(2,3) )
dur2 <- c(1,1,3,4,8,12,13,14)
est2 <- rep(1,8)
mydata = data.frame(id,
estat=c(est1, est2),
durat=c(dur1, dur2))
# I want to one have this:
id = c(rep(1,8), rep(2,8))