0

I have 4 vectors of different length. I want to know what is the name of approach to make them same length but keep the "shape" of the data the same. Similar what you see on the plot, but to change the data to have same length.

What I mean by "shape" that if I plot it after applying it, it is going to look the same as it was before but (length)/(number of points)/(X-axis) will be equal.

Something like a zoom projection for data.

R code here: http://www.r-fiddle.org/#/fiddle?id=fmbMXgY3&version=1

image of plots

mike19851
  • 11
  • 2
  • You want to normalize your data? https://www.quora.com/What-are-the-best-normalization-techniques-in-data-mining – Gabriel Mesquita Oct 24 '17 at 13:36
  • Kind of normalize Y but by X. Normalize usually done separately to X and Y. That's why I'm asking what the name of approach. *I'm referring X as length. – mike19851 Oct 24 '17 at 13:42
  • 1
    It would help if you shared a concrete example - some x and y values. Maybe "interpolation" is what you want? "Upample", "downsample"? The way you use `length` makes it sound like you want to change the number of points. But it's confusing when you say *"length's(X-axis)"* because for any one line the number of X values must be equal to the number of Y values - it doesn't make sense to talk about length as only applying to the x-axis. So maybe you want to rescale the x-axis but have the same number of points as before? – Gregor Thomas Oct 24 '17 at 13:55
  • 1
    A small example with sample input and corresponding desired output would make this much clearer. [See this guide for making reproducible example in R](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), simulation or `dput()` are good for making data copy/pasteable, and copy/pasteable examples get help very quickly. – Gregor Thomas Oct 24 '17 at 13:59
  • Here is R code: http://www.r-fiddle.org/#/fiddle?id=fmbMXgY3&version=1 as you can see length of (a,b,c,d) is different, so I want them to have same length and look the same after that. – mike19851 Oct 24 '17 at 14:03
  • 1
    I think as @Gregor said, what you want is interpolation. There are quite a few functions that can do this. – Balter Oct 24 '17 at 14:06
  • Sorry if I confused with length. Basically I want same visual shape and align the length(number of y values) for example to 300. – mike19851 Oct 24 '17 at 14:10
  • Yes, thanks, interpolation did a trick! Thanks to all! – mike19851 Oct 24 '17 at 15:10

0 Answers0