search for: csosa

Displaying 18 results from an estimated 18 matches for "csosa".

Did you mean: cosa
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 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 -----------------------------------------------------
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
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,
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 May 06
6
by-group processing
Given a dataframe like > data ID Type N 1 45900 A 1 2 45900 B 2 3 45900 C 3 4 45900 D 4 5 45900 E 5 6 45900 F 6 7 45900 I 7 8 49270 A 1 9 49270 B 2 10 49270 E 3 18 46550 A 1 19 46550 B 2 20 46550 C 3 21 46550 D 4 22 46550 E 5 23 46550 F 6 24 46550 I 7 > containing an identifier (ID), a
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
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" ,
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
2009 Jul 09
2
How to Populate List
...o/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 49 Date: Wed, 8 Jul 2009 11:42:09 -0400 From: "David Huffer" <David.Huffer@csosa.gov> Subject: Re: [R] Formatting a Table To: "cvandy" <cvandy26@gmail.com>, <r-help@r-project.org> Message-ID:     <B4A52056BFE1CA40986BB3BADFA48141038F6D12@DC0633VMA1.csosa.gov> Content-Type: text/plain;    charset="iso-8859-1" Cvandy, is this close to wha...
2008 Oct 15
0
R-help Digest, Vol 67, Issue 31
...sincerely, Julia -- View this message in context: http://www.nabble.com/quantile-tp19730778p19730778.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 72 Date: Mon, 29 Sep 2008 16:56:18 -0400 From: "David Huffer" <David.Huffer at csosa.gov> Subject: Re: [R] replicating dataframe rows To: "Dimitris Rizopoulos" <d.rizopoulos at erasmusmc.nl>, "milton ruser" <milton.ruser at gmail.com> Cc: R Help <r-help at r-project.org> Message-ID: <B4A52056BFE1CA40986BB3BADFA4814101F4D256 at DC0633VMA...
2008 Jun 17
0
Rpart description of tree groups
I'm making a few functions to generate latex files describing rpart objects that are then \input-ed into a larger document. So far, the functions I have generate paragraphs containing enumerations of the predictors in pruned trees and the number of formed groups. Its easy enough to recover these. For instance, R> print ( tree ) n= 878 node), split, n, loss, yval, (yprob) *
2009 Aug 13
1
Adding logical vectors
When adding several logical vectors I expect each vector will be coerced to integers and these vectors will then be added. That doesn't always seem to be the case. For example: > ( f1 <- as.factor ( sample ( "x" , 25 , rep = T ) ) ) [1] x x x x x x x x x x x x x x x x x x x x x x x x x Levels: x > ( f2 <- as.factor ( sample ( "y" , 25 , rep = T ) ) )