Please keep the conversation on the list: Others may be able to help you better than I can.

On 2017-07-06 10:38, SEB140004 Student wrote:
Ya. I had successfully got the result. Thank you very much. :)

Isn't possible for me to obtain the network from the correlation matrix?

I know nothing about correlation networks, but by googling I found two R packages, ggraph and corrr, that may be of interest to you.

Göran

On Thu, Jul 6, 2017 at 1:38 AM, Göran Broström <goran.brost...@umu.se <mailto:goran.brost...@umu.se>> wrote:

    On 2017-07-05 11:56, Jim Lemon wrote:

        Hi Chin Yi,
        If you are trying to correlate "Health" with "Disease", i.e.

        cydf<-read.table(text="OTU ID Health Disease
            Bacterial 1 0.29 0.34
            Bacterial 2 0.25 0.07
            Bacterial 3 0.06 0.06
            Bacterial 4 0.07 0.09
            Bacterial 5 0.02 0.05",
            header=TRUE)
        print(cor(cydf$Health,cydf$Disease))
        [1] 0.7103517

        If you are getting that error, it probably means that either
        "Health"
        or "Disease" or perhaps both have been read in as a factor. To test
        this:

        is.factor(cydf$Health)
        [1] FALSE

            is.factor(cydf$Disease)

        [1] FALSE

        If either of these returns TRUE, that is almost certainly the
        problem.


    Or maybe Chin Yi tried (as it seems)

     > cor(cydf)
    Error in cor(cydf) : 'x' must be numeric

    (with cydf == data): 'OTU' is not numeric.

    Follow Jim's advice.

    Göran



        Jim


        On Wed, Jul 5, 2017 at 11:27 AM, SEB140004 Student
        <chi...@siswa.um.edu.my <mailto:chi...@siswa.um.edu.my>> wrote:

            Greeting.

            Dear Mr/Mrs/Miss,

            OTU ID Health Disease
            Bacterial 1 0.29 0.34
            Bacterial 2 0.25 0.07
            Bacterial 3 0.06 0.06
            Bacterial 4 0.07 0.09
            Bacterial 5 0.02 0.05
            Above show the first 6 data sets, may I ask that the reason
            of R show the
            error like "Error in cor(data) : 'x' must be numeric" ? And
            how to solve
            it? Besides, isn't this data can conduct correlation matrix?

            Moreover, isn't this data sets can be plot into network? If
            can, which
            package should I use?

            Thank you.

            Best regards,
            Kang Chin Yi

                      [[alternative HTML version deleted]]

            ______________________________________________
            R-help@r-project.org <mailto:R-help@r-project.org> mailing
            list -- To UNSUBSCRIBE and more, see
            https://stat.ethz.ch/mailman/listinfo/r-help
            <https://stat.ethz.ch/mailman/listinfo/r-help>
            PLEASE do read the posting guide
            http://www.R-project.org/posting-guide.html
            <http://www.R-project.org/posting-guide.html>
            and provide commented, minimal, self-contained, reproducible
            code.


        ______________________________________________
        R-help@r-project.org <mailto:R-help@r-project.org> mailing list
        -- To UNSUBSCRIBE and more, see
        https://stat.ethz.ch/mailman/listinfo/r-help
        <https://stat.ethz.ch/mailman/listinfo/r-help>
        PLEASE do read the posting guide
        http://www.R-project.org/posting-guide.html
        <http://www.R-project.org/posting-guide.html>
        and provide commented, minimal, self-contained, reproducible code.



______________________________________________
R-help@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.

Reply via email to