[R] select value from a column depending on a value in another column
Hi everybody I couldn't find the solution to what must be quite a simple problem. Maybe you can help? treatment session period stage wage_accepted market 1 11 11 25 public 2 11 11 19 privat 3 11 11 15 public 4 11 12 32 public 5 11 12 13 privat >From this table, I'd like to choose only those values in the column "wage_accepted" that have the value "public" in the column "market". How can I do this? Is there a good general help site for R that would explain basic table manipulations such as this? Thank you very much for your help -- View this message in context: http://r.789695.n4.nabble.com/select-value-from-a-column-depending-on-a-value-in-another-column-tp3494926p3494926.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] editor: not possible to change the variable name
Hi again everybody I have I new problem concerning the editor of R. It is possible to add a new variable column, but they all have the name "var1".I read somewhere that it should be possible to change the variable name by clicking on it, but that doesn't work. Is that a bug or how is it possible to change the variable header? Many thanks Matthias -- View this message in context: http://r.789695.n4.nabble.com/editor-not-possible-to-change-the-variable-name-tp3503864p3503864.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] how to calculate the mean of a group in a table
Hi its me again I don't mean to get on your nerves, but the use of R proofs to be a bit more complicated than envisaged. I would like to calculate the mean of a group of values, here "wage_accepted". The group is determined by the stage and period, so in the end there should be a column with the values of the wages in period 1 stage1, period 1 stage 2, period 2 stage1... Unfortunately, I haven't much of a clue on how to program this. Could you tell me how the function should roughly look like – if-else, loops included or not – in the end ? treatment session period stage wage_accepted type 1 1 1 1 125 low 2 1 1 1 119 low 3 1 1 1 115 low 4 1 1 1 232 high 5 1 1 1 213 low 6 1 1 1 214 low 7 1 1 2 117 low 8 1 1 2 112 low I am also very grateful if someone could point out a good internet tutorial resource for R functions such as if-else and loops and how to use them in conjunction with tables. It should contain simple examples if possible. As ever indepted to you, Matthias -- View this message in context: http://r.789695.n4.nabble.com/how-to-calculate-the-mean-of-a-group-in-a-table-tp3505986p3505986.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] how to calculate the mean of a group in a table
Just wanted to thank everybody here for their great help. I tried the "tapply" and it worked brilliantly. By changing its parameters I can easily compute the values for the other treatments as well. Without help, I probably would just have despaired. Have a great time mat -- View this message in context: http://r.789695.n4.nabble.com/how-to-calculate-the-mean-of-a-group-in-a-table-tp3505986p3512145.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.