Displaying 20 results from an estimated 10000 matches similar to: "(no subject)"
2005 Nov 21
4
Can't figure out warning message
Hi,
I apologize for the previous posting, where the message was not formatted
properly. Here is a better version:
I have written the following function to check whether a vector has elements
satisfying monotonicity.
is.monotone <- function(vec, increase=T){
ans <- TRUE
vec.nomis <- vec[!is.na(vec)]
if (increase & any(diff(vec.nomis,1) < 0, na.rm=T)) ans <- FALSE
2019 Nov 01
3
R C api for 'inherits' S3 and S4 objects
Dear R developers,
Motivated by discussion about checking inheritance of S3 and S4
objects (in head matrix/array topic) I would light to shed some light
on a minor gap about that matter in R C API.
Currently we are able to check inheritance for S3 class objects from C
in a robust way (no allocation, thread safe). This is unfortunately
not possible for S4 classes. I would kindly request new
2012 Mar 19
2
by output into data frame
I could do this in various hacky ways, but what's the right way?
I have a nice application of the by function, which does what I want. The output looks like this:
> auc_stress
lab.samples.stress$subid: 2
cortisol amylase
1 919.05 6834.8
---------------------------------------------------------------------------------------------------------------------------
2007 Feb 12
2
help with tryCatch
Could smb please help with try-catch encapsulating a function for
downloading. Let's say I have a character vector of symbols and want to
download each one and surround by try and catch to be safe
# get.hist.quote() is in library(tseries), but the question does not
depend on it, I could be sourcing local files instead
ans=null;error=null;
for ( sym in sym.vec){
2012 May 16
2
trouble with ifelse statement
Hello,
I apologize in advance for not providing sample data, I'm a very new to R
and can't easily generate appropriate sample data quickly. I'm hoping
someone can offer advice without it.
This code below works and does what I want it to do, which is for a given
row in my dataframe, where the variable "peak.cort" = max, it makes the
value of another variable
2019 Nov 01
4
[External] R C api for 'inherits' S3 and S4 objects
Thank you Luke.
That is why I don't use Rf_inherits but INHERITS which does not
allocate, provided in the email body.
I cannot do similarly for S4 classes, thus asking for some API for that.
On Fri, Nov 1, 2019 at 5:56 PM Tierney, Luke <luke-tierney at uiowa.edu> wrote:
>
> On Fri, 1 Nov 2019, Jan Gorecki wrote:
>
> > Dear R developers,
> >
> > Motivated by
2013 Mar 08
2
Unexpected behaviour of apply()
Hello everyone,
Considering the following code sample :
----
indexes <- function(vec) {
vec <- which(vec==TRUE)
return(vec)
}
mat <- matrix(FALSE, nrow=10, ncol=10)
mat[1,3] <- mat[3,1] <- TRUE
----
Issuing apply(mat, 1, indexes) returns a 10-cell list, as expected.
Now if I do:
----
mat[1,3] <- mat[3,1] <- FALSE
apply(mat, 1, indexes)
----
I would expect a
2023 Jan 30
2
question
Hi guys,
I am using the cor() function to see if there are correlations between March cortisol levels and December cortisol levels and I'm trying to figure out if the function is doing what I want it to do.
Each sample has it's own separate row in the CSV file that I'm working out of. March Cort and December Cort are different columns and they come from separate samples, therefore
2012 Apr 23
2
plot function creating bars instead of lines
Hello,
I am having a problem where code that plots lines using a different data
frame plots bars with the current data frame (I am intended to plot lines).
The code specifies lines (see below), so I can't figure out why the results
are bars. I suspect that it may have something to do with the fact that in
the data frame where the code worked as intended, the both variables
specifying
2004 Jun 30
1
Developing functions
Without trying to understand your code in detail let me just
assume you are trying to create a matrix, ret, whose i,j-th
entry is some function, f, of row i of X and row j of X.
In that case this should do it:
apply(X,1,function(x)apply(X,1,function(y)f(x,y)))
Date: Wed, 30 Jun 2004 15:28:47 -0300 (ART)
From: <daniel at sintesys.com.ar>
To: <r-help at stat.math.ethz.ch>
2005 Jan 06
2
patterns of missing data: determining monotonicity
Here is a problem that perhaps someone out here has an idea about. It
vaguely reminds me of something
I've seen before, but can't place. Can anyone help?
For multiple imputation, there are simpler methods available if the
patterns of missing data are 'monotone' ---
if Vj is missing then all variables Vk, k>j are also missing, vs. more
complex methods required when the
2004 Jul 12
3
Smooth monotone estimation on R
Hi all,
I'm looking for smooth monotone estimation packages, preferably using splines.
I downloaded the 'cobs' package and intend to use it, but since it offers only quadratic splines based on L1 minimization, I'd like to compare its performance to that of a more 'mainstream' cubic-spline, L2-norm minimizing spline. Preferably a smoothing spline.
Does anyone know of such
2001 Mar 12
2
Regressions with monotonicity constraints
This seems to be a recurrent topic, but I don't remember hearing a
definitive answer. I also apologies for cross-posting.
Say I have a numerical response variable and a bunch of multi-level factors
I want to use for modeling. I don't expect factor interaction to be
important so there will be no interactions in the model.
All this would be a perfect job for ANOVA except for one additional
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 ...)
2017 Aug 17
4
unable to emit vectorized code in LLVM IR
i removed printf from loop. Now getting no error. but the IR doesnot
contain vectorized code. IR Output is as follows:
; ModuleID = 'sum-vec.ll'
source_filename = "sum-vec.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: norecurse nounwind readnone uwtable
define i32 @main(i32, i8**
2004 Aug 05
8
or of a logical vector
Is there some fast (built-in?) way to get the OR of all the elements in a
logical vector?
In other words, is there some fast (built-in) version of the function vor
below?
Thanks.
-Ben
vor <- function(v) {
ans <- v[1]
if (length(v) > 1)
for (i in 2:length(v))
ans <- ans | v[i]
ans
}
2003 Feb 06
1
rdbi segmentation fault (fwd)
one more bit of information about this problem. If I start R as the
user "postgres" i dont have the segmentation fault.
---------- Forwarded message ----------
Date: Wed, 5 Feb 2003 19:19:39 -0500 (EST)
From: Rafael A. Irizarry <ririzarr at jhsph.edu>
Reply-To: rafa at jhu.edu
To: "R-Help (E-mail)" <r-help at r-project.org>
Subject: rdbi segmentation fault
hi! i
2011 Oct 29
4
R help with different combinations of vectors of different sizes
Hi,
I am trying to get different combinations of a vector of different size and
find their sum. For example, if I have a vector (i,j) where i and j can be
anything from 0 to 5, i get these combinations (0,0), (0,1), (1,0), (1,1),
(2,0), ...... (5,5) and find sum of these as 0, 1, 1, 2, ..... , 10. I used
outer functions to get this and it worked. What if I have a vector (i,j,k)
where all i, j ,
2011 Oct 13
3
Create order of numbers based on a given vector
Hello!
If I have a vector vec <- c(FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE
FALSE)
I can I create the following order of numbers based on vector vec:
1, 2, 2, 3, 3, 3, 4, 5
Whenever there is a FALSE I increase the number (starting with 1).
Whenever there is a TRUE I set the same number as the previous FALSE has
been assigned to.
I would be happy for any input
Cheers,
Syrvn
--
View
2010 Nov 29
3
Replacing several rows of a matrix at once
Hello Folks. This must be a silly question with a (not) obvious (to me)
answer.
Consider this:
tmp <- matrix(1:200, nrow = 20)
vec <- 300:309
tmp[9,] <- vec # replacing one row works fine
p <- c(3, 11, 17)
tmp[p,] <- vec
# replacing multple rows pastes the values down a column and recycles vec.
What I want to do is replace multiple rows simultaneously at once. I
suppose I can