search for: f1

Displaying 20 results from an estimated 2701 matches for "f1".

2004 Sep 20
1
Using eval() more efficiently?
...ot; automatically generated by some selection criteria. Now, if I have a data frame with many variables, of which the variables in "names.select" are also variables from the data frame. e.g. > all.df[1:5,] Mouse Idd5 Idd6.19.20 Idd13 Idd14 Idd8.12 Idd3.10.17.18 Idd9 1 904 F1 NOD NOD F1 NOD F1 NOD 2 934 NOD F1 F1 F1 F1 NOD NOD 3 950 NOD NOD F1 NOD F1 F1 NOD 4 977 F1 NOD NOD F1 F1 F1 F1 5 1050 F1 F1 NOD NOD NOD...
2010 Dec 23
1
with(data.frame,ifelse(___,___,___))
Hello, All, Mac OS 10.6.5 R64 2.11.1 This works as expected: f1 = c(0.084, 0.099, 0) data= data.frame(f1) data$f1=with(data,ifelse(f1==0, 0.0001, f1)) data f1 1 0.0840 2 0.0990 3 0.0001 Substituting ''f1==0'' with ''T'' produces the expected result: f1 = c(0.084, 0.099, 0) data= data.frame(f1) data$f1=with(data,ifelse(T,...
2008 Apr 18
3
Function redefinition - not urgent, but I am curious
This is just my curiousity working. Suppose I write: f1 <- function(x) x + 1 f2 <- function(x) 2 * f1(x) f2(10) # 22 f1 <- function(x) x - 1 f2(10) # 18 This is quite obvious. But is there any way to define f2 in such a way that we "freeze" the definition of f1? f1 <- function(x) x + 1 f2 <- function(x) # put something here 2...
2006 Aug 16
1
Specifying Path Model in SEM for CFA
I'm using specify.model for the sem package. I can't figure out how to represent the residual errors for the observed variables for a CFA model. (Once I get this working I need to add some further constraints.) Here is what I've tried: model.sa <- specify.model() F1 -> X1,l11, NA F1 -> X2,l21, NA F1 -> X3,l31, NA F1 -> X4,l41, NA F1 -> X5, NA, 0.20 F2 -> X1,l12, NA F2 -> X2,l22, NA F2 -> X3,l32, NA F2 -> X4,l42, NA F2 -> X6, NA, 0.25 F1 <-> F2,g12, 1 F1 <-> F1,g11, 1 F2 <->...
2009 Jun 30
2
Using functions to change values in a data.frame
...s to copy positive values of y into p and negative values into l. <START COPY> AddCols = function (MyFrame) { MyFrame$p<-0 MyFrame$l<-0 return(MyFrame) } BinPosNeg = function (MyFrame) { ifelse(MyFrame$y>0, MyFrame$p<-MyFrame$y, MyFrame$l<MyFrame$y) return(MyFrame) } F1 <- data.frame(x=1:10, y=-4:5) F1 F1 <- AddCols(F1) F1 F1 <- BinPosNeg(F1) F1 <END COPY> My results below are weird. After the last function call F1 acts like BinPosNeg always evaluated MyFrame$y>0. All updates went into p - none into l. What am I doing wrong? Thanks, Mark MY...
2008 Apr 24
4
bug in file.path?
Se ha borrado un texto insertado con un juego de caracteres sin especificar... Nombre: no disponible Url: https://stat.ethz.ch/pipermail/r-help/attachments/20080424/2226f24e/attachment.pl
2019 Sep 30
5
Is missingness always passed on?
...or a local call. This may change in the future." Someone pointed out (in https://stackoverflow.com/a/58169498/2554330) that this isn't true in the examples they've tried: missingness does get passed along. This example shows it (this is slightly different than the SO example): f1 <- function(x, y, z){ if(missing(x)) cat("f1: x is missing\n") if(missing(y)) cat("f1: y is missing\n") } f2 <- function(x, y, z){ if(missing(z)) cat("f2: z is missing\n") f1(x, y) } f2() which produces f2: z is missing f1: x is mis...
2011 Feb 14
4
sem problem - did not converge
Someone can help me? I tried several things and always don't converge # Model library(sem) dados40.cov <- cov(dados40,method="spearman") model.dados40 <- specify.model() F1 -> Item11, lam11, NA F1 -> Item31, lam31, NA F1 -> Item36, lam36, NA F1 -> Item54, lam54, NA F1 -> Item63, lam63, NA F1 -> Item65, lam55, NA F1 -> Item67, lam67, NA F1 -> Item69, lam69, NA F1 -> Item73, lam73, NA F1 -> Item75, lam75, NA F1 -> Item76, lam7...
2008 Apr 04
2
How to create a function calling two functions with unknown number of parameters?
... can be used to represent unknown number of parameters passed into a function. For example, I write a function g. g calls another function f1. For example f1 could be different random number generation function. when f1=rnorm(), it has 3 parameters n, mean and standard deviation. when f1=rexp(), it has 2 parameters n and rate. g can be defined as g <- function(f1, ...) { f1(...) } My problem is what about g calls two functio...
2005 Jul 18
1
levels() deletes other attributes
Dear All, it seems to me that levels() deletes other attributes. See the following example: ## example with levels f1 <- factor(c('level c','level b','level a','level c'), ordered=TRUE) attr(f1, 'testattribute') <- 'teststring' attributes(f1) levels(f1) <- c('L-A', 'L-B', 'L-C') attributes(f1) If I run it, after assigning new levels,...
2009 Jul 01
1
How should I denormalise a data frame list of lists column?
...e based on membership of the lists in that column and be able to 'denormalise' the data frame so that a row is duplicated for each of its list elements. Example code follows: # The data is read in in this form with the c2 list values in single strings which I then split to give lists: > f1 <- data.frame(c1=0:2, c2=c("A,B,C", "A,E", "F,G,H")) > f1$Split <- strsplit(as.character(f1$c2), ",") > f1 c1 c2 Split 1 0 A,B,C A, B, C 2 1 A,E A, E 3 2 F,G,H F, G, H # So f1$Split is the list of lists column I want to denormalise...
2000 Dec 29
2
how to create help files
...regarding the documentation of ones own functions. I have ceated a private library for my functions, which works all very well, apart from that I am not able to create appropriate help files. For illustration, here is a simple example of where I'm stuck: > # first, create a simple function f1: > f1 <- function(x) x^2 > # create directories where a package called "testfunctions" with my own functions will live: > R.home() [1] "D:\\Programme\\R\\rw1020" > mypath <- paste(R.home(),"\\library\\testfunctions", sep="") > mypath [1]...
2002 Aug 20
1
About lm()
Dear Mr. and Mrs. I'm very grateful for these software and this list. My question is: when a use linear multiple regression (lm()) for my data, abundance ichthyoplankton ~ salinity + temperature + month of the year(f1 is a factor: 1 for january, 2 for february, ..., 12 for december), the summary() of results is ... Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.726347 0.285607 2.543 0.011217 * temperature -0.011410 0.014200 -0.804 0.421978 salinity...
2009 Jul 01
2
?max (so far...)
...n (MyFrame) { MyFrame$pwin <- round((MyFrame$pc / (MyFrame$pc+MyFrame$lc)),2) return(MyFrame) } HighLow = function (MyFrame) { temp1 <- MyFrame$p[1:row] MyFrame$hp <- max(temp1) ## Highest p temp1 <- MyFrame$l[1:row] MyFrame$ll <- min(temp1) ## Lowest l return(MyFrame) } F1 <- data.frame(x=1:10, y=2*(-4:5) ) F1 <- AddCols(F1) F1 <- BinPosNeg(F1) F1 <- RunningCount(F1) F1 <- PercentWins(F1) F1 F1 <- HighLow(F1) F1 temp1<-F1$p[1:5] max(temp1) temp1<-F1$p[1:7] max(temp1) temp1<-F1$p[1:10] max(temp1)
2007 Jul 12
1
sub-function default arguments
Hi. I have defined a function, f1, that calls another function, f2. Inside f1 an intermediate variable called nm1 is created; it is a matrix. f2 takes a matrix argument, and I defined f2 (schematically) as follows: f2<-function(nmArg1=nm1,...){nC<-ncol(nmArg1); ... } so that it expects nm1 as the default value of its ar...
2009 Jul 01
1
running count in data.frame
...e MyFrame$l column, and likewise for $pc and $p. It seems that $lc starts off OK until it gets to a 0 and then resets back to 0 which I don't want. The $pc counter never seems to count. I also get a warning message I don't understand so clearly I'm doing something very wrong here: > F1 <- RunningCount(F1) Warning messages: 1: In MyFrame$pc[pos] <- cumsum(as.integer(pos)) : number of items to replace is not a multiple of replacement length 2: In MyFrame$lc[pos] <- cumsum(as.integer(pos)) : number of items to replace is not a multiple of replacement length > F1...
2005 Feb 28
5
persistance of factor levels in a data frame
Hi, Just something I don't understand: data <- data.frame(V1=c(1:12),F1=c(rep("a",4),rep("b",4),rep("c",4))) data_ac <- data[which(data$F1 !="b"), ] levels(data_ac$F1) Why the level "b" is always present ? thanks Tristan, R 2.0.1 for Linux Fedora 3 -- -------------------------------------------------------...
2012 May 02
2
output Shapiro-Wild results to a table
Hello, I have applied the Shapiro test to a matrix with 26.925 rows of data using the following F1.norm<-apply(F1.n.mat,1,shapiro.test) I would now like to view and export a table of the p and W values from the Shapiro test, but I am not sure how to approach this. I have tried the following with errors. > write.table(x=F1.norm,file="I:/R_Work/F1/Shapiro.csv", sep=",&quo...
2012 Jul 11
2
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
...; .reg .s32 %r<396>; .reg .s64 %rl<396>; .reg .f32 %f<396>; .reg .f64 %fl<396>; // BB#0: // %entry mov.b64 %rl0, __internal_dsmul_param_1; cvta.local.u64 %rl0, %rl0; ld.f32 %f0, [%rl0+4]; neg.f32 %f1, %f0; mov.b64 %rl1, __internal_dsmul_param_2; mov.f32 %f2, 0f45800800; // inline asm mad.f32 %f1, %f1, %f2, %f0; // inline asm // inline asm mad.f32 %f3, %f0, %f2, %f1; // inline asm cvta.local.u64 %rl1, %rl1; ld.f32 %f1, [%rl1+4]; neg.f32...
2009 Jul 15
4
Extract pairs (rowname, columname) from a matrix where value is 0
Dear sir, I have a matrix like a<-matrix(c(0,2,0,4,0,6,5,8,0),nrow=3) colnames(a)<-c("F1","F2","F3") rownames(a)<-c("A1","A2","A3") a F1 F2 F3 A1 0 4 5 A2 2 0 8 A3 0 6 0 I want to extract all pairs (rownames, columnames) from which the value in the matrix is 0 The result should be something like this A1, F1 A2, F...