Displaying 20 results from an estimated 10000 matches similar to: "bug in ifelse (PR#6611)"
2004 Feb 05
2
correction to the previously asked question (about merging factors)
I have two factors l1, l2, and I'd like to merge them.
(Remark: The factors can not be converted to charaters)
Function c() does not give me the result I want:
> l1 = factor(c('aaaa', 'bbbb'))
> l2 = factor(c('ccc', 'dd'))
> lMerge = factor(c(l1, l2))
> lMerge
[1] 1 2 1 2
Levels: 1 2
>
I'd like to merge l1 and l2 and to get lMerge
2004 Feb 27
4
question
Hi everybody.
The question:
I get two vectors 'iFalseFalse' and 'i2'.
I think they should be the same but they are not.
Is it because
R does not handle complicated logical expressions in such cases
or I do something wrong?
> z1 = c(NA, "", 3, NA, "", 3)
> z2 = c("", "", 3, NA, 3, NA)
> cV = (as.character(z1)==as.character(z2))
2004 Feb 27
2
question about if else
Today is a good day for asking question, I guess.
> c()
NULL
>
> length(c())==0
[1] TRUE
>
> r = ifelse(length(c())!=0, c(), c(1,2)) ### OK
> r = c() ### OK
> r = ifelse(length(c())==0, c(), c(1,2)) ### why this is not OK (given
> the previous two)?
Error in "[<-"(`*tmp*`, test, value = rep(yes, length =
2004 Feb 18
6
interesting feature
Hi, everybody.
This was an interesting discussion last time and it helped me a lot.
Could you please have a look at some feature and tell me
why it was designed this way
(my questions are under #########)
> x = c(1, 10)
> y = c(99, 55)
> d <- data.frame(x = x, y = y)
> d
x y
1 1 99
2 10 55
> add <- data.frame(x = 14, y = 99)
> add
x y
1 14 99
> d <-
2004 Feb 05
1
What is the correct way of using function C() for factors:
The funciton c() works differently for strings and for factors:
For strings:
> l = c('a', 'b')
> l
[1] "a" "b"
For factors:
> l = c(factor('a'), factor('b'))
> l
[1] 1 1
What should be the right technique for merging factors?
--
Svetlana Eden Biostatistician II School of Medicine
2004 Feb 27
1
question about setdiff()
Thank you for your answers,
I have another question:
the behaviour of setdiff(indicesFalse, indicesNA)
does not seem predictable to me.
> indices
[1] 1 2 3 4 5 6
> compareVector
[1] NA TRUE TRUE TRUE FALSE NA
> indicesNA = indices[is.na(compareVector)]
> indicesNA
[1] 1 6
> indicesFalse = indices[compareVector == FALSE]
> indicesFalse
[1] NA 5 NA
>
2004 Mar 26
1
lookup.xport in foreign ignoring some datasets (PR#6701)
The Details.
In the following version.
> version
_
platform i386-pc-linux-gnu
arch i386
os linux-gnu
system i386, linux-gnu
status
major 1
minor 8.1
year 2003
month 11
day 21
language R
>
lookup.xport ignores some datasets in sas export file.
File "emptySasData3.xpt"
(available at http://biostat.mc.vanderbilt.edu/tmp/emptySasData3.xpt)
is a
2005 Apr 14
1
xtable POSIXt
Hi,
I was trying like to print out data frame with POSIXct column
in html format using xtable package, but I got error message
when trying to print the table. Here is example:
aaa<-data.frame(as.POSIXct(strptime('03 2005', '%d %Y')),0)
aaa.tab<-xtable(aaa)
print(aaa.tab)
Error in Math.POSIXt(x + ifelse(x == 0, 1, 0)) :
abs not defined for POSIXt objects
2012 Mar 19
1
diff(time) vs. difftime?
I just encountered another RTFM problem: With
diff(as.POSIXct(...), ...) I was unable to control the units of the
results. Examples:
> (d.d <- diff(as.POSIXct(c('2012-12-12', '2012-12-13'))))
Time difference of 1 days
> (d.h <- diff(as.POSIXct(c('2012-12-12 08:00', '2012-12-12 09:00'))))
Time difference of 1 hours
> (d.m <-
2007 May 03
1
A question about POSIXct
Dear List:
I have a simple two-column data set in .csv format, with the first column
being the date and second column being some value. I use read.csv() to
import the data as follows:
x <- read.csv("myfile.csv",header=T, dec=".", colClasses=c(Date="POSIXct"))
The structure of x is:
> str(x)
`data.frame': 2959 obs. of 2 variables:
$
2004 Feb 05
0
correction to the previously asked question (about mergin g factors)
First of all, I do not understand why conversion to characters are not
allowed. That's what Sundar's solution is doing implicitly (but more
elegantly).
Here's a test of all three. See the function definitions below.
> f1 <- factor(sample(letters[1:3], 1e4, replace=TRUE))
> f2 <- factor(sample(letters[3:5], 1e4, replace=TRUE))
> f3 <- factor(sample(letters[5:7],
2011 Feb 19
1
problem in plotting numeric x by POSIXt class with lattice
# hi all,
# I'm trying to plot temperatures by date in a trellis plot by their
stations
# I'm plotting the following data.frame
library(lattice)
h <- structure(list(station_name = structure(c(3L, 4L, 2L, 10L, 11L,
12L, 6L, 7L, 5L, 8L, 9L, 3L, 4L, 2L, 10L, 11L, 12L, 6L, 7L, 5L,
8L, 9L, 3L, 4L, 2L, 10L, 11L, 12L, 6L, 7L), .Label = c("Ashqelon",
"Beer Sheva",
2007 Mar 20
1
SIP/Polycom Issue, Asterisk 1.2.16, calls dropped
I've been running the 8/1/2004 Head release up until a little over a
week ago. I was forced to due to a card failure to upgrade to 1.2.16
without any advance preparation or testing (most of my connections
are via satellite to all corners of the globe with high latency).
Up until the upgrade I was running with very few issues. Since the
upgrade I have been experiencing strange issues
2018 May 16
2
Date method of as.POSIXct does not respect tz
R 3.5.0
Is it intended that the Date method of as.POSIXct does not respect the
tz parameter? I suggest changing as.POSIXct.Date to this:
function (x, tz = "", ...)
.POSIXct(unclass(x) * 86400, tz = tz)
Currently, the best workaround seems to be using the character method if
one doesn't want the default timezone (which is often an annoying DST
timezone).
This came up on
2008 Nov 15
1
TCP Stack Issues Under FreeBSD 7.1
Hi,
Anyone else noticing any TCP Stack requests for information under a
useraccount with mild to moderate TCP activity on HTTP and other sorts of
ports returns zero results back unless you are root.
[site@Eden ~]$ netstat -i reports
netstat: kvm not available: /dev/mem: Permission denied
ifnet: symbol not defined
[site@Eden ~]$ netstat -an
[site@Eden ~]$ netstat -m
377/823/1200 mbufs in use
2008 Feb 16
3
Arithmetic bug? (found when use POSIXct) (PR#10776)
Full_Name: Bo Zhou
Version: 2.6.1 (2007-11-26)
OS: Windows XP
Submission from: (NULL) (207.237.54.242)
Hi,
I found an arithmetic problem when I'm doing something with POSIXct
The code to reproduce it is as follows (This is the recommended way of finding
out time zone difference on R News 2004-1 Page 32 URL
http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf)
a=Sys.time()
2004 Aug 19
2
proposed change to [.POSIXct
R developers,
The "tzone" attribute is stripped from a POSIXct object when the subscript
command is called ("[.POISXct"). This results in dates being printed in the
locale specific format after a subscript operation is applied to a POSIXct
object which has cause several problems for me in the past.
Here is an example of this problem under R 1.9.1:
> x <-
2019 May 01
3
anyNA() performance on vectors of POSIXct
Inside of the anyNA() function, it will use the legacy any(is.na()) code if
x is an OBJECT(). If x is a vector of POSIXct, it will be an OBJECT(), but
it is also TYPEOF(x) == REALSXP. Therefore, it will skip the faster
ITERATE_BY_REGION, which is typically 5x faster in my testing.
Is the OBJECT() condition really necessary, or could it be moved after the
switch() for the individual TYPEOF(x)
2006 Aug 02
1
Can not rsync certain folders a second time
I am running a windows xp machine and running the latest version of rsync, i am using a naslite server that is the rsync server, when I run the following commands to copy data from my xp machine to my nas it will copy the data the first time but if i pick up email and then run the command again it will freeze with a error, But if i just use a folder that has say my downloads in and i alter a file
2004 Oct 05
2
correct my method of estimating mean of two POSIXlt data frames
Hello, I searched the archives but could not come to a solution. I
have to two columns of information
t_start_cdt looks like:
> t_start_cdt[1:4]
[1] "2003-07-09 11:02:25" "2003-07-09 11:10:25" "2003-07-09 11:30:25"
[4] "2003-07-09 12:00:25"
> class(t_start_cdt)
[1] "POSIXt" "POSIXlt"
t_end_cdt looks like:
> t_end_cdt[1:4]