similar to: product of vector elements

Displaying 20 results from an estimated 10000 matches similar to: "product of vector elements"

2007 Feb 15
3
something missing in summary()
I just noticed that two key pieces of information are not given by the summary() command: N and SD. we are given the N missing, but not the converse. I know these summary value can be obtained easy, but can't understand why these two pieces of information are not provided with the other info. Thanks, Gerard
2010 Mar 14
2
special symbols into a text string
All, I am trying to put a few special symbols into a string to place on a graph (e.g., >= and superscript 2). This clearly works, but does not look good: text<-c("x2", "A>=B") I tried pasting in the >= symbol, but just comes out as an =. I have tried expression() with no luck: text<-c("x2", expression(x^2)) Any help appreciated. Thanks,
2007 Sep 07
2
R first.id last.id function error
Hi R users, I have a test dataframe ("file1," shown below) for which I am trying to create a flag for the first and last ID record (equivalent to SAS first.id and last.id variables. Dump of file1: > file1 id rx week dv1 1 1 1 1 1 2 1 1 2 1 3 1 1 3 2 4 2 1 1 3 5 2 1 2 4 6 2 1 3 1 7 3 1 1 2 8 3 1 2 3 9 3 1 3
2012 Feb 20
1
question on axis labels
Hi All, I'm trying to label my plot axis with times (HH:MM) that correspond to a numeric index (values 0:6) for my time variable. I'd like to plot "08:00", "12:00", and so on, instead of 0 through 6. I have used the following line of code: axis(1, 0:6, labels=c("08:00", "12:00", "16:00", "20:00", "24:00",
2010 Oct 06
4
problem with abline
Hi All, I am running a scatter plot and trying to add a best fit line. I use an abline function, but get no line drawn over the points. I also get no error. I arm using V 2.10.0 on Windows 7. Here is my code, including the SAS transport file import: require (foreign) require (chron) require (Hmisc) require (lattice) clin <- sasxport.get("y:\\temp\\subset.xpt") attach(clin)
2008 Jan 01
3
if statement problem
Hi All, I have a small dataset named das (43 cases) in which I am trying to create a binary outcome (1/0) based on the following code: if (das$age>65 && das$bmi>30) {das$danger<-1} else das$danger<-0 I am setting a flag called 'danger' to 1 of the subject is over 65 and has a BMI > 30. I find that my statement evaluates the first record in the data.frame and
2010 Apr 08
1
Question on using elements of a vector
Hi So my particular problem is this: I have a row vector of length 5200 elements - specifically created by x<-rbinom(5200,1,0.5) y<-matrix(x,nrow=1,ncol=5200) y now, each element is either a 0 or a 1 - e.g. it could be (0,1,1,1,1,0,0,0,1,1,1) e.t.c. when the element is a 1, i need to multiply a number (say 1000) by 1.005, and if it is 1 again, multiply it _again_ by 1.005. so
2000 Nov 17
2
Randomly selecting n (unique) elements out of vector of length m...
Dear R users, I wonder if there is a simple way to select a random and non-overlapping subset of a vector? Say, I need to randomly select 10 out of 100 numbers in a vector V. By "non-overlapping" I mean that a number in any position in V (V[1]...V[100]) should be selected at most once (i.e. selection without recycling). I could simplu use a uniform distribution to generate selection
2009 Nov 09
6
Find the first values in vector
Hi ! I have a vector: vec= TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE TRUE TRUE FALSE and I'm looking for a method which let me get only the first values equal TRUE from this vector. It means that I want to get a vector: vec_out = TRUE TRUE TRUE TRUE or posictions values = TRUE: vec_out = 1,2,3,4 -- View this message in context:
2007 Jan 21
1
sequential processing
Like many others, I am new to R but old to SAS. Am I correct in understanding that R processes a data frame in a sequential ly? This would imply that large input files could be read, without the need to load the entire file into memory. Related to the manner of reading a frame, I have been looking for the equivalent of SAS _n_ (I realize that I can use a variant of which to identify an index
2008 Aug 18
2
matrix row product and cumulative product
I spent a lot of time searching and came up empty handed on the following query. Is there an equivalent to rowSums that does product or cumulative product and avoids use of apply or looping? I found a rowProd in a package but it was a convenience function for apply. As part of a likelihood calculation called from optim, I?m computing products and cumulative products of rows of matrices with
2007 Sep 15
3
applying math/stat functions to rows in data frame
Hi All, There are a variety of functions that can be applied to a variable (column) in a data frame: mean, min, max, sd, range, IQR, etc. I am aware of only two that work on the rows, using q1-q3 as example variables: rowMeans(cbind(q1,q2,q3),na.rm=T) #mean of multiple variables rowSums (cbind(q1,q2,q3),na.rm=T) #sum of multiple variables Can the standard column functions (listed in the
2006 Feb 28
2
vector math: calculating a rolling 12 row product?
I have a dataframe of numeric values with 30 ?rows? and 7 ?columns?. For each column, beginning at ?row? 12 and down to ?row? 30, I wish to calculate the ?rolling 12 row product?. I.e., within each column, I wish to multiply all the values in row 1:12, 2:13, 19:30. I wish to save the results as a new dataframe, which will have 19 rows and 7 columns.
2010 Oct 12
2
extract rows of a matrix
Hi all, I want to extract every 20th row of a big matrix, say 10000 by 1000. What is the simper way to do this? Thank you very much! Hannah [[alternative HTML version deleted]]
2011 Jan 27
1
How do I fix this ?
Just when I think I'm starting to learn .... Statement z1 works, statement z doesn't. Why doesn't z work and what do I do to fix it ? Clearly the problem is with the first NA, but I would think it's handled through the loop vectorization. y1 <- rnorm(20, 0, .013) y1 [1] -0.0068630836 -0.0101106230 -0.0169663344 -0.0066314769 0.0075063818 [6] -0.0033548024 0.0015647863
2014 Sep 13
1
vegan moved to GitHub and vegan 2.2-0 is coming (are you ready?)
Dear vegan team, Vegan development happens now completely in github. R-Forge repository is no more in sync with github. I tried to commit all github changes to R-Forge, but a week ago I got a conflict in file and I haven't had time to resolve that conflict. You can follow vegan development and vegan discussion also without signing to github. The system seems to be completely open and does not
2008 Sep 03
2
optimizing speed of calculation (recursive product)
Dear list, I'm wondering how to optimize functions/processes like the one shown below (which simplifies something we're trying to do with very large datasets). In many cases I've noticed that using apply, sapply etc can help speeding up processes, but in this case I don't see how I could do so. a <- runif(10000000,0.5,1.6) C <- 2 M <- 10000000 system.time( for (i in
2004 Oct 06
1
"security = user" security setting
Using Samba 3.x, we are looking at the "security" setting. We want to get "security = user" to work, preferably with user authentication independent from local /etc/passwd & shadow. But we don't want to use Samba-based authentication due to administrative overhead. Ideally, we want to tie in with a Windows Active Directory domain through Kerberos 5 so people can use
2004 Sep 08
1
Logging the hostname with a Samba share connection
I am new to Samba but I set up a server and I am trying to get the logging to my liking. In /var/log/samba the entries are of the format: date.ipaddress.ipaddress I would prefer the logging to be: date.ipaddress:hostname I tried to do this with the /etc/samba/smb.conf setting: log file = /var/log/samba/%m:%M:%I.log The man page seems to indicate that either %m or %M should
2009 Feb 12
2
SAS Institute Adding Support for R
Hi Folks, SAS Institute is adding official support for R: http://support.sas.com/rnd/app/studio/Rinterface2.html Cheers, Bob ========================================================= Bob Muenchen (pronounced Min'-chen), Manager, Research Computing Support U of TN Office of Information Technology Stokely Management Center, Suite 200 916 Volunteer Blvd., Knoxville, TN