How to request an input from the user through keyboard and monitor?
In R, there are a series of functions that can be used to request an input from the user,
including readline(), cat(), and scan(). But, I find the readline() function to be the optimal function for this task.
How to read data from the keyboard?
To read the data from keyboard we use three different functions:
scan()
readline()
print()
How many ways are there to read and write files?
There are three ways to read and write files respectively:
Reading a data or matrix from a file
Reading a single File One Line at a Time
Writing a Table to a File
Explain how to read data or a matrix from a file?
a) Usually we use function read.table() to read data. The default value of a header is ‘FALSE’ and hence when we do not have a header, we need not say such. , R factors are also called as character strings. For turning this “feature” off, you can include the argument as.is=T in your call to read.table().
b) When you have a spreadsheet export file, i.e. having a type.csv where the fields are divided by commas in place of spaces, use read.csv() in place of read.table(). To read spreadsheet files we can use read.xls.
c) When you read in a matrix using read.table(), the resultant object will become a data frame, even when all the entries got to be numeric. A case exists which may followup call towards as.matrix() in a matrix. We need to read it into a matrix form like this
> x <- matrix(scan(“x”),nrow=5,byrow=T)
What are Sockets in R?
Sockets provide two networked machines with a bidirectional communication channel. Servers are accessed via socket addresses, a combination of the server's IP address and a port number. We use the port as a connection point on the server, like USB or Firewire ports, with each port serving a specific purpose.
For example:
Web pages are served on port 80 (HTTP), emails are sent via port 25 (SMTP).
Usage
make.socket(host = "localhost", port, fail = TRUE, server = FALSE)
Arguments
host name of remote host
port port to connect to/listen on
fail failure to connect is an error?
Server a server socket?
What is protocol?
A protocol is a set of rules and procedures. It means what format to use, what data mean, when should data be sent. When two computers exchange data, they can understand each other if both follow specific format and rules in a protocol. It is a set of rules and procedures and computers. It is been used to communicate.
What does TCP/IP work?
TCP/IP protocols map to a four-layer conceptual model known as the DARPA model. The four layers of the DARPA model are Application, Transport, Internet, and Network Interface.
Explain TCP/IP applications, services and protocols?
Bootstrap protocol – Bootstrap Protocol (BOOTP) provides a dynamic method for associating workstations with servers. It is a method which also provides a dynamic method for assigning workstation Internet Protocol (IP) addresses and initial program load (IPL) sources.
Domain name system – We use Domain Name System (DNS) to manage host names and their associated Internet Protocol (IP).
Email – Use this information to plan for, configure, use, manage, and troubleshoot e-mail on your system.
Open shortest path first search – IBM I support includes the Open Shortest Path First (OSPF) protocol. OSPF is a link-state, hierarchical Interior Gateway Protocol (IGP) for network routing.
RouteD – The Route Daemon (RouteD) provides support for the Routing Information Protocol (RIP) on the IBM platform.
Simple network time protocol – It is a time-maintenance application that we can use to synchronize hardware in a network.
What is TCP/IP variable SMC-R storage allocations?
Each more RMB that is been allocated for a particular SMC-R link group can accommodate 4 – 32
more TCP connections, depending on the RCVBFRSIZE value of the TCP connections.
More staging buffers are allocated as the volume of application data that is been sent increases.
RMBs, staging buffers, and RDMA receive and send elements are all eligible to be deallocated if the volume of application traffic decreases.
What is debugging in R?
A grammatically correct program may give us incorrect results due to logic errors. In case such errors (i.e. bugs) occur, we need to find out why and where they occur so that you can fix them. The procedure to identify and fix bugs is called “debugging”.
What are tools for debugging in R?
There are five toos present for debugging in R respectively:
traceback()
debug()
browser()
trace()
recover()
What are connections In R?
Functions to Manipulate Connections (Files, URLs, …). Functions to create, open and close connections.
For example: “generalized files”, such as compressed files, URLs, pipes, etc.
Keywords
file, connection
Explain an Extended example of connections?
Extended Example: Reading PUMS sample files
These files contain records for a sample of housing units with information on the characteristics of each unit.
Why use PUMS?
PUMS files provide greater accessibility to inexpensive data for research projects. Thus it is beneficial for students as they are looking for greater accessibility to inexpensive data. Social scientists often use the PUMS for regression analysis and modeling applications.
How can I access PUMS?
Statistical software is the tool used to work with PUMS files.
Which function is used to write files?
We use write.csv() to write files.
Explain how to write files?
We use write.csv() to write file. By default, write.csv() includes row names.
# A sample data frame
data <- read.table(header=TRUE, text='
subject sex size
1 M 7
2 F NA
3 F 9
4 M 11
')
# Write to a file, suppress row names
write.csv(data, "data.csv", row.names=FALSE)
# Same, except that instead of "NA", output blank cells
write.csv(data, "data.csv", row.names=FALSE, na=" ")
# Use tabs, suppress row names and column names
write.table(data, "data.csv", sep="\t", row.names=FALSE, col.names=FALSE).
In R, there are a series of functions that can be used to request an input from the user,
including readline(), cat(), and scan(). But, I find the readline() function to be the optimal function for this task.
How to read data from the keyboard?
To read the data from keyboard we use three different functions:
scan()
readline()
print()
How many ways are there to read and write files?
There are three ways to read and write files respectively:
Reading a data or matrix from a file
Reading a single File One Line at a Time
Writing a Table to a File
Amazon R Programming Recently Asked Interview Questions Answers |
a) Usually we use function read.table() to read data. The default value of a header is ‘FALSE’ and hence when we do not have a header, we need not say such. , R factors are also called as character strings. For turning this “feature” off, you can include the argument as.is=T in your call to read.table().
b) When you have a spreadsheet export file, i.e. having a type.csv where the fields are divided by commas in place of spaces, use read.csv() in place of read.table(). To read spreadsheet files we can use read.xls.
c) When you read in a matrix using read.table(), the resultant object will become a data frame, even when all the entries got to be numeric. A case exists which may followup call towards as.matrix() in a matrix. We need to read it into a matrix form like this
> x <- matrix(scan(“x”),nrow=5,byrow=T)
What are Sockets in R?
Sockets provide two networked machines with a bidirectional communication channel. Servers are accessed via socket addresses, a combination of the server's IP address and a port number. We use the port as a connection point on the server, like USB or Firewire ports, with each port serving a specific purpose.
For example:
Web pages are served on port 80 (HTTP), emails are sent via port 25 (SMTP).
Usage
make.socket(host = "localhost", port, fail = TRUE, server = FALSE)
Arguments
host name of remote host
port port to connect to/listen on
fail failure to connect is an error?
Server a server socket?
What is protocol?
A protocol is a set of rules and procedures. It means what format to use, what data mean, when should data be sent. When two computers exchange data, they can understand each other if both follow specific format and rules in a protocol. It is a set of rules and procedures and computers. It is been used to communicate.
What does TCP/IP work?
TCP/IP protocols map to a four-layer conceptual model known as the DARPA model. The four layers of the DARPA model are Application, Transport, Internet, and Network Interface.
Explain TCP/IP applications, services and protocols?
Bootstrap protocol – Bootstrap Protocol (BOOTP) provides a dynamic method for associating workstations with servers. It is a method which also provides a dynamic method for assigning workstation Internet Protocol (IP) addresses and initial program load (IPL) sources.
Domain name system – We use Domain Name System (DNS) to manage host names and their associated Internet Protocol (IP).
Email – Use this information to plan for, configure, use, manage, and troubleshoot e-mail on your system.
Open shortest path first search – IBM I support includes the Open Shortest Path First (OSPF) protocol. OSPF is a link-state, hierarchical Interior Gateway Protocol (IGP) for network routing.
RouteD – The Route Daemon (RouteD) provides support for the Routing Information Protocol (RIP) on the IBM platform.
Simple network time protocol – It is a time-maintenance application that we can use to synchronize hardware in a network.
What is TCP/IP variable SMC-R storage allocations?
Each more RMB that is been allocated for a particular SMC-R link group can accommodate 4 – 32
more TCP connections, depending on the RCVBFRSIZE value of the TCP connections.
More staging buffers are allocated as the volume of application data that is been sent increases.
RMBs, staging buffers, and RDMA receive and send elements are all eligible to be deallocated if the volume of application traffic decreases.
What is debugging in R?
A grammatically correct program may give us incorrect results due to logic errors. In case such errors (i.e. bugs) occur, we need to find out why and where they occur so that you can fix them. The procedure to identify and fix bugs is called “debugging”.
What are tools for debugging in R?
There are five toos present for debugging in R respectively:
traceback()
debug()
browser()
trace()
recover()
What are connections In R?
Functions to Manipulate Connections (Files, URLs, …). Functions to create, open and close connections.
For example: “generalized files”, such as compressed files, URLs, pipes, etc.
Keywords
file, connection
Explain an Extended example of connections?
Extended Example: Reading PUMS sample files
These files contain records for a sample of housing units with information on the characteristics of each unit.
Why use PUMS?
PUMS files provide greater accessibility to inexpensive data for research projects. Thus it is beneficial for students as they are looking for greater accessibility to inexpensive data. Social scientists often use the PUMS for regression analysis and modeling applications.
How can I access PUMS?
Statistical software is the tool used to work with PUMS files.
Which function is used to write files?
We use write.csv() to write files.
Explain how to write files?
We use write.csv() to write file. By default, write.csv() includes row names.
# A sample data frame
data <- read.table(header=TRUE, text='
subject sex size
1 M 7
2 F NA
3 F 9
4 M 11
')
# Write to a file, suppress row names
write.csv(data, "data.csv", row.names=FALSE)
# Same, except that instead of "NA", output blank cells
write.csv(data, "data.csv", row.names=FALSE, na=" ")
# Use tabs, suppress row names and column names
write.table(data, "data.csv", sep="\t", row.names=FALSE, col.names=FALSE).
Post a Comment