Im using R to analyze data, but i keep getting an error when I use the \"library
ID: 3836821 • Letter: I
Question
Im using R to analyze data, but i keep getting an error when I use the "library(rsm)
rsm2k<-rsm(yij~FO(A,B)+TWI(A,B),data=prb612)
summary(rsm2k)" and getting this error "Error in fo[, i] * fo[, j] : non-numeric argument to binary operator"
here is my data from a text file that i import, ive been told that it is not entered correctly but im sure this is how it was done in class. Any help would be nice!
A B yij
- - 14.037
+ - 13.880
- + 14.821
+ + 14.888
- - 16.165
+ - 13.860
- + 14.757
+ + 14.921
- - 13.972
+ - 14.032
- + 14.843
+ + 14.415
- - 13.907
+ - 13.914
- + 14.878
+ + 14.932
Explanation / Answer
class tel
{
private static String name;
private static String address;
private static int phoneNo;
private tel next;
private tel prev;
open tel(){
}
open tel(String name1,String address1 ,int phoneNo1)
{
name = name1 ;
address = address1;
phoneNo = phoneNo1;
}
open static String getName() {
return name;
}
open void setName(String name1) {
name = name1;
}
open static String getAddress() {
return address;
}
open void setAddress(String address1) {
address = address1;
}
open static int getPhoneNo() {
return phoneNo;
}
open void setPhoneNo(int phoneNo1) {
phoneNo = phoneNo1;
}
open tel getNext() {
return next;
}
open void setNext(tel next1) {
next = next1;
}
open tel getPrev() {
return prev;
}
open void setPrev(tel prev1) {
prev = prev1;
}
open void show()
{
System.out.println("Name : " + getName() + " PhoneNo : " + getPhoneNo() + " Address : " + getAddress());
}
}
/ - - - - - - - -
/2ed class
open class telList {
private tel first;
private tel last;
private tel mongrel ;
open telList()
{
in the first place = invalid ;
last = invalid ;
}
open boolean isEmpty()
{return first == invalid; }
open tel getCur() {
return mongrel;
}
open void setCur(tel cur1) {
mongrel = cur1;
}
open void insert(String na,String addr ,int pho)
{
tel newtel = new tel(na,addr,pho);
in the event that (isEmpty())
{
last = newtel;
in the first place = newtel;
}
else
{
newtel.setNext(first);
first.setPrev(newtel);
initially = newtel;
}
}
///
open tel search(String Key)
{
tel dog = first;
while(cur.getName() != Key)
{
if(cur.getNext()== invalid)
return invalid;
else
dog = cur.getNext();
}
return dog;
}
open void displaythelist()
{
tel dog = first;
while(cur != invalid)
{
System.out.println(cur.display());
dog = cur.getNext();
}
System.out.println(" ");
}
}
/3ed class
/ - - - - - - - -
import java.io.*;
import java.util.*;
open class telTest {
open static void main(String[] args)throws Exception {
Scanner input = new Scanner(System.in);
boolean quit = false;
do {
int menu = 0;
System.out.println("******************************");
System.out.println("Telephone Directory");
System.out.println();
System.out.println("1. Acknowledge Data");
System.out.println("2. Seek");
System.out.println("3. Rundown of all people");
System.out.println("4. Exit");
System.out.print("Please enter your decision: ");
menu = input.nextInt();
System.out.println();
tel t = new tel();
telList t1 = new telList();
switch (menu) {
case 1:
System.out.print("Enter Name: ");
String name = input.next();
t.setName(name);
System.out.print("Enter Address: ");
String address = input.next();
t.setAddress(address);
System.out.print("Enter Phone No: ");
int no = input.nextInt();
t.setPhoneNo(no);
t1. insert(t.getName(),t.getAddress(),t.getPhoneNo());
break ;
/...........................................................................
case 2:
System.out.print("Enter name to hunt data: ");
String n = input.next();
attempt {
t1.search(t.getName());
}
get (Exception e) {
}
break;
/...........................................................................
case 3://list
attempt {
t1.displaythelist();
}
get (Exception e) {
}
break;
/...........................................................................
case 4 ://exit
stopped = genuine;
break;
/...........................................................................
default:
System.out.println("Invalid Entry!");
}
}while (!quit);
}
}