Displaying 20 results from an estimated 6000 matches similar to: "(no subject)"
2007 Jul 09
2
parsing strings
Hi All,
I have strings made up of an unknown number of letters, digits, and
spaces. Strings always start with one or two letters, and always end
with one or two digits. A set of letters (one or two letters) is always
followed by a set of digits (one or two digits), possibly with one or
more spaces between the sets of letters and digits. A set of letters
always belongs to the following set of
2007 Jul 05
1
problem assigning to indexed data frame element
Hi All,
Sorry if I ask an obvious thing, I am still new to R ...
I created a data frame of given dimensions to which I gave strings as
column names. I want to write to elements of the data frame by indexing
them with the row number and column name (string). The problem is that I
can read elements from the data frame in this way, but I cannot assign
to elements in this way. Instead, I get the
2007 Jun 27
0
error message survreg.fit
Dear All,
I am doing a parametric survival analysis with:
fit <- survreg(Surv(xyz$start, xyz$stop, xyz$event, type="interval") ~
1, dist='loglogistic')
At this point I do not want to look into covariates, hence the '~1' as
model formulation. As event types I have exact, interval, and right
censored lifetime data. Everything works fine.
For reasons that are
2008 Feb 12
3
Reorder data frame columns by negating list of names
Hello,
I would like to reorder columns in a data frame by their names as
demonstrated below:
Take this data frame:
> xxx <- data.frame(matrix(1:40, ncol=8))
> names(xxx) <- letters[1:8]
> xxx
a b c d e f g h
1 1 6 11 16 21 26 31 36
2 2 7 12 17 22 27 32 37
3 3 8 13 18 23 28 33 38
4 4 9 14 19 24 29 34 39
5 5 10 15 20 25 30 35 40
and reorder the columns like
2013 Feb 26
3
Merging value labels into indicator variable.
I have a vaiable named NAM having value : 1,2,3,4,5,6,7,8,9. I want to
make an indicator variable that will take value 1 if NAM=7 or NAM=8 or
NAM=9. How can I do that?
I usually do: Var001<- ifelse(NAM==7,1,0) for the simplest case.
[[alternative HTML version deleted]]
2016 Aug 05
2
Extra copies of objects in environments when using $ operator?
My understanding is that R will not make copies of lists if there is
only one reference to the object. However, I've encountered a case
where R does make copies, even though (I think) there should be only
one reference to the object. I hope that someone could shed some light
on why this is happening.
I'll start with a simple example. Below, x is a list with one element,
and changing that
2017 Nov 01
2
beta binomial distribution installation
Hello,
I tried to install package ?TailRank? using the command install.packages (RankTail) and library (TailRank) but I got the following errors. So, how can I install TaiRank in Rstudio to have se beta-binomial distribution, CDF and inverse CDG of beta-binomal?
The commands I used are:
> install.packages("TailRank")
Installing package into
2017 Aug 09
2
Fill in empty spaces modified
Hi All?
I was looking at a posting from June-17. I managed to solve it. However,
when I changed the example in the posting, my solution will work only once
at a time which was mentioned by Jim Lemon on his response to the original
posting. This means that my solution will have to be repeated as many times
as the maximum number of spaces on each gap; something that may not work
well for large
2013 Jan 11
4
count combined occurrences of categories
Dear all,
i would like to count the number of times where I have combined occurrences of the categories of 2 variables.
For instance, in the dataframe below, i would like to know how many times each author (au1, au2, au3 represent the first, second, third author) is associated with each of the category of the variable 'nam'. The position of the author does not matter.
nam <-
2009 Jan 30
3
paste together object names to pass it on to a function
Hello,
I have a maybe trivial question, but I simply don't understand well
enought how to work with text/strings:
I have a rather compelx data structure, a big list with several
sub-lists/dataframes and for certain calculations (which I do in
loops), I only need a certain group of sub-lists/dataframes, which I
want to specify with a name vector and paste together the object name
and pass it
2009 Apr 28
8
duplicate 'row.names' are not allowed
Hi everyone,
I have got the following problem:
x1 <- rnorm(10,5,1)
x2 <- runif(10,0,1)
nam1 <- paste("A",1:4,sep=".")
nam2 <- paste("A",6:9,sep=".")
nam <- c(nam1,"A.4",nam2,"A.9")
mydata <- data.frame(x1,x2)
rownames(mydata) <- nam
Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1",
2013 Jul 24
1
Understanding modification in place
Hi all,
Take this simple script, which I'm trying to use to understand when
modification in-place occurs, and when a new object is created:
message("Global")
x <- 1:3
.Internal(inspect(x))
x[2] <- 1L
.Internal(inspect(x))
message("In function")
(function() {
x <- 1:3
.Internal(inspect(x))
x[2] <- 1L
.Internal(inspect(x))
})()
If I run it from the
2019 Jul 17
2
ALTREP wrappers and factors
Hello,
I?m experimenting with ALTREP and was wondering if there is a preferred way to create an ALTREP wrapper vector without using .Internal(wrap_meta(?)), which R CMD check doesn?t like since it uses an .Internal() function.
I was trying to create a factor that used an ALTREP integer, but attempting to set the class and levels attributes always ended up duplicating and materializing the
2004 Nov 29
2
problem with using transace
>I am trying to use the Hmisc function transace to transform predictors
>
> test<-cbind(flowstress,pressres,alloy)
> xtrans<-transace(x,binary=pressres',monotonic='flowstress', categorical='alloy')
>
>
>and I am getting the following message??
>Error in ace(x[, -i], x[, i], monotone = im, categorical = ic) :
> unused argument(s) (monotone ...)
2007 Dec 30
2
refering to variable names in lm where the variable name is in another variable
I am trying to refer to a variable name in a lm regression where the variable name is in another variable, but it does seem to work. Here is an example:
y<-rnorm(10)
dat<-data.frame(x1=rnorm(10),x2=rnorm(10),x3=rnorm(10))
nam<-c('x1','x2','x3')
library(gtools)
com<-combinations(3,2,1:3)
mod<-lm(y~nam[com[1,1]],data=dat)
#error in model frame....:variable
2013 Jan 24
1
Copy on assignment and .Internal(inspect())
Hi,
I would like to know if it's ok to use .Internal(inspect(x)) in order
to detect vector copying.
Take for example the following silly code:
f <- function() {
x = seq(10)
print(.Internal(inspect(x)))
for(i in seq(10)) {
x[i] <- x[i] + 1
print(.Internal(inspect(x)))
}
}
The output of f() was:
@bd7acf0 13 INTSXP g0c4 [NAM(1)] (len=10, tl=0) 1,2,3,4,5,...
[1] 1 2
2019 Jul 23
3
Any plans for ALTREP lists (VECSXP)?
Hello,
I was wondering if there were any plans for ALTREP lists (VECSXP)?
It seems to me that they could be supported in a similar way to how ALTSTRING works, with Elt() and Set_elt() methods, or would there be some problems with that I?m not seeing due to lists not being atomic vectors?
I was taking an approach of converting each list element (of a file-based list data structure) to an ALTREP
2017 Nov 01
3
beta binomial distribution installation
Hi,
I did a quick search for other packages that provide the beta binomial
distribution and found "rmutil".
> install.packages("rmutil")
The package has the CDF (pbetabinom) and inverse CDF (qbetabinom) among
other functions.
HTH,
Eric
On Wed, Nov 1, 2017 at 7:50 AM, MCGUIRE, Rhydwyn <
rmcgu at doh.health.nsw.gov.au> wrote:
> Hi there,
>
> It looks like
2010 Nov 19
1
how to save object created by assign()
Hi there,
When I run the following code, I could get correct objects (with correct
values):
for(i in 1:6) { #-- Create objects 'r.1', 'r.2', ... 'r.6' --
nam <- paste("r",i, sep=".")
assign(nam, 1:i)
# save(nam, file = paste(nam, "RData", sep = "."))
}
I hope to save the object 'r.1',
2017 Nov 01
0
beta binomial distribution installation
Hi there,
It looks like you also need the bioconductor package biobase, I found instructions for downloading that package here: www.bioconductor.org/install
Good luck.
Cheers,
Rhydwyn
-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Amany Abdel-Karim
Sent: Wednesday, 1 November 2017 2:13 PM
To: R-help at stat.math.ethz.ch
Subject: [R] beta