Tuesday, June 11, 2013

Calculating ECDFS using R



        # store this current column to a variable
        pcs <-rsm[[colnam]]

#-- additional implementation
#        pcs2 <- pcs[!duplicated(pcs)]
#        pcs <- pcs2

#        pcs3 <- pcs[ pcs != 0 ]
#        pcs <- pcs3

#--
     # sort the data and store the sorted value to a new variable
        sortpcs <- sort(pcs)

        # calculate the CDF score based on the number of rows
        ecdfpcs <- (1:length(sortpcs))/length(sortpcs)

        # create a data frame from the data
        svrCdf <- data.frame(sortpcs,ecdfpcs)

#-- additonal implementaion
        stop("Message")
        warning("Message")
#--

# hard code the specific directory
        dir <- "c:/amadriaga/a_r"
        setwd(dir)
        dir <- getwd()
        print(dir)
        svrCdfCsvFile <- sprintf("%s/ecdfs_%s_norm.csv",dir,colnam)
        write.csv(svrCdf, file=svrCdfCsvFile, row.names=FALSE)
        print("Successfully completed R script.")



2 comments:

  1. i feel a have good knowledge about Linux and java programming.. aah i am a b.tech student and really like you blog because of your good knowledge ..keep working dude ..
    and thank you so much..

    ReplyDelete