Dear R experts,
I'm using the adehabitatHR package in order to perform a kernel analysis and
estimate the home range of my input data (GPS relocations of 42
individuals).
I've done the analysis for one of the individuals and it worked perfectly
(see code below).
But now I'm trying to use a list a
Thank you very much Michael and Berend for your ideas and feddback.
I apologize for my mistakes. It's true that I still have much to learn (and
I sometimes forget what I read). I'll surely use the dput() command next
time I post something and I'll try to be more clear with my questions too.
Be
Hello all,
I'm trying to group several consecutives rows (and assigning them the same
value) while leaving some of the rows empty (when a certain condition is not
fulfilled).
My data are locations (xy coordinates), the date/time at which they were
measured, and the time span between measures. Some
Hi again,
I just realized that in this solution there is something funny on the
position the values in the matrix, they don't really correspond to the
position indicated in the subscripts... However, David Winsemius has given a
valid solution.
Thank you for all your ideas!
--
View this message i
Problem solved.
Many many thanks for your ideas!!
(this site is very stimulant) :)
--
View this message in context:
http://r.789695.n4.nabble.com/built-a-lower-triangular-matrix-from-dataframe-tp4390813p4393619.html
Sent from the R help mailing list archive at Nabble.com.
_
Hi Rui,
Thank you very much for your idea. It works!!!
I converted my dataframe into a vector (I first removed the header and the
first and second column) and then tried your solution:
> data <- as.vector(as.matrix(read.table(file="data.txt", head=F,
> sep="\t")[-c(1,2)]))
> data
[1] 5.2 9.1 8.
Hi Michael,
Your answer was very interesting, thank you!
However, I tried it and the result was:
> df <- read.table(file="df.txt", head=T, sep="\t")
> df
i j k
1 1 2 5.2
2 1 3 9.1
3 1 4 8.0
4 1 5 2.3
5 1 6 8.4
6 2 3 6.6
7 2 4 7.4
8 2 5 7.1
9 2 6 5.5
10 3 4 4.1
11 3 5 3.9
12 3 6 9.2
1
Hi David,
What an good solution. It works perfectly and it's really simple.
(I only removed the "1+" in ncol=1+max(j), it already has 6 columns)
My result has been:
> df <- read.table(file="df.txt", head=T, sep="\t")
> df
i j k
1 1 2 5.2
2 1 3 9.1
3 1 4 8.0
4 1 5 2.3
5 1 6 8.4
6 2 3 6
Sorry, I just realized that it's not a lower triangualr matrix, but an upper
triangular matrix!
But still the solution/s should be rather similar in both cases.
http://r.789695.n4.nabble.com/file/n4391127/matrix2.png
I apologize for creating confusion...
Nymphita
--
View this messa
Hi Tsjerk!
Thanks for your quick reply!
It's a nice way to built a lower triangular matrix with zeros in the
diagonal, but what I can't work out is *how to include the values of the
third column of the dataframe inside the matrix*.
I just realized that I forgot to explain something about the data
Hello!
I'm trying to build a lower triangular matrix (with zeros in the diagonal)
from a particular dataframe.
The matrix I have to construct has 203 rows and 203 columns and that makes
20503 values to be included within (that's why I can't do it manually).
To illustrate the dataframe I have, I
11 matches
Mail list logo