[R] Apply() on columns

R. Michael Weylandt michael.weylandt at gmail.com
Fri Jun 15 15:14:21 CEST 2012


Just to take a stab at it, I'd suggest you don't actually need apply()
and could simply get what you need with

hist(DATA[,4:6])

if your data is as described.

Michael

On Fri, Jun 15, 2012 at 7:23 AM, Jean V Adams <jvadams at usgs.gov> wrote:
> Frans,
>
> I'm not sure I understand what you're after.
>
> I suggest that you share a small example data set, using dput().
> Then give an example of what you want the output to look like.
>
> Jean
>
>
> faelsendoorn <f.a.elsendoorn at gmail.com> wrote on 06/15/2012 03:09:41 AM:
>
>> Hi,
>>
>> I have some trouble with the following: I have a table of 7 rows and
>> 6columns. The columns 1,2,3 have information about the number of
> employees.
>> The columns 4,5,6 have information about the number of working hours.
> Each
>> row, is corresponding with a week.
>> My goal is to make a boxplot, histogram etc. of the columns 4, 5 and 6
>> (thus, the data of the number of working hours). How can I select by
> using
>> the function Apply the weeks i needed for fullfulling my goal?
>>
>> I already tried something with environment variables but that is a hard
>> stop.  I think, when I can select the columns I wanted with the
>> corresponding rows, that it would not be a problem making a histogram
> etc.
>>
>> Yours,
>>
>> Frans Elsendoorn
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list