Re: [R] SAS to R migration questions

2004-09-12 Thread Fernando Henrique Ferraz P. da Rosa
Fernando Henrique Ferraz P. da Rosa writes: > cust <- c(111,111,112) > cc <- data.frame(t(sapply(unique(cust),function(level,vec) { > c(custid=level,freq=sum(vec==level)) },cust))) > cc[order(cc$freq,decreasing=T),] An even simpler solution: cc <- data.frame(table(cust))

Re: [R] SAS to R migration questions

2004-09-12 Thread Fernando Henrique Ferraz P. da Rosa
Matthew Wilson writes: > (...) > Step 3: > > I print a list of number of sales per customer ID, ranking the customer > IDs from most to least. I use a SAS proc freq step for this: > > proc freq data=d2 order=freq; > tables custid; > run; > > and the output would look like this:

Re: [R] SAS to R migration questions

2004-09-12 Thread Spencer Graves
I copied your data into Excel and saved it as *.txt. From within R, the following commands produced for me the result cited in your email below: salesData <- read.table("R-qn.txt", header=TRUE, sep="\t", as.is=TRUE) sapply(salesData, class)# check class of columns o

[R] SAS to R migration questions

2004-09-11 Thread Matthew Wilson
Hi, I'd like to get away from SAS, but I don't really know R well enough at this point to know if it would be good for this project. I tried to describe the essence of the project below without getting bogged down in details. It starts when I receive a data flat file. There's lots of columns,