Displaying 10 results from an estimated 10 matches for "coersion".
Did you mean:
coercion
2009 Sep 27
2
dimension-preserving matrix coersion
i've written a function to coerce a matrix (e.g. from numeric to
logical), but i'd like to know if someone has a more elegant method
for this:
> m <- matrix(c(0, 1, 1, 0), ncol = 2)
> m <- as.logical(m)
> m
[1] FALSE TRUE TRUE FALSE
i'd like 'm' to still be a matrix with the original dimensions. in my
function to do this, i coerce 'm' to a logical,
2004 Aug 16
1
turning off automatic coersion from list to matrix
Hello,
I am having trouble understanding how R is coercing between matrices and
lists in the following example. I have an aggregate behavior I like:
aggregate(a[,"num"],by=list(product=a[,"product"],region=a[,"region"]),
sum)
Now in reality I have more columns than just product and region, and
need to pick different combinations. So I want to abstract this into a
2004 Apr 20
2
Indexing by factor misfeature
Yesterday I was biten by a feature, which I find too dangerous.
I wanted to use a factor `Subject?? as index into a data frame, whose row
names were the levels of this factor. So there a 2 different possible
interpretations of this: Either Subject is coerced to numeric or to
character. The intended interpretation was, of course, `as.character(Subject)'.
R did `as.numeric(Subject)??. This will
2002 May 20
0
is.na<- coerces character vectors to be factors within dataframes (PR#1577)
...ta.frame(var = LETTERS[1:3])
> x$var <- as.character(x$var)
> x
var
1 A
2 B
3 C
> is.character(x$var)
[1] TRUE
> is.na(x[[1]]) <- 2
> x
var
1 A
2 <NA>
3 C
> is.character(x$var)
[1] FALSE
> is.factor(x$var)
[1] TRUE
>
Interestingly enough, this coersion does not occur if you refer to x$var
instead of x[[1]].
> x <- data.frame(var = LETTERS[1:3])
> x$var <- as.character(x$var)
> is.na(x$var) <- 2
> x
var
1 A
2 <NA>
3 C
> is.character(x$var)
[1] TRUE
> is.factor(x$var)
[1] FALSE
>
I could (ort of) im...
2012 Aug 24
1
POSIXct-coerced NA's not considered NA by is.na()
Hello folks,
I found a strangeness while experimenting with POSIXct vectors and
lists. It seems that coerced NA's aren't "real" NAs, at least as
considered by is.na()?
> date_vec = c(as.POSIXct(now()), as.POSIXct(now()+1),NA,"b")
> date_vec
[1] "2012-08-22 15:00:46 COT" "2012-08-22 15:00:47 COT" NA
[4] NA
Warning message:
In
2002 May 20
1
(PR#1577) is.na<- coerces character vectors to be factors
...> 2 B
> 3 C
> > is.character(x$var)
> [1] TRUE
> > is.na(x[[1]]) <- 2
> > x
> var
> 1 A
> 2 <NA>
> 3 C
> > is.character(x$var)
> [1] FALSE
> > is.factor(x$var)
> [1] TRUE
> >
>
> Interestingly enough, this coersion does not occur if you refer to x$var
> instead of x[[1]].
>
> > x <- data.frame(var = LETTERS[1:3])
> > x$var <- as.character(x$var)
> > is.na(x$var) <- 2
> > x
> var
> 1 A
> 2 <NA>
> 3 C
> > is.character(x$var)
> [1] TRUE...
2006 Nov 16
5
<RBloomberg Package Problem>
Hi R-Experts,
I'm currently using R 2.4.0 in Windows XP. I'm trying to download data
from Bloomberg using the package "RBloomberg", but it fails to install
the three needed packages "zoo", "chron" and 'Rbloomberg". Moreover I
am not able to find "RBloomberg" package as windows binary in CRAN
site as only for MAC it's given. Please
2006 Jul 17
18
Inserting datetime value into SQL Server
I have a SQL Server column named StartTime of (SQL Server) type datetime
If I attempt to set the attribute using
public
def StartTime=(time)
write_attribute(:StartTime, "{ts ''1899-12-30
#{time.hour}:#{time.min}:#{time.sec}''}")
end
it''s inserting a NULL value.
Anyone else able to successfully insert a date time value into a SQL
Server table using
1999 May 27
3
No subject
(I dithered a bit about whether this belongs on r-help
(as part of it is a general R question) or r-devel
(as it's a question relating to putting stuff on
CRAN) but decided it might be of general enough interest
to go on the former )
I am currently preparing an R library to estimate
approximate posterior distributions for parameters in
Generalised Linear Mixed Models by Gibbs Sampling
2010 Nov 04
4
how to work with long vectors
HI, Dear R community,
I have one data set like this, What I want to do is to calculate the
cumulative coverage. The following codes works for small data set (#rows =
100), but when feed the whole data set, it still running after 24 hours.
Can someone give some suggestions for long vector?
id reads
Contig79:1 4
Contig79:2 8
Contig79:3 13
Contig79:4 14
Contig79:5 17