Displaying 20 results from an estimated 20000 matches similar to: "inconsistent behavior for logical vectors when using apply (" TRUE")"
2010 Jan 02
3
Help needed on applying a function across different data sets and aggregating the results into a single data set
Hi folks,
Wish y'all a Happy New Year 2010!
I need some help with the following:
Say I have lots of data sets, on which I have to apply a certain function on
the same set of columns in each of the data set. Let's take, for ex, the
typical data set is:
df1 <- as.data.frame(cbind(rnorm(10),rnorm(10)))
names(df1)[1] <- "A"
names(df1)[2] <- "B"
There are many
2009 Dec 22
1
as.Date function yields inconsistent results (PR#14166)
Full_Name: Mario Luoni
Version: 2.10.0
OS: Windows XP HE SP3
Submission from: (NULL) (217.194.59.134)
This piece of code:
zzz1 <- as.POSIXct("1999-03-18", tz="CET")
zzz2 <- as.POSIXlt("1999-03-18", tz="CET")
zzz1 == zzz2
as.Date(zzz1)
as.Date(zzz2)
yields TRUE for "zzz1==zzz2", but the two dates returned by as.Date are
different:
>
2010 Mar 23
1
Bold greek letters using plotmath
I'm trying to annotate some graphics using plotmath and finding out that the
code I'm using isn't bolding the greek letters - it bolds the rest (once I
adjusted the numerics to characters), it's just failing on the greek
characters.
Any suggestions welcomed.
Jim Price.
Cardiome Pharma Corp.
Test code:
plot(1:5, type = 'n')
# The not bold version
text(2, 2:4, cex =
2010 Feb 02
1
"strange" behaviour: recognition of decimal numbers by 'which'
It is a strange behaviour in that I did not expect it... but I am sure
there is a simple explanation for it and it'll have to do with the way
numbers are stored in R, but it's caught me by surprise and I don't
find it obvious.
Here's a simplified example reproducing the behaviour I encountered:
I create an empty vector, and I fill it with a sequence of numbers: 0,
0.005,
2010 Oct 06
1
How to read a matrix with Hebrew row names?
Hello all,
I am trying to read a matrix with row names in Hebrew, but I am unable to read
the Hebrew words, e.g.:
להחזיק -1.544317e-02 -2.398621e-01
9.854603e-01 1.111321e+00
ש×חרי -1.544317e-02 -2.398621e-01 7.421092e-01
3.439690e-01
היישוב -1.544317e-02 -2.398621e-01
1.050982e+00 1.125970e+00
×‘×ª×™× -1.544317e-02
2010 Apr 02
1
POSIX primer
I have not used POSIX classes previously and now have a need to use them. I have sports data with times of some athletes after different events. I need to perform some simple analyses using the times. I think I've figured out how to do this. I just want to confirm with others who have more experience that this is indeed the correct approach. If not, please suggest a more appropriate way.
2009 Nov 11
1
Clarification on generic functions and methods
I have constructed the following functions and need a little clarification:
### function to fit the model parameters
jml.fit <- function(dat, con = 1e-3, bias=FALSE, ...){
do stuff ...
}
### default function which calls jml.fit
jml.default <- function(dat, con = 1e-3, bias=FALSE, ...){
result <- jml.fit(dat, con = 1e-3, bias)
result$call <- match.call()
class(result) <-
2009 Nov 08
1
Summary methods
I've defined the following for objects of a class called jml
summary.jml <- function(object, ...){
tab <- cbind(Estimate = coef(object),
StdError = object$se,
Infit = object$Infit,
Outfit = object$Outfit)
res <- list(call = object$call, coefficients = tab,
N = nrow(object$Data), iter = object$Iterations)
class(res) <- "summary.jml"
res
}
2010 Jan 20
1
Reshaping data with xtabs giving me 'extra' data
Dear all,
Lets say I have several data frames as follows:
> set.seed(42)
> dates <- as.Date(c("2010-01-19", "2010-01-20"))
> times <- c("09:30:00", "11:30:00", "13:30:00", "15:30:00")
> shows <- c("Red Dwarf", "Being Human", "Doctor Who")
>
> df1 <- data.frame(Date = dates[1],
2009 Dec 16
1
Rgraphviz installation
Hi,
I wanted to install Rgraphviz. From the R GUI, I downloaded the package but when I tried to load it I got the following error message:
"This application has failed to start because libcdt-4.dll was not
found. Re-installing the application may fix this problem."
The R commands and errors are:
> utils:::menuInstallPkgs()
trying URL
2010 May 06
1
cannot update polr model if I specify "start" parameters
Hi,
I am trying to build an ordinal regression model using polr (from the
MASS package). In order to construct an initial model (without an error
aborting it) in my setting, I must pass in a "start" parameter. I would
then like to use the "step" function to remove unnecessary variables
from the model. However, this fails with the error message:
> mod1 <-
2009 Oct 29
1
change in default behavior of ?functionname in R 2.10?
Hi everyone,
I just installed R 2.10 using the Windows binary. At some point in
the past using the Windows binary installation, the default behavior
of ?functionname changed from plain text to a nice html interface.
Now with R 2.10, the default behavior has changed back to the plain
text help. I assume this has some thing to do with these changes
listed for R 2.10, but I don't quite
2010 May 28
5
difference in sort order linux/Windows (R.2.11.0)
Dear R users,
I'm a bit perplexed with the effect sort has here, as it is different on
Windows vs. linux.
It makes my factor levels and subsequent plots different on the two systems.
Given:
types <- c("PC-D-Euro-0", "PC-D-Euro-1", "PC-D-Euro-2", "PC-D-Euro-3",
"PC-D-Euro-4", "PC-D-Euro-5", "PC-D-Euro-6",
2009 Nov 09
1
Package build error
[This email is either empty or too large to be displayed at this time]
2009 Dec 02
2
Error when running Conditional Logit Model
Dear R-helpers,
I am very new to R and trying to run the conditional logit model using
"clogit " command.
I have more than 4000 observations in my dataset and try to predict the
dependent variable from 14 independent variables. My command is as follows
clmtest1 <-
clogit(Pin~Income+Bus+Pop+Urbpro+Health+Student+Grad+NE+NW+NCC+SCC+CH+SE+MRD+strata(IDD),data=clmdata)
However, it
2007 Feb 12
1
bug in partial matching of attribute names
There looks to be a bug in do_attr() (src/main/attrib.c): incorrect
partial matches of attribute names can be returned when there are an odd
number of partial matches.
E.g.:
> x <- c(a=1,b=2)
> attr(x, "abcdef") <- 99
> attr(x, "ab")
[1] 99
> attr(x, "abc") <- 100
> attr(x, "ab") # correctly returns NULL because of ambig
2009 Nov 29
1
optim or nlminb for minimization, which to believe?
I have constructed the function mml2 (below) based on the likelihood function described in the minimal latex I have pasted below for anyone who wants to look at it. This function finds parameter estimates for a basic Rasch (IRT) model. Using the function without the gradient, using either nlminb or optim returns the correct parameter estimates and, in the case of optim, the correct standard
2010 Feb 12
2
Unexpected behaviour of x[i] when i is a matrix, on Windows
Hi,
when running the following on different instances of R (Linux and
Windows), I get different results. The one for Linux seems to be the
intended / documented one. When using numeric indices rather than
characters, Windows seemed to behave as expected.
-----------On Windows--------------
x = matrix(FALSE, nrow=3, ncol=3)
colnames(x) = LETTERS[1:3]
rownames(x) = letters[1:3]
x
# A
2012 Dec 06
1
svd(X, LINPACK=TRUE) alters its input
Ordinary functions should not alter their inputs but in R-2.15.2
svd(LINPACK=TRUE,X) does. (It worked in 2.15.0 but not in 2.15.1
or 2.15.2 and became deprecated in 2.15.2.)
> X <- matrix(c(1,2,3, 5,7,11, 13,17,19), 3, 3)
> X
[,1] [,2] [,3]
[1,] 1 5 13
[2,] 2 7 17
[3,] 3 11 19
> svd(X, LINPACK=TRUE)$d
[1] 31.9718214 2.3882717 0.3143114
Warning message:
2018 Mar 24
2
Possible bug: file.exists() always returns TRUE for prn.us.txt
Dear all,
while preparing some exercises I came across some highly surprising
behaviour of file.exists(). The specific value "prn.us.txt" always returns
TRUE, even though that file is nowhere to be found on my system.
In a fresh R session 3.4.4 installed on Windows 10:
> grep("prn.us.txt", dir(recursive = TRUE))
integer(0)
> file.exists("prn.us.txt")
[1] TRUE