[R] Structuring data for Correspondence Analysis

jim holtman jho|tm@n @end|ng |rom gm@||@com
Fri Mar 29 22:29:29 CET 2019


I am not familiar with SAS, so what did you want your output to look like.
There is the 'table' function that might do the job and then there is
always 'dplyr' which can do the hard stuff.  So we need more information on
what you want.

Jim Holtman
*Data Munger Guru*


*What is the problem that you are trying to solve?Tell me what you want to
do, not how you want to do it.*


On Fri, Mar 29, 2019 at 6:35 AM Alfredo <alfredo.roccato using fastwebnet.it>
wrote:

> Hi, I am very new to r and need help from you to do a correspondence
> analysis because I don't know how to structure the following data:
>
> Thank you.
>
> Alfredo
>
>
>
> library(ca,lib.loc=folder)
>
> table <- read.csv(file="C:\\Temp\\Survey_Data.csv", header=TRUE, sep=",")
>
> head (table, n=20)
>
>                 Preference   Sex        Age   Time
>
> 1           News/Info/Talk     M      25-30  06-09
>
> 2                Classical     F      >35    09-12
>
> 3          Rock and Top 40     F      21-25  12-13
>
> 4                     Jazz     M      >35    13-16
>
> 5           News/Info/Talk     F      25-30  16-18
>
> 6             Don't listen     F      30-35  18-20
>
> ...
>
> 19         Rock and Top 40     M      25-30  16-18
>
> 20          Easy Listening     F      >35    18-20
>
>
>
> In SAS I would simply do this:
>
> proc corresp data=table dim=2 outc=_coord;
>
>    table Preference, Sex Age Time;
>
> run;
>
>
>
> I don't know how convert in R a data frame to a frequency table to execute
> properly this function:
>
> ca <- ca(<frequency table>, graph=FALSE)
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list