similar to: Re: [R] Unexpected behaviour of identical (PR#6799)

Displaying 20 results from an estimated 10000 matches similar to: "Re: [R] Unexpected behaviour of identical (PR#6799)"

2004 Apr 19
3
How to write an S4 method for sum or a Summary generic
If I have a class Foo, then i can write an S3 method for sum for it: >setClass("Foo",representation(a="integer"));aFoo=new("Foo",a=c(1:3,NA)) >sum.Foo <- function(x,na.rm){print(x);print(na.rm);sum(x at a,na.rm=na.rm)} >sum(aFoo) But how do I write an S4 method for this? All my attempts to do so have foundered. For example
2006 Jan 17
1
data.matrix returns mode logical for zero rows (PR#8496)
Full_Name: Jonathan Swinton Version: 2.2.1 OS: Windows Submission from: (NULL) (193.132.159.169) #The first line of description for data.matrix says that it will # 'Return the matrix obtained by converting all the variables in a # data frame to numeric mode and then binding them together as the # columns of a matrix.' #However when called with a data.frame with zero rows,
2003 Dec 19
1
Missing arguments to new
Is this the expected and/or correct behaviour? And if so, how do I persuade new to interpret a named but missing argument as missing? ------------- setClass("testMissing",representation(a="numeric"),prototype=list(a=0)); showMissing <- function(real.arg,missing.arg) { really.missing <- new("testMissing"); show(really.missing); really.there <-
2012 Jan 10
2
strange Sys.Date() side effect
Any ideas what is the problem with this code? > N <- 2; c(Sys.Date(), sprintf('N = %d', N)) [1] "2012-01-10" NA Warning message: In as.POSIXlt.Date(x) : NAs introduced by coercion Best regards, Ryszard Ryszard Czerminski AstraZeneca Pharmaceuticals LP 35 Gatehouse Drive Waltham, MA 02451 USA 781-839-4304 ryszard.czerminski@astrazeneca.com
2011 Nov 23
2
bizarre seq() behavior?
Is there any rational explanation for the bizarre seq() behavior below? > seq(2,8.1, lenght.out=3) [1] 2 3 4 5 6 7 8 > help(seq) > seq(2,8,length.out=3) [1] 2 5 8 > seq(2,8.1,length.out=3) [1] 2.00 5.05 8.10 Except maybe that it is early in the morning :) Best regards, Ryszard Ryszard Czerminski AstraZeneca Pharmaceuticals LP 35 Gatehouse Drive Waltham, MA 02451 USA 781-839-4304
2012 Jan 12
3
strsplit() does not split on "."?
Any ideas what is wrong? > strsplit("a.b", ".") # generates empty strings with split="." [[1]] [1] "" "" "" > strsplit("a b", " ") # seems to work fine with split=" ", and other characters... [[1]] [1] "a" "b" > > R.Version() $platform [1]
2010 Sep 27
1
smooth contour lines
Is there an easy way to control smoothness of the contour lines? In the plot I am working on due to the undersampling the contour lines I am getting are jugged, but it is clear "by eye" these should be basically straight lines. In maps package I found smooth.map function, but maybe there is a more generic way of accomplishing the same thing. Ideally there would be an option to control
2012 Jan 25
1
Error in predict.randomForest ... subscript out of bounds with NULL name in X
RF trains fine with X, but fails on prediction > library(randomForest) > chirps <- c(20,16.0,19.8,18.4,17.1,15.5,14.7,17.1,15.4,16.2,15,17.2,16,17,14.1) > temp <- c(88.6,71.6,93.3,84.3,80.6,75.2,69.7,82,69.4,83.3,78.6,82.6,80.6,83.5,76 .3) > X <- cbind(1,chirps) > rf <- randomForest(X, temp) > yp <- predict(rf, X) Error in predict.randomForest(rf, X) : subscript
2004 Jan 21
1
[g]sub behaviour with NA (PR#6451)
Full_Name: Jonathan Swinton Version: 1.9.0 OS: Windows 2000 Submission from: (NULL) (193.132.159.34) Attempting to substitute a NA causes an error in sub. > sub(x=NA,pattern="x",replacement="y") Error in sub(pattern, replacement, x, ignore.case, extended) : invalid argument > sub(x=NA,pattern=NA,replacement="y") [1] NA The help page for sub says only
2009 Sep 25
7
Spliting columns, strings or reg exp returning substrings
Currently as the first column in a data frame I have string values in the format xx_yy - I want to create a new column with just the substring xx (for each row in turn). Three possible ways to do this might be (1) split the string by '_' using strsplit and paste the first of the resulting variables into a new column, but I have been unable to do this for each row of my data frame in turn
2003 Dec 18
1
qbinom when probability is 1 (PR#5900)
Full_Name: Jonathan Swinton Version: 1.8.0 OS: Windows 2000 Submission from: (NULL) (193.132.159.34) Calling qbinom with a sample probability of 1 returns NaN > qbinom(p=0.95,size=10,prob=1) [1] NaN I believe that this is wrong and that qbinom(p,size,prob=1) should always be size for 0<p<=1. The documentation says that The quantile is defined as the smallest value x such that F(x)
2001 Feb 07
5
zero inflated poisson and censored-continuous models
I wonder if there is a package that will estimate a Zero Inflated Poisson Model (ZIP), and also if there is a package that will estimate what is called the Tobit model: that is a combination of censored and observed values in the same sample. Georgina Bermann Biostatistics AstraZeneca R&D M?lndal -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing
2009 Jan 20
2
Merging tables
I am relatively new to R and am trying to do some basic data manipulation. Basically I have a table (csv - table 1) of data for a set of samples (rows), and a second table (table 2) of information about a subset of samples of particular interest. I want to pull out the data from table 1 for the samples in table 2, either by: * Merging the two tables based on a common identifier (SampleID - may
2011 Jan 20
1
randomForest: too many elements specified?
I getting "Error in matrix(0, n, n) : too many elements specified" while building randomForest model, which looks like memory allocation error. Software versions are: randomForest 4.5-25, R version 2.7.1 Dataset is big (~90K rows, ~200 columns), but this is on a big machine ( ~120G RAM) and I call randomForest like this: randomForest(x,y) i.e. in supervised mode and not requesting
2002 Oct 23
1
SAMBA and Win2000 SP3
We are presenty using SAMBA 2.2 w. Windows 2000 sp1 and will be upgrading to Windows 2000 sp3. Are there any known or suspected problems with the combination of Windows 2000 sp3 and SAMBA 2.2. We are using Solaris 7 on the Unix side. /ola Ola Engstr?m Technical Computing & Information Services AstraZeneca R&D M?lndal S-431 83 M?lndal Sweden
2000 Jan 05
1
Upgrade to 2.0.6 not working
Hi All, We have been running samba-1.9.18p10 beautifully for the past year or so. Finally decided to upgrade to samba-2.0.6 and am having no luck. We are using security=server such that the users are using their NT login/password to authenticate. When I test the 2.0.6 installation with smbclient, I get the "protocol negotiation failure" message. Does anyone know what this means? I
2009 Jul 28
2
aggregating strings
I am currently summarising a data set by collapsing data based on common identifiers in a column. I am using the 'aggregate' function to summarise numeric columns, i.e. "aggregate(dat[,3], list(dat$gene), mean)". I also wish to summarise text columns e.g. by concatenating values in a comma separated list, but the aggregate function can only return scalar values and so something
2001 Apr 02
2
standard errors of fitted values are different S-plus survival pa ckage and R
Perhaps this question has been asked before: but using the function predict( fit,type="terms",se.fit=T), where fit is a coxph object in S-plus, the estimated standard errors are different. It may be different estimators of the variance of the residuals? Which one is the default in R, I don't find that too easily in the documentation. Does anybody know? I'll be very grateful
2003 Apr 01
2
Old style and new style classes
I have been writing quick and dirty S-plus code for years, but for a recent project I took the plunge, bought Venables and Ripley's S Programming, and implemented a class library using new style classes (in S-Plus 6.0). It worked quite nicely and I am wondering about making more routine use of them. Before I make much more of an investment, I have a few questions, both factual and subjective,
2003 Apr 01
2
Old style and new style classes
I have been writing quick and dirty S-plus code for years, but for a recent project I took the plunge, bought Venables and Ripley's S Programming, and implemented a class library using new style classes (in S-Plus 6.0). It worked quite nicely and I am wondering about making more routine use of them. Before I make much more of an investment, I have a few questions, both factual and subjective,