[R] Compare two 3d plots

2010-09-27 Thread Ab Hu
Hi, I am still learning and find it very helpful in my research. I have searched before posting this and could not figure out if there is a way to compare matrices the way i am describing below: I have a matrix of 64 cols and 64 rows which mostly has lots of zeros but has other non-zero posit

Re: [R] Compare two 3d plots

2010-09-28 Thread Ab Hu
I'll check that book out and/or get help from the authors. But i was still hoping there is some basic way to compare these 3d plots using R. By the way, I figured out i can draw these plots using command "image" and get a gradient heat map or topography map with gradients. Is there a function in

[R] readBin which has two different sizes

2010-10-03 Thread Ab Hu
Hi, I have a binary file which has the following structure: 1) Some header in the beginning 2) Thousands of 216-byte data sub-grouped into 4 54-byte data structured as 4-byte time stamp (big endian) followed by 50 1-byte (8-bit) samples. So far this is how I am trying: #Open a connection for bina

Re: [R] readBin which has two different sizes

2010-10-03 Thread Ab Hu
Thanks! I'll give that a try. -- View this message in context: http://r.789695.n4.nabble.com/readBin-which-has-two-different-sizes-tp2953365p2953619.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list ht

Re: [R] readBin which has two different sizes

2010-10-03 Thread Ab Hu
Henrik Bengtsson wrote: > > > 1. Use x <- readBin(..., what="raw", n=35269*(54*4)) to read your raw > ("byte") data. > 2. Turn it into a 54x4x35269 array, e.g. dim(x) <- c(54,4,35269). > 3. Extract the 4-byte time stamps by yT <- x[1:4,,,drop=FALSE]; This > is of type "raw". Use readBin() to

[R] Centre of gravity of a mountain

2010-11-08 Thread Ab Hu
Hi all, I have a matrix of a mountain of form 21x21 and values in them are height (Z). Using the persp function I can view this mountain in 3D. Now, I am trying to find a measure to find the centre of gravity (maybe centroid?) of this mountain. Any idea what would be the best way to go? -- View

Re: [R] Centre of gravity of a mountain

2010-11-08 Thread Ab Hu
Thanks! Works great. I have more questions on this, so I'll continue here: Now that I have the weighted mean, is it possible to reduce the size of mountain based on this weighted mean such the original matrix remains 21x21 while the mountain shrinks/converges. Step for my analysis: 1) Find cent

Re: [R] Centre of gravity of a mountain

2010-11-09 Thread Ab Hu
Peter Langfelder wrote: > > Sorry, I'm not sure what you want to do in points 2-4. Shrink the > mountain vertically or horizontally? You can for example look up image > resizing algorithms if you want to shrink the area under the mountain > but keep the shape of the mountain (approximately) the