paran package - error message

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

paran package - error message

Lee, Deborah
I am trying to using the "paran" package in R for Horn's parallel analysis. According to the "paran" manual, the highlighted yellow ought to be a numerical matrix or data frame. It looks like this should be the file name. Is there something that I need to do

install.packages("paran")
library(paran)

IS<- read.table ("C:/Users/Deborah Lee/Documents/R/IS.csv")
paran(IS, cfa=TRUE, graph=TRUE, color=TRUE, col=c("black", "red", "blue"))

When I run the code above, I get the error message below.
in cor(x) : 'x' must be numeric

How do I set up my data (csv) file itself to make this a numerical matrix? (FYI: row 1 for headers for variables names).

Thank you for your help.


Deborah D. Lee, PhD
Associate Director of Student Affairs Research and Assessment
The Pennsylvania State University

105 White Building
University Park, PA 16802
(814) 863-9609


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: paran package - error message

PIKAL Petr
Hi

IS is data frame so it is not numeric.

try str(IS) to see structure of your data.
maybe just

mat.IS <- as.matrix(IS)

gives you desired result, but it depends on (undisclosed) IS structure

BTW, do not use html formatting, it is useless in this list

BTW2, you should spend at least few minutes to read basic docs, kindly
offered by R-core in doc directory, especially R-intro which gives you quick
info about objects and their properties.

BTW3, your read.table is lacking header and sep and maybe dec specification
so I doubt it reads your data properly.

Cheers
Petr

> -----Original Message-----
> From: R-help <[hidden email]> On Behalf Of Lee, Deborah
> Sent: Monday, August 24, 2020 12:52 PM
> To: [hidden email]
> Subject: [R] paran package - error message
>
> I am trying to using the "paran" package in R for Horn's parallel
analysis.
> According to the "paran" manual, the highlighted yellow ought to be a
> numerical matrix or data frame. It looks like this should be the file
name. Is

> there something that I need to do
>
> install.packages("paran")
> library(paran)
>
> IS<- read.table ("C:/Users/Deborah Lee/Documents/R/IS.csv") paran(IS,
> cfa=TRUE, graph=TRUE, color=TRUE, col=c("black", "red", "blue"))
>
> When I run the code above, I get the error message below.
> in cor(x) : 'x' must be numeric
>
> How do I set up my data (csv) file itself to make this a numerical matrix?
(FYI:

> row 1 for headers for variables names).
>
> Thank you for your help.
>
>
> Deborah D. Lee, PhD
> Associate Director of Student Affairs Research and Assessment The
> Pennsylvania State University
>
> 105 White Building
> University Park, PA 16802
> (814) 863-9609
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: paran package - error message

Lee, Deborah
Thank you very much. I appreciate your help!

Deborah D. Lee, PhD
Associate Director of Student Affairs Research and Assessment
The Pennsylvania State University

105 White Building
University Park, PA 16802
(814) 863-9609

-----Original Message-----
From: PIKAL Petr <[hidden email]>
Sent: Wednesday, August 26, 2020 4:01 AM
To: Lee, Deborah <[hidden email]>; [hidden email]
Subject: RE: paran package - error message

Hi

IS is data frame so it is not numeric.

try str(IS) to see structure of your data.
maybe just

mat.IS <- as.matrix(IS)

gives you desired result, but it depends on (undisclosed) IS structure

BTW, do not use html formatting, it is useless in this list

BTW2, you should spend at least few minutes to read basic docs, kindly
offered by R-core in doc directory, especially R-intro which gives you quick
info about objects and their properties.

BTW3, your read.table is lacking header and sep and maybe dec specification
so I doubt it reads your data properly.

Cheers
Petr

> -----Original Message-----
> From: R-help <[hidden email]> On Behalf Of Lee, Deborah
> Sent: Monday, August 24, 2020 12:52 PM
> To: [hidden email]
> Subject: [R] paran package - error message
>
> I am trying to using the "paran" package in R for Horn's parallel
analysis.
> According to the "paran" manual, the highlighted yellow ought to be a
> numerical matrix or data frame. It looks like this should be the file
name. Is

> there something that I need to do
>
> install.packages("paran")
> library(paran)
>
> IS<- read.table ("C:/Users/Deborah Lee/Documents/R/IS.csv") paran(IS,
> cfa=TRUE, graph=TRUE, color=TRUE, col=c("black", "red", "blue"))
>
> When I run the code above, I get the error message below.
> in cor(x) : 'x' must be numeric
>
> How do I set up my data (csv) file itself to make this a numerical matrix?
(FYI:

> row 1 for headers for variables names).
>
> Thank you for your help.
>
>
> Deborah D. Lee, PhD
> Associate Director of Student Affairs Research and Assessment The
> Pennsylvania State University
>
> 105 White Building
> University Park, PA 16802
> (814) 863-9609
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: paran package - error message

Rui Barradas
In reply to this post by PIKAL Petr
Hello,

Inline.

Às 09:00 de 26/08/20, PIKAL Petr escreveu:

> Hi
>
> IS is data frame so it is not numeric.
>
> try str(IS) to see structure of your data.
> maybe just
>
> mat.IS <- as.matrix(IS)
>
> gives you desired result, but it depends on (undisclosed) IS structure
>
> BTW, do not use html formatting, it is useless in this list
>
> BTW2, you should spend at least few minutes to read basic docs, kindly
> offered by R-core in doc directory, especially R-intro which gives you quick
> info about objects and their properties.
>
> BTW3, your read.table is lacking header and sep and maybe dec specification
> so I doubt it reads your data properly.

Since the file is a csv file (or at least its extension is) read.csv
should solve those issues.

To the OP: read.csv is a way to call read.table but deliberately made
inflexible. It sets some arguments to values other than their defaults,
including

header = TRUE
sep = ","
fill = TRUE

The default dec = "," is the same. If you are reading files coming from
countries like mine where the decimal separator is a comma read.csv2
sets the values sep = ";" and dec = ",".

Read help("read.csv"), the difference from read.table is well explained.


Hope this helps,

Rui Barradas

>
> Cheers
> Petr
>
>> -----Original Message-----
>> From: R-help <[hidden email]> On Behalf Of Lee, Deborah
>> Sent: Monday, August 24, 2020 12:52 PM
>> To: [hidden email]
>> Subject: [R] paran package - error message
>>
>> I am trying to using the "paran" package in R for Horn's parallel
> analysis.
>> According to the "paran" manual, the highlighted yellow ought to be a
>> numerical matrix or data frame. It looks like this should be the file
> name. Is
>> there something that I need to do
>>
>> install.packages("paran")
>> library(paran)
>>
>> IS<- read.table ("C:/Users/Deborah Lee/Documents/R/IS.csv") paran(IS,
>> cfa=TRUE, graph=TRUE, color=TRUE, col=c("black", "red", "blue"))
>>
>> When I run the code above, I get the error message below.
>> in cor(x) : 'x' must be numeric
>>
>> How do I set up my data (csv) file itself to make this a numerical matrix?
> (FYI:
>> row 1 for headers for variables names).
>>
>> Thank you for your help.
>>
>>
>> Deborah D. Lee, PhD
>> Associate Director of Student Affairs Research and Assessment The
>> Pennsylvania State University
>>
>> 105 White Building
>> University Park, PA 16802
>> (814) 863-9609
>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] 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.
>>
>> ______________________________________________
>> [hidden email] 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.

______________________________________________
[hidden email] 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.