Displaying 20 results from an estimated 40000 matches similar to: "rbind.data.frame drops attributes for factor variables"
2010 Sep 13
0
using survexp and ratetable with coxph object that includes a factor term
Hello,
I'm attempting to use the ratetable argument to
survexp in the survival package. I use
the example from the ?survexp help page below,
and then slightly modify it to produce an error.
library(survival)
data(pbc)
#fit a model without any factors
pfit1 <- coxph(Surv(time, status > 0) ~ trt + log(bili) +
log(protime) + age + platelet, data=pbc)
#this works as expected
2011 Nov 11
1
rbind.data.frame drops attributes for factor variables
Hi all,
When I use rbind() or rbind.data.frame() to add a row to an existing
dataframe, it appears that attributes for the column of type "factor" are
dropped. I see the following post with same problem. However i did not see
any reply to the following posting offering a solution. Could someone
please help.
2011 Nov 12
1
With an example - Re: rbind.data.frame drops attributes for factor variables
When I use rbind() or rbind.data.frame() to add a row to an existing
dataframe, it appears that attributes for the column of type "factor" are
dropped. See the sample example below to reproduce the problem. Please
suggest How I can fix this.
Thanks,
Sammy
a=c("Male", "Male", "Female", "Male")
b=c(1,2,3,4)
c=c("great", "bad",
2007 Nov 08
2
mapply, coxph, and model formula
Hello -
I am wanting to create some Cox PH models with coxph (in package
survival) using different datasets.
The code below illustrates my current approach and problem with
completing this.
### BEGIN R SAMPLE CODE ##############################
library(survival)
#Define a function to make test data
makeTestDF <- function(n) {
times <- sample(1:200, n, replace = TRUE)
event
2007 Nov 09
2
wrapper for coxph with a subset argument
Dear R-help -
Thanks to those who replied yesterday (Christos H. and Thomas L.)
regarding my question on coxph and model formula, the answers worked
perfectly.
My new question involves the following.
I want to run several coxph models (package survival) with the same
dataset, but different subsets of that dataset.
I have found a way to do this, described below in functions subwrap1 and
2011 Jul 04
1
[R-SIG-Finance] FinCenter in timeSeries with "merge", "cbind" and "rbind"
Hi R users:
When I try to merge or bind (cbind or rbind) two series,
both with a "FinCenter" different that GMT, the
result is "GMT" not the original financial center?
What am I doing wrong?
######################################################
require(timeSeries)
getRmetricsOptions("myFinCenter")
setRmetricsOptions(myFinCenter = "America/Bogota")
2012 Jan 13
2
Averaging over data sets
Hi all,
after using Amelia II to create 10 imputed data sets I need to average them
to have one unique data that includes the average for each cell of the
variables imputed, in addition to the values for the variables not imputed.
Such data has many variables (some numeric, other factors), and more than
20000 observations. I do not know how to average them out. Any help?
Below I provide a small
2010 Dec 01
2
Lattice dotplots
Dear,
I have a dataset with 4 subjects (see ID in example), and 4 treatment (see
TRT in example) which are tested on 2 locations and in 3 blocs. By using
Lattice dotplot, I made a graph that shows the raw data per location and
per bloc. In that graph, I would like to have a reference line per bloc
that refers to the first treatment (T1). However, I can not find how to do
that.
I can make
2008 May 16
2
Integer / floating point question
Dear R-help -
I have thought about this question for a bit, and come up with no
satisfactory answer.
Say I have the numeric vector t1, given as
t1 <- c(1.0, 1.5, 2.0, 2.5, 3.0)
I simply want to reliably extract the unique integers from t1, i.e., the
vector c(1, 2, 3). This is of course superficially simple to carry out.
However, my question is related to R FAQ 7.31, "Why
2013 Mar 02
1
Expressions in lattice conditional variables
I would like to have a lattice conditioning ( | var ) variable have
expression() as values because I want panel labels to be able to use
plotmath notation for subscripts, etc. lattice barks at this. Does anyone
know of a trick workaround? An attempted example program is below. Thanks
-Frank
require(lattice)
set.seed(1)
var <- c(rep('A', 100), rep('B', 100))
trt <-
2002 Apr 17
1
rbind() very slow
Hi,
I have 16 tables of 39 variables with around 1500 to 3500 cases in each
table. These 16 tables are in 16 different data frames. I want to merge them
in a single large data frame, so:
All <- rbind(T1, T2, ...)
The problem: it is VERY slow, and takes a lot of memory (> 500 Mb) on my
Athlon XP1800+, 1.75 Go memory, Win 2000 Pro SP1, R 1.4.1. Any suggestion to
improve speed, and/or memory
2010 Apr 28
1
Strange zoo behaviour, possible bug?
Hi all,
I bumped into this awkward zoo behaviour. I'd be half tempted to call it a bug, what do you think? It's annoying to work around it :( I wonder if this was the behaviour of older zoo versions, I can't remember coming across this sort of thing...
> version
_
platform i386-pc-solaris2.10
arch i386
os solaris2.10
system i386,
2019 Feb 18
0
Error in rbind(info, getNamespaceInfo(env, "S3methods"))
On 18/02/2019 4:08 p.m., Matt Dowle wrote:
> Dear all,
>
> I'm experiencing an unusual installation error for one package. Could
> anyone suggest how I can best investigate this from here please? I'm sorry
> this isn't very much to go on. Hopefully someone can point me in the right
> direction.
When packages are installed, a hidden environment is created called
2010 Nov 13
0
using if statment and loops to create data layout of recurrent events
Hi ,
I have a data set with recurrence time (up to four) of myocardial infarction
(MI).
Part of the file is showing below:
Num1 Trt Sex Time T1 T2 T3 T4
1011 1 1 9
1211 0 1 59
3020 1 2 14 3
1245 0 1 18 12 16
3069 1 2 26 6 12 13
2051 0 1 53 3 15 46 51
The data consist of the following eight variables:
Num1 , patient number
Trt, treatment group (1=placebo and 2=drug)
Sex,
2006 Jan 27
1
rbind/cbind unimplemented for raw (RAWSXP) types. (PR#8529)
Full_Name: Hin-Tak Leung
Version: R 2.2.1
OS: x86_64-redhat-linux-gnu
Submission from: (NULL) (131.111.186.92)
rbind/cbind is unimplemented for raw (RAWSXP) types.
I have a working patch implementing the functionality,
to follow.
--please do not edit the information below--
Version:
platform = x86_64-redhat-linux-gnu
arch = x86_64
os = linux-gnu
system = x86_64, linux-gnu
status =
major
2007 Mar 21
1
rbind.data.frame reacts on levels without factor (PR#9578)
Full_Name: Lutz Prechelt
Version: 2.4.1
OS: Windows XP
Submission from: (NULL) (160.45.111.67)
I stack a number of data.frames using rbind.
Each of these dataframes has a column 'authorname', which is a factor
and a column author = unclass(authorname) as piecewise pseudonyms.
When using rbind to stack these dataframes, R warns about invalid factor levels
and inserts all NAs in the author
2008 Jul 25
1
serialize() to via temporary file is heaps faster than doing it directly (on Windows)
Hi,
FYI, I just notice that on Windows (but not Linux) it is orders of
magnitude (below it's 50x) faster to serialize() and object to a
temporary file and then read it back, than to serialize to an object
directly. This has for instance impact on how fast digest::digest()
can provide a checksum.
Example:
x <- 1:1e7;
t1 <- system.time(raw1 <- serialize(x, connection=NULL));
2011 Oct 30
1
Normality tests on groups of rows in a data frame, grouped based on content in other columns
Dear R users,
I have a data frame in the form below, on which I would like to make normality tests on the values in the ExpressionLevel column.
> head(df)
ID Plant Tissue Gene ExpressionLevel
1 1 p1 t1 g1 366.53
2 2 p1 t1 g2 0.57
3 3 p1 t1 g3 11.81
4 4 p1 t2 g1 498.43
5 5 p1 t2 g2 2.14
6 6 p1 t2 g3 7.85
I
2003 Feb 12
2
rbind.data.frame: character comverted to factor
Dear All,
on rbind:ing together a number of data.frames, I found that
character variables are converted into factors. Since this
occurred for a data identifier, it was a little inconvenient
and, to me, unexpected. (The help page explains the
general procedure used. I also found that on forming
a data frame, character variables are converted to factors.
The help page on read.table has the
2019 Feb 18
2
Error in rbind(info, getNamespaceInfo(env, "S3methods"))
Dear all,
I'm experiencing an unusual installation error for one package. Could
anyone suggest how I can best investigate this from here please? I'm sorry
this isn't very much to go on. Hopefully someone can point me in the right
direction.
The problem seems to be my library. It is large (3,418 packages) and I'd
like to avoid rebuilding it, if possible. All packages are up to