similar to: coercing factors to matrix() --> num/char ? -- inconsistencies|?

Displaying 20 results from an estimated 30000 matches similar to: "coercing factors to matrix() --> num/char ? -- inconsistencies|?"

1999 Jun 23
2
coercing factors to matrix() --> num/char ? --
Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> wrote: > Martin Maechler <maechler at stat.math.ethz.ch> writes: [ snip... ] > > >From this logic, coercing to a matrix should coerce to character rather > > than integer/numeric codes. > > Hm. I'm not sure there really is much logic in this... Factors are > sometimes character-like, sometimes
2006 Jun 05
2
grep() and factors
Hi all, Based upon an offlist communication this morning, I am somewhat confused (more than I usually am on most Monday mornings...) about the use of grep() with factors as the 'x' argument. The argument guidance in ?grep indicates: x, text a character vector where matches are sought. Coerced to character if possible. and in the Details section: Arguments which should be
2011 May 31
1
Coercing in R and in C (R-Extensions)
Hello, in "Writing R Extensions" I found the following stuff: "Note that these coercion functions are not the same as calling as.numeric (and so on) in R code, as they do not dispatch on the class of the object. Thus it is normally preferable to do the coercion in the calling R code." ( Writing R Extensions, 2011-04-13, page 100 ) What is meant by
2000 Apr 07
1
Newbie: Data reading problem
Hello everybody, I'm a new R user and I've got some difficulties to find the right way to read data files. My problem is the following: I have dayly records of different devices (they all have their own name) during a time period (let's say one year). Each device records 6 fields. I would like to consider that one "fellow" is the recording of one to six fields for one
2010 Aug 27
1
Is it safe not to coerce matrices with as.double() in .C()?
I'd very much appreciate guidance on this. A user reported that the as.double() coercion used inside the .C() call for a function in my package (specifically, randomForest:::predict.randomForest()) is taking up significant amount of time when called repeatedly, and Removing some of these reduced run time by 30-40% in some cases. These arguments are components of the fitted model (thus do
2009 Oct 07
2
Plotting 1 covariate, 3 factors
I'm interested in plotting a y with an x factor as the combination of 2 factors and colour with respect to a third, which the code below does with interaction.plot(). However, this is because I redefine the x to be 1 factor. Is there a way of getting it to plot without redefining it, and ideally to not join up the lines BETWEEN levels a and b, but just join those between after and before for
2016 Sep 02
2
Coercion of 'exclude' in function 'factor' (was 'droplevels' inappropriate change)
I am basically fine with the change. How about using just the following? if(!is.character(exclude)) exclude <- as.vector(exclude, typeof(x)) # may result in NA x <- as.character(x) It looks simpler and is, more or less, equivalent. In factor.Rd, in description of argument 'exclude', "(when \code{x} is a \code{factor} already)" can be removed. A larger
2013 Feb 08
2
Coercing of types when raising a number to a series of powers
I'm trying to produce a series of powers of a number as follows: |> 0.05^0:5 [1] 1 2 3 4 5 This is not the result I expected. I guess some kind of coercion happened, since, |> class(0.05^0:5) [1] "integer" Could anyone explain me what is happening here? Thanks, -Sergio.
2012 Oct 16
1
How to create a high-dimensional matrix
Hi, everyone I need to create a 429497 x 429497 matrix. When I use *matrix(0,429497,429497)* I got the error information : Error in matrix(0, 429497, 429497) : too many elements specified Then I use "ff" package, try to store this matrix on disk * x<-ff(0,dim=c(429497,429497)* And I got the error information : Error in if (length < 0 || length > .Machine$integer.max)
2007 Feb 14
1
predict.lm point forecasts with factors
hello, I am trying to use predict.lm to make point forecasts based on a model with continuous and categorical independent variables I have no problems fitting the model using lm, but when I try to use predict to make point predictions. it reverts back to the original dataframe and gives me the point predictions for the fitted data rather than for the new data, I imagine that I am missing
2005 Jul 14
1
integer codes of factors
U = c("b", "b", "b", "c", "d", "e", "e") F1 = factor( U, levels=c("a", "b", "c", "d", "e") ) as.numeric(F1) [1] 2 2 2 3 4 5 5 Here, the integer code of "b" in F1 is 2 K = factor( levels(F1) ) as.numeric(K) [1] 1 2 3 4 5 K [1] a b c d e Levels: a
2007 Apr 18
1
[Bridge] Unexpected bridge behavior (Bug? You decide.)
While using the linux bridge module in 2.6.10, the kernel seems to munge the source IP address of broadcast UDP packets if they come from "0.0.0.1", and sticks on an address of the linux host. I humbly submit that re-writing the source address of packets is not proper behavior for a bridge, even if those source addresses are not traditionally valid. Sure, 0.0.0.1 isn't a valid
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],
2005 Jan 31
2
coercing a list to a data frame, lists in foreloops
I have a set of time-series climate data with missing entries. I need to add rows for these missing entries to this data set. The only way I know to do this is unsing a foreloop, but this won't work on a list. I've tried to convert the list to a data frame, but that won't happen, either. I want to fill rows in this table: > newtest[10:15,] yrmos yearmo snow.sum snow.mean
2005 Oct 28
4
find_by_sql column types
Hello-- There must be a better way to do this. I have a class method in my model that finds averages and does a few calculations using find_by_sql. The problem I¹m encountering is that all computed columns from MySQL come back as type string. E.g., def self.find_averages(domain_id) if @@domain_average return @@domain_average else @@domain_average =
2007 Aug 08
2
Error: Cannot Coerce POSIXt to POSIXct when building package
A newbie here - please forgive me if this is a basic question. We have an in house package built in R 2.2.1 (yes we're a little behind the times at our firm)and would like to rebuild it using R 2.5.1. However, when I try and build the package from source, I keep getting this error: Error in as(slotVal, slotClass, strict = FALSE) : no method or default for coercing "POSIXt"
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
2008 Sep 04
2
Ubuntu 8.04 Hardy Heron bridged networking xen connectivity loss
Last problem I had involved changing one character in my configuration scripts. Really easy once someone showed me what was wrong. Well I think this issue is just the same. The moment I used apt to install the Xen kernal and tools I lost internet connectivity. I have been managing because I can restore connectivity be deleting the bridge mpower@dodtsair:~$ sudo ifdown eth0
2002 May 20
1
(PR#1577) is.na<- coerces character vectors to be factors
The inconsistency is that you use $<- to set the column, then [[<- to change it. Had you tried to set the column by x[[1]] <- as.character(x[[1]]) you would have seen the problem immediately (it does not work as you would have intended). If you want to be sure to turn off conversion to factor, you need to set the column to class "AsIs". My belief is that will behave
2018 Aug 06
3
vctrs: a type system for the tidyverse
> First off, you are using the word "type" throughout this email; You seem to > mean class (judging by your Date and factor examples, and the fact you > mention S3 dispatch) as opposed to type in the sense of what is returned by > R's typeof() function. I think it would be clearer if you called it class > throughout unless that isn't actually what you mean (in