similar to: How to extract every nth element from a vector

Displaying 20 results from an estimated 10000 matches similar to: "How to extract every nth element from a vector"

2012 Apr 05
3
Apply function to every 'nth' element of a vector
Dear R users, how do I e.g. square each second element of a vector with an even number of elements? Or more generally to apply a function to every 'nth' element of a vector. I looked into the apply functions, but found no hint. For example: v <- c(1, 2, 3, 4) mysquare <- function (x) { return (x*x) } w <- applyfun(v, mysquare, 2) then w should be c(1, 4, 3, 16) Thanks for
2011 Oct 21
2
plotting with a symbol on every nth point
Hi, I would like to produce a plot with a symbol on every nth point in a time series data, like the one in the following: http://www.phon.ucl.ac.uk/home/yi/ProsodyPro/EnglishFocus.png x <- seq(-100,1000,25) plot(x,type="l") Could someone help me out with the above example? Thanks.... [[alternative HTML version deleted]]
2005 Oct 25
1
selecting every nth item in the data
I want to make a glm and then use predict. I have a fairly small sample (4000 cases) and I want to train on 90% and test on 10% but I want to do it in slices so I test on every 10th case and train on the others. Is there some simple way to get these elements? Stephen -- 21/10/2005 [[alternative HTML version deleted]]
2008 Feb 25
1
Plotting series marked with a symbol on every nth data point, preferably in ggplot...
Hello! I am working with signals and a plot of several signals on the same axes can get quite messy. With lines that are very fractured, distinction by only the linestyle is not very clear. If I add symbols to the plot however, there are so many symbols, that they overplot and the whole plot is unreadable once again. I am looking for advice on how to make a plot with continuous lines and symbols
2012 Dec 02
2
How to calculate mean of every nth time series data with zoo or xts ?
Hello, I have 1-minute time series stock data and I'd like to calculate mean of every n-th candle data of m-days. result = c(mean of 1th data, mean of 2nd data, ...) mean of 1th data = (1th data of 2012-1-1 + 1th data of 2012-1-2 + 1th data of 2012-1-3) / 3 mean of 2nd data = (2nd data of 2012-1-1 + 2nd data of 2012-1-2 + 2nd data of 2012-1-3) / 3 ... Could you let me know the fastest
2020 Sep 06
1
Error in ?lowess
The lowess() help page refers to documentation in "src/appl/lowess.doc". This was moved to "src/library/stats/src/lowess.doc" in 2007. This patch fixes it: Index: src/library/stats/man/lowess.Rd =================================================================== --- src/library/stats/man/lowess.Rd (revision 79137) +++ src/library/stats/man/lowess.Rd (working copy) @@
2004 Jan 21
1
Please make lowess() generic (was: Reorganization of packages in the R distribution)
As I've mentioned a number of times. I find it very useful to have lowess() become a generic function so that a lowess.formula() can be defined. Below is a patch that makes both changes, as well as updating the corresponding help documentation. Gregory R. Warnes Manager, Non-Clinical Statistics Pfizer Global Research and Development Tel: 860-715-3536 ? DESCRIPTION ? Makefile ?
2008 May 20
1
S4 generic for lowess
Hi, A lowess method is defined in our package for one of our S4 classes. To explicitely define the generic this is being used if (!isGeneric("lowess")) setGeneric("lowess", useAsDefault = lowess) This works fine for many other methods inherited from various R packages. In this case a warning is issued in R CMD check: * checking R code for possible problems ... NOTE
2009 Jul 07
3
Answering the nTh call ...
Curious to know if anyone's created something similar to the following, if so and you'd care to share an AGI or dialplan, much appreciated. I will be eventually write a script to answer the nTH call. (if I can't find it (why reinvent wheels). Looking to do some testing sending anywhere between 50-200 calls to a machine. I'd like a Snom/Polycom/whatever to pick up after the nTh
2001 Mar 12
2
residuals from lowess fit
Colleagues ---------------------------------- System info: R version rw1022 on NT ESS v. 5.1.18 using emacs ver. 20.4 ---------------------------------- I would like to access the residuals from a lowess fit (function lowess() ) as an aid to assessing whether I am over-smoothing or under-smoothing a dataset (as in Cleveland's book "Visualizing data", section 3.3) Unless I
2009 Mar 19
2
nth root
Hi, Is there a function in R to calculate the nth root, similar to the MATLAB function NTHROOT()? Thanks, Martin Biuw [[alternative HTML version deleted]]
2010 Oct 26
2
anomalies with the loess() function
Hello Masters, I run the loess() function to obtain local weighted regressions, given lowess() can't handle NAs, but I don't improve significantly my situation......, actually loess() performance leave me much puzzled.... I attach my easy experiment below #------SCRIPT---------------------------------------------- #I explore the functionalities of lowess() & loess() #because I have
2005 Apr 29
1
problem with nth patch, counter parameter...I think
Hi all, I need some guidance to get my problem fixed. I believe there is an issue with the ''nth'' patch from the patch-o-matic, which is labeled as status ''works''. I have tunnels back and forth across the internet, using ''nth'' to balance packets between different public networks (over the tunnels). I need to access some networks over two
2012 Jul 11
4
MODE , VARIANCE , NTH PERCENTAILE
Hi, Here i have an matrix like this, ABC PQR XYZ MNO ------ ------- ------ -------- 3 6 7 15 2 12 24 15 20 5 1 2 25 50 15 35 i need to get the "MODE" - for each column-wise "VARIANCE" - for
2003 Apr 10
3
A Question on lowess() function
Hi, all, I want to use lowess(x, y) where x and y are vectors of length of 4000+. In fact, x and y are log of some vectors. So, some of the elements are NaN. lowess() can not take away those elements then do the fitting. It will give the error message and do nothing. 1. Can anybody tell me how to get rid of those NaN's and use lowess()? 2. How to get the LOWESS fitting values for any
2003 Nov 26
1
lines(lowess()) trouble
hi: apologies for taking up everyone's time. my problem is probably documented somewhere, but I again cannot find it. (which reminds me: I cannot find a search engine that allows me to search the archives of this very useful mailing list.) * it seems that lines(lowess()) fails to plot certain line segments. (and, what does it do at the x-min and x-max of a data set?) Rather than
2009 Mar 14
1
Problem with figure size when embedding fonts
Dear Colleagues: I need to make a graphic that uses the Nimbus rather than Helvetica font family so that the font can be embedded in the encapsulated postscript file. This is to satisfy a requirement from a journal for electronic submission of figures. I do the following: postscript('lowess.eps', onefile=FALSE, pointsize=18, horizontal=FALSE, family='NimbusSan')
2008 Apr 22
2
nth step transition matrices
Hello, I have a question in regards to markov chains and transition probabilities. I am trying to figure out a way to calculate the "kth-step transition matrix" of a given matrix. Say for example I have a single step 2x2 matrix: 1 2 P= 1 .95 .05 2 .01. 99 If I were to convert this matrix to a 2-step transition probability matrix I would get:
2008 Aug 05
2
95% CI bands on a Lowess smoother
Hi there, I'm plotting some glass RI values just by plotting plot(x) then I put on my lowess smoother lines(lowess(x)) now I want to put on some 95% Confidence Interval bands of the lowess smoother, but don't know how?? Thanks -- Gareth Campbell PhD Candidate The University of Auckland P +649 815 3670 M +6421 256 3511 E gareth.campbell@esr.cri.nz gcam032@gmail.com [[alternative
2001 May 23
3
New generic functions in "R base" {was `truncate'}
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---2088752589-1867062326-990643072=:2129 Content-Type: TEXT/PLAIN; charset=US-ASCII 1) What are the issues with making _existing_ functions in base into generics? EG, I've recently