Displaying 20 results from an estimated 100 matches similar to: "calculate multiple means of one vector"
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
>
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
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 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
##
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
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 ,
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 Jun 21
2
Overlaying lattice graphs (continued)
Dear R Users,
I recently posted an email on this list about the use of data.frame and
overlaying multiple plots. Deepayan kindly indicated to me the
panel.superposition command which worked perfectly in the context of the
example I gave.
I'd like to go a little bit further on this topic using a more complex
dataset structure (actually the one I want to work on).
>mydata
Plot
2008 Feb 21
1
Save a group of matrix
Hello, I'm creating a loop to work with vegan, to get a species abundance curve. Here I send the script I've created and also an excel file to prove what it can do.
Well, I have a database with 20 years, and each year we have sampled 19 stratum, and in each estratum we have carry out some sumpling. Then, with the script that I've sent I've got to calculate the species abundance
2007 Aug 30
2
customizing the color and point shape for each line drawn using lattice's xyplot
Description of what I am trying to do:
I am using the xyplot code below to plot the variable ?MeanBxg? against the
variable ?PercentVarExplained? for all 9 possible combinations of variables
?bdg? and ?bdx?. Within each of these 9 scenarios I am plotting a separate
line for each of up to 9 different methods that I used to estimate the
variable MeanBxg. These methods are identified by the numeric
2017 Jan 10
7
[Bug 99354] New: [G71] "Assertion `bkref' failed" reproducible with glmark2
https://bugs.freedesktop.org/show_bug.cgi?id=99354
Bug ID: 99354
Summary: [G71] "Assertion `bkref' failed" reproducible with
glmark2
Product: Mesa
Version: 13.0
Hardware: x86 (IA32)
OS: Linux (All)
Status: NEW
Severity: normal
Priority: medium
2008 Mar 03
2
handling big data set in R
Hello R users,
I'm wondering whether it is possible to manage big data set in R? I
have a data set with 3 million rows and 3 columns (X,Y,Z), where X is
the group id. For each X, I need to run 2 regression on the submatrix.
I used the function "split":
datamatrix<-read.csv("datas.csv", header=F, sep=",")
dim(datamatrix)
# [1] 2980523 3
2012 Nov 10
4
help on date dataset
Hi everybody,
I am beginer in R and I need your precious help.
I want to create a small function in R as in sas to retrieve date.
I have a file with data that import in R.
DATE PAYS nb_pays.ILI.
1 24/04/2009 usa 0
2 24/04/2009 usa 0
3 24/04/2009 Mexique 0
4 24/04/2009
2020 Oct 23
1
Extracting data and saving in excel
Hi all,
I have a dataframe call "data", and have lots of rows. One of them
is data$`birth`
my data has been imported from an excel file in RSTUDIO
I want to obtain in a function all rows (with the names) where
data$`birth` is bigger than 1979/01/01 and extract in a excel file as an
output (a sub-excel of the original).
Can you guide with the functions I need to use?
I have been many
2009 Oct 11
1
How do you test if a number is in a list of numbers?
Hi,
I want to subset a data frame if one of the variables matches any in a list.
I could of course do something like this:
subset(dataset, var == 1 | var == 2 | var ==3)
but that's tedious.
I tried
varlist = c(1,2,3,4)
subset(dataset, any(var == varlist))
but it doesn't work because 'any' doesn't go row-by-row and hence always
returns TRUE.
Is there any simple way to do this?
2009 Nov 14
1
re move row if the column "date_abandoned" has a date in it
I want to go through a column in data called
date_abandoned....data["date_abandoned"]....and remove all the rows that
have numbers greater than 1,010,000.
The dates are in the format 20091114 so i'm just going to treat them as
numbers for clean up purposes.
I know that i use subset but not sure how to proceed from there.
--
View this message in context:
2011 Jun 07
1
extract data features from subsets
I have a large dataset similar to this:
ID time result
A 1 5
A 2 2
A 3 1
A 4 1
A 5 1
A 6 2
A 7 3
A 8 4
B 1 3
B 2 2
B 3 4
B 4 6
B 5 8
I need to extract a number of features for each individual in it (identified by "ID"). These are:
* The lowest result (the nadir)
* The time of the nadir - but if the nadir level is present at >1 time point, I need the minimum and maximum time of nadir
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