similar to: Count factor if

Displaying 20 results from an estimated 5000 matches similar to: "Count factor if"

2010 Nov 09
2
Help with Iterator
Dear Experts, The following is my "Iterator". When I try to write a new function with itel, I got error. This is what I have: > supDist<-function(x,y) return(max(abs(x-y))) > > myIterator <- function(xinit,f,data=NULL,eps=1e-6,itmax=5,verbose=FALSE) { + xold<-xinit + itel<-0 + repeat { + xnew<-f(xold,data) + if (verbose) { + cat( +
2010 Nov 18
3
sweep by levels of a factor
Hi, I'd appreciate help with this. I have a data matrix with one column, called f in the example below, a factor. I'd like to subtract the means from each of other columns for each level of the factor. That is, in the example, to go from the first matrix below to the second. I know SWEEP will take out means, but I want to do this for each level of the factor. f x 1 2 1
2007 Jan 26
2
Using functions within functions (environment problems)
Hi everyone, I've been having difficulty writing wrapper functions for some functions where those same functions include other functions with eval() calls where the environment is specified. A very simple example using function lmer from lme4: lmerWrapper <- function(formula, data, family = gaussian, method = c("REML", "ML", "PQL", "Laplace",
2006 Jan 26
2
Prediction when using orthogonal polynomials in regression
Folks, I'm doing fine with using orthogonal polynomials in a regression context: # We will deal with noisy data from the d.g.p. y = sin(x) + e x <- seq(0, 3.141592654, length.out=20) y <- sin(x) + 0.1*rnorm(10) d <- lm(y ~ poly(x, 4)) plot(x, y, type="l"); lines(x, d$fitted.values, col="blue") # Fits great! all.equal(as.numeric(d$coefficients[1] + m
2001 May 23
1
Passing a string variable to Surv
Hi, I am trying to write a function to automate multiple graph generation. My data looks like: Table of numeric values with the following headers: timeM1 statusM1 xM1 timeM2 statusM2 xM2 timeM3 statusM3 xM3 1 2 3 4 5 6 Where M1,M2, M3 hve no similarity except they have a max string length of 7. Examples are mcw0045, adl0003, lei0101. Now, what I want to do is Function(M1, M2,
2007 Jul 22
1
Package design, placement of legacy functions
I have a function XOLD() from a nearly verbatim port of legacy FORTRAN in a package. I have remplemented this function as XNEW() using much cleaner native R and built-in functions of R. I have switched the package to the XNEW(), but for historical reasons would like to retain the XOLD() somewhere in the package directory structure. An assertion through a README or other will point to
2005 Oct 04
3
Problem reading in external data and assigning data.frames within R
Hey there, I apologize if this is an irritatingly simple question ... I'm a new user. I can't understand why R flips the sign of all data values when reading in external text files (tab delimited or csv) with the read.delim or read.csv functions. The signs of data values also seem to be flipped after assigning a new data.frame from within R (xnew <-- edit(data.frame()). What am
2005 Sep 06
2
Predicting responses using ace
Hello everybody, I'm a new user of R and I'm working right now with the ACE function from the acepack library. I Have a question: Is there a way to predict new responses using ACE? What I mean is doing something similar to the following code that uses PPR (Projection Pursuit Regression): library(MASS) x <- runif(20, 0, 1) xnew <- runif(2000, 0, 1) y <- sin(x) a <- ppr(x, y,
2020 Nov 14
2
Samba broken after dist-upgrade in Ubuntu 20.04?
Sure. Here they are: root at cobra:/var/log/samba# cat /etc/apt/sources.list # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://de.archive.ubuntu.com/ubuntu focal main restricted # deb-src http://de.archive.ubuntu.com/ubuntu focal main restricted ## Major bug fix updates produced after the final release of the ##
2005 Feb 13
2
row equality.
I think that this is an easy one... I have a matrix where each row is an (x,y,z) triplet. Given a potential (xnew,ynew,znew) triplet I want to know if the matrix already contains a row with the new values (the space already has that point). I can do it using a for loop, but I would like to know if there is anyway in which I can do it without the for loop. I do it now like this (this
2006 Aug 17
2
getting sapply to skip columns with non-numeric data?
getting s-apply to skip columns with non-numeric data? I have a dataframe ?x? of w columns. Some columns are numeric, some are not. I wish to create a function to calculate the mean and standard deviation of each numeric column, and then ?bind? the column mean and standard deviation to the bottom of the dataframe. e.g. tempmean <- apply(data.frame(x), 2, mean, na.rm = T) xnew <-
2020 Mar 20
3
libvirt dynamic file ownership
<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial, Helvetica, sans-serif;font-size:10pt" ><div dir="ltr" >&nbsp;</div> <div dir="ltr" ><div dir="ltr" >Hi,</div> <div dir="ltr" >&nbsp;</div> <div dir="ltr" >I am trying to understand libvirt
2011 Jun 14
2
Need script to create new waypoint
Dear help-list members, I am a student at Durham University (UK) conducting a PhD on spatial representation in baboons. Currently, I'm analysing the effect of sampling interval on home range calculations. I have followed the baboons for 234 days in the field, each day is represented by about 1000 waypoints (x,y coordinates) recorded at irregular time intervals. Consecutive waypoints in
2020 Mar 23
1
Re: libvirt dynamic file ownership
Hi Martin, thanks for the explanation. Now I understand why libvirt doesn't revert the file permissions back to the original. I am running these VMs on an isolated test machine, so I'll disable dynamic file ownership and make sure libvirt has access to image files. Sorry about the message formatting. I modified settings on my client, hopefully it sends plaintext now. (I'll switch to
2012 Jul 02
0
Fit circle with R
Dear Researchers, I wrote two function to fit a circle using noisy data. 1- the fitCircle() is derived from MATLAB code of * zhak Bucher* from the link http://www.mathworks.com/matlabcentral/fileexchange/5557-circle-fit/content/circfit.m 2- the CircleFitByPratt() from MATLAB code of *Nikolai Chernov *from the link
2020 Apr 24
4
Timezone conversion on Ubuntu 20.04
Hi all, I am testing R 4.0 and ran into an issue with timezones on Ubuntu Focal: converting a timestamp to another timezone results in NA: as.POSIXct(as.POSIXlt(Sys.time(), tz = "CET"), tz = "EST") This only happens on Ubuntu Focal, it seems to work fine on Ubuntu Bionic. I am the standard ubuntu docker image icw/ r-base from Dirk's ppa:edd/r-4.0 on both systems. Am I
2009 Feb 03
1
Collapsing panel data
Dear R-helpers, I've been thinking about this for some time, maybe someone can help. I have a fairly large dataset with thousands of firms, call the a, b, c, etc.. such as [,1] [,2] [1,] "A" 0.5 [2,] "" 0.2 [3,] "" 0.3 [4,] "B" 0.1 [5,] "" 0.9 [6,] "C" 0.4 Or to put it differently two vectors such as y
2020 Jul 15
2
R 4.0 for ARM processors
Hmmmm. Perhaps I'm using the wrong terminology. My logic is: (1) I am running Ubuntu focal on the cluster. (2) Ubuntu focal is built on Debian bullseye but (3) Debian bullseye is not yet the stable release; it is the 'testing' release; hence (4) I will pull the r-base-core package from the 'testing' version of Debian. And, in fact, I found r-base-core for 4.0.2 in the bullseye
2020 Nov 14
3
Samba broken after dist-upgrade in Ubuntu 20.04?
On 14/11/2020 15:51, Rowland penny via samba wrote: > On 14/11/2020 12:56, Joachim Lindenberg via samba wrote: >> Sure. Here they are: >> >> root at cobra:/var/log/samba# cat /etc/apt/sources.list >> # See http://help.ubuntu.com/community/UpgradeNotes for how to >> upgrade to >> # newer versions of the distribution. >> deb
2008 Jul 22
1
help with simulate AR(1) data
Hi, sorry for bothering your guys again. I want to simulate 100 AR(1) data with cor(x_t, x_t-1)=rho=0.3. The mean of the first 70 data (x_1 to x_70) is 0 and the mean of the last 30 data (x_71 to x_100) is 2. Can I do it in the following way? x <- arima.sim(list=(ar=0.3), 100) mean <- c(rep(0, 70), rep(2, 30)) xnew <- x+mean If the above code to simulate 100 AR(1) data is right, what