similar to: by-group processing

Displaying 20 results from an estimated 2300 matches similar to: "by-group processing"

2009 Jul 07
6
how to count number of elements in a vector that are not NA ?
Hi, is there a simpler way to count the number of elements in a vector that are not NA than this: countN <- function (v) { return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1))) } ? - Godmar
2009 Jul 15
1
problem with merging matrices
Dear all, I'm a relative new user of R and I have a problem with merging a collection of matrices. All matrices in this collection have the same dimension (532 rows and 532 columns), but can differ in the row and columns names. I'd like to merge these matrices in such a way that the resulting matrix only contains unique row- and column-names and that in case of a match between the row or
2009 Jul 22
3
time difference
Dear R People: I am looking at the ctime attribute of two different files. It contains the year, month, day, time of creation and time zone. Is there a way to determine the difference between the ctimes of two files, please? I looked in the chron package and nothing seemed to work. Thanks in advance, Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and
2009 Aug 03
3
if confusion
Simple question: Why doesn't the following work? Or what 'R' rule am I missing? tclass <- "Testing 1 2 3" if(tclass == "Testing 1 2 3") { cat("Testing", tclass, "\n") } else { cat(tclass, "\n") } I get an error 'else' is unexpected. Thank you. Kevin
2009 Jul 20
2
assign question
Dear R People: I have several vectors, sa1, sa2,...sa27 of varying lengths. I want to produce one vector xener[1:27] which has the minimum of each sa[i]. I'm trying to set up a loop and use the assign statement, but here are my results: > for(i in 1:27) { + xener[i] <- min(assign(paste("sa",i,sep=""))) + } Error in assign(paste("sa", i, sep =
2009 Jul 08
2
Formatting a Table
I've created a short program to print a table of learning curve factors. However, I cannot figure out how to format the table to: 1) Get rid of the [1]s in the first column and replace it with the values of N. 2) Line up the first row with the factors (decimal fractions). Thanks for any help. The complete program and output is as follows: > Lc<-seq(0.70,0.95,0.05) #Specify learning
2008 Aug 29
1
Most common level of a factor by
I'm looking for something along the lines of which ( table ( x ) == max ( table ( x ) ) ) to find the most common level of one factor by several other factors. For instance, I've got > X <- data.frame ( + x = factor ( sample ( c ( "A" , "B" , "C" , "D" ) , 20 , r = T ) ) + , z1 = factor ( sample ( c ( "Before" ,
2009 Aug 26
3
changing equal values on matrix by same random number
Dear all, I have about 30,000 matrix (512x512), with values from 1 to N. Each value on a matrix represent a habitat patch on my matrix (i.e. my landscape). Non-habitat are stored as ZERO. No I need to change each 1-to-N values for the same random number. Just supose my matrix is: mymat<-matrix(c(1,1,1,0,0,0,0,0,0,0,0, 0,0,0,0,2,2,2,0,0,0,0, 0,0,0,0,2,2,2,0,0,0,0, 3,3,0,0,0,0,0,0,0,4,4,
2008 Oct 28
1
Repository missing hmisc
I'm trying to install the Hmisc package, however it doesn't appear in the list after "utils:::menuInstallPkgs()". Any help? -- David
2009 Jun 23
4
SAS Macro Variable in R
Hi I'm new to R and would like to implement a SAS-like macro variable in R. What I'd like to do is take the simple R code below and change the "=TEF" to different letters to refer to different companies' data for download. # DOWNLOADS FILES FROM YAHOO INTERNET
2009 Jul 08
3
matching each row
I have two dataframes, the first column of each dataframe is a unique id number (the rest of the columns are data variables). I would like to figure out how many times each id number appears in each dataframe. So far I can use: length( match (dataframeA$unique.id[1], dataframeB$unique.id) ) but this only works on each row of dataframe A one-at-a-time. I would like to do this for all of
2009 Jun 30
2
Sweave: multiline Sexpr?
Is there any way to have Sexpr span multiple lines? -- David ? ----------------------------------------------------- David Huffer, Ph.D. Senior Statistician CSOSA/Washington, DC david.huffer at csosa.gov -----------------------------------------------------
2010 Aug 05
4
A %nin% operator?
Sometimes I write code like this: > qf.a <- subset(qf, pubid %in% c(104, 106, 107, 108)) > qf.b <- subset(qf, !pubid %in% c(104, 106, 107, 108)) and I get a little worried that maybe I've remembered the precedence rules wrong, so I change it to > qf.a <- subset(qf, pubid %in% c(104, 106, 107, 108)) > qf.b <- subset(qf, !(pubid %in% c(104, 106, 107, 108))) and pretty
2006 Jan 06
3
Installing Java 1.4.2
For scalix on Centos the Scalix forum provides instructions for convincing Scalix that Centos is Redhat: http://www.scalix.com/community/viewtopic.php?t=516&highlight=centos I am up to the point of getting Java JDK1.4.2 installed. I did a: yum list|grep "java" and got: gcc-java.i386 3.4.4-2 installed java-1.4.2-gcj-compat.noarch
2019 Feb 25
7
Problem with mdadm, raid1 and automatically adds any disk to raid
Hi. CENTOS 7.6.1810, fresh install - use this as a base to create/upgrade new/old machines. I was trying to setup two disks as a RAID1 array, using these lines mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 /dev/sdb1 /dev/sdc1 mdadm --create --verbose /dev/md1 --level=0 --raid-devices=2 /dev/sdb2 /dev/sdc2 mdadm --create --verbose /dev/md2 --level=0 --raid-devices=2
2011 Feb 21
3
multiple plots using a loop
Dear R users, I am trying to write myself a loop in order to produce a set of 20 length frequency plots each pertaining to a factor level. I would like each of these plots to be available on the same figure, so I have used par(mfrow = c(4, 5)). However, when I run my loop below, it produces 20 plots for each factor level and only displays the last factor levels LF plots. I'm fairly new to
2011 Mar 08
4
minimum distance between line segments
Dear R helpers, I think that this may be a bit of a math question as the more I consider it, the harder it seems. I am trying to come up with a way to work out the minimum distance between line segments. For instance, consider 20 random line segments: x1 <- runif(20) y1 <- runif(20) x2 <- runif(20) y2 <- runif(20) plot(x1, y1, type = "n") segments(x1, y1, x2, y2)
2006 Sep 29
1
Feature Request Creation date/time
Hello, I use rsync to copy personal data to various different machines for backup purposes and enjoy the robustness of the copy process. I was wondering if it was possible to add the option for rsync to copy the creation date and time as well as the modification time. This is really just a request for 'completeness'. When copying personal files it's useful to know when the orginal
2003 Jan 29
8
So SAMBA no longer supports print driver downloads
So SAMBA no longer supports print driver downloads. That is about the only conclusion that I can come to at this point. I've not been able to get Windows printer driver downloads to work right since Samba 2.2.2. No one but printer admins displays the correct settings for printers, everyone else gets the original printer defaults that they cannot change. I've tried this with
2011 Feb 16
2
distance between consecutive points
Dear R users, I have two coloumns of data, say x and y, referring to a list of points in 2D space. I am trying to develop a code that will give me the distances (using Pythagoras) between consecutive points (xi,yi) and (xi+1,yi+1). So far I have come up with the following: for (i in 1:length(x)) d<-sqrt((x[i+1]-x[i])^2+(y[i+1]-y[i])^2) For example, if I use the two points (note, I have