Re: [R] computing a subset using a loop
Hi, thanks I think now I understand how it works... I m using now this code for the first specie in all my transect IDs. df.s - split(Baumdaten, list(Baumdaten$transectID, Baumdaten$Baumart), drop = TRUE) head(names(df.s), 10) A_SEF_Abies alba A_LEF_Abies alba B_SEF_Abies alba B_LEF_Abies alba C_SEF_Abies alba C_LEF_Abies alba D_SEF_Abies alba D_LEF_Abies alba E_SEF_Abies alba E_LEF_Abies alba But can you tell me how, I can make subsets out of one of the subsets. For example I want boxplot for the variable age. Is it something like this? It dosent work, I know... lapply(df.s,boxplot(A_SEF_Abies alba$Baumart)) Thanks in advanced -- View this message in context: http://r.789695.n4.nabble.com/computing-a-subset-using-a-loop-tp4636564p4636653.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] computing a subset using a loop
Dear all, I have a data frame with different variables and I want to build different subsets out of this data frame using some conditions and I want to use a loop because there will be a lot of subsets and this would be saving a lot of time. I try to give you an overview about my data frame. I have a data frame named Baumdaten and it has one column named transectID with different IDs (A_SEF ,A_LEF, B_SEF etc.) there is another column named Baumart with different species like Abies alba, Betula pendula, etc. I want to build now subsets and the first subset should be named A_2_SEF_Abies_alba and should contain all Abies alba that are living in A_2_SEF. So the normal code would be A_2_SEF_Abies_alba-subset(Baumdaten,Baumart==Abies albapointID==A_2_SEF) The following step would be to replace Abies alba with Betula pendula and so on after doing this for A_SEF I have to start with A_LEF so a lot of time is needing thats why I want to ask if it is possible doing this by using a loop? Hope you can understand my problem... -- View this message in context: http://r.789695.n4.nabble.com/computing-a-subset-using-a-loop-tp4636564.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] computing a subset using a loop
http://r.789695.n4.nabble.com/file/n4636585/Baumdaten_aufbereitet.csv Baumdaten_aufbereitet.csv Here you have an overview about my data frame... -- View this message in context: http://r.789695.n4.nabble.com/computing-a-subset-using-a-loop-tp4636564p4636585.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] computing a subset using a loop
Hi, thanks for your reply but this code just gives me a list but no subsets but I need subsets because I want to do some calculations with these subsets and want do make some plots etc. Is there a solution for my problem? I ve posted an example for the first subset... http://r.789695.n4.nabble.com/file/n4636591/A_SEF_Abies_alba.csv A_SEF_Abies_alba.csv -- View this message in context: http://r.789695.n4.nabble.com/computing-a-subset-using-a-loop-tp4636564p4636591.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.