
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
How do I recode/convert values in a data frame from non-numeric to binary "TRUE" "FALSE", in Rstudio
![R RStudio
File Edit
Code View Plots
Session Build Debug Profile
Tools Help
A Go to file/function
BA - Addins -
R Project: (None) -
O Project 5 Logistic Modeling.R* *
Environment
History
Connections
Tutor aO
a A O Source on Save
9 required<-c("gtools")
Run
+ Source -
* Import Dataset -
List -
Global Environment-
10
11 installed<-installed. packages () [, 'Package']
Data
12
O wibc
699 obs. of 12 varia.m
13 for (pkg in required)
14 - {
values
if (!pkg %in% installed)
{
cat ("Installing package:", pkg, "\n")
install.packages (pkg)
}
chr [1:699] "benign" "..
chr [1:699] "benign" "..
installed chr [1:113] "asserttha.
15
A
16 -
class
17
18
pkg
required
"gtools"
"gtools"
19 -
20
cat ("Loading package", pkg, "\n")
require(pkg, character.onīy=TRUE)
21
sourcepir ""
22
23 - }
24
25
26 # load dataset
27
28 wibc<-read.csv("WI_breast_cancer.csv")
29
30
# let's see what the data look 1like
31
#3
32 head (wibc)
str (wibc)
33
34
Files
Plots
Packages
Help
Viewer
# recode categorical variables for use with glm procedure. Convert "malignant" to TRUE
# and "benign" to FALSE. Copy data frame and add new "malignancy" column.
class<-wibcsclass
class
35
36
C Refresh
37
R: The F Distribution -
Find in Topic
38
39
FDist {stats}
R Documentation
40
# ADD YOUR CODE HERE
n = 1
wibc2 = cbind (wibc,replicate(n,wibc$class))
wibc2
colnames (wibc2)<-c("x", "Id", "cl. thickness","cell.size","cell. shape","Marg. adhesion", "Epith.c.size","Bare.nuclei","B1.cromatin", "Normal.nucleoli", "Mitoses", "class", "malignancy")
41
42
The F Distribution
43
44
45
Description
46 head (wibc2)
str(wihc2)
47
Density, distribution function, quantile function
and random generation for the F distribution
with dfl and df2 degrees of freedom (and
optional non-centrality parameter ncp)
39:1
(Top Level) :
R Script :
Console
Terminal x
Jobs x
+ }
Loading package gtools
Loading required package: gtools
> wibc<-read.csv("WI_breast_cancer.csv")
# let's see what the data look 1ike
> #
> head (wibc)
Usage
df (x, df1, df2, ncp, log = FALSE)
pf (g, df1, df2, ncp,
gf (p, df1, df2, ncp,
lower.tail = T!
lower.tail = T!
rf (n, df1, df2, ncp)
Id cl.thickness cell.size cell.shape Marg. adhesion Epith.c.size Bare. nuclei B1.cromatin Normal.nucleoli Mitoses
class
Arguments
11 1000025
2 2 1002945
3 3 1015425
benign
benign
benign
benign
benign
1 malignant
10
1.
1
х, ч
vector of quantiles.
4 4 1016277
8.
8
4
1.
vector of probabilities.
5 5 1017023
6 6 1017122
> str (wibc)
'data. frame':
$ X
4
1.
1.
1.
10
10
10
number of observations. If
length (n) > 1, the length
is taken to be the number
699 obs. of 12 variables:
: int
1 2 3 4 5 6 7 8 9 10 ...
1000025 1002915 1015425 1016277 1017023 1017122 1018000 1018561
103307g
1033078](https://content.bartleby.com/qna-images/question/4e2c08d3-a922-4523-864a-ebe98e79b964/1c89c6d7-2c89-43b2-b8bb-a92dd58957fe/oj3zfh_thumbnail.png)
Transcribed Image Text:R RStudio
File Edit
Code View Plots
Session Build Debug Profile
Tools Help
A Go to file/function
BA - Addins -
R Project: (None) -
O Project 5 Logistic Modeling.R* *
Environment
History
Connections
Tutor aO
a A O Source on Save
9 required<-c("gtools")
Run
+ Source -
* Import Dataset -
List -
Global Environment-
10
11 installed<-installed. packages () [, 'Package']
Data
12
O wibc
699 obs. of 12 varia.m
13 for (pkg in required)
14 - {
values
if (!pkg %in% installed)
{
cat ("Installing package:", pkg, "\n")
install.packages (pkg)
}
chr [1:699] "benign" "..
chr [1:699] "benign" "..
installed chr [1:113] "asserttha.
15
A
16 -
class
17
18
pkg
required
"gtools"
"gtools"
19 -
20
cat ("Loading package", pkg, "\n")
require(pkg, character.onīy=TRUE)
21
sourcepir ""
22
23 - }
24
25
26 # load dataset
27
28 wibc<-read.csv("WI_breast_cancer.csv")
29
30
# let's see what the data look 1like
31
#3
32 head (wibc)
str (wibc)
33
34
Files
Plots
Packages
Help
Viewer
# recode categorical variables for use with glm procedure. Convert "malignant" to TRUE
# and "benign" to FALSE. Copy data frame and add new "malignancy" column.
class<-wibcsclass
class
35
36
C Refresh
37
R: The F Distribution -
Find in Topic
38
39
FDist {stats}
R Documentation
40
# ADD YOUR CODE HERE
n = 1
wibc2 = cbind (wibc,replicate(n,wibc$class))
wibc2
colnames (wibc2)<-c("x", "Id", "cl. thickness","cell.size","cell. shape","Marg. adhesion", "Epith.c.size","Bare.nuclei","B1.cromatin", "Normal.nucleoli", "Mitoses", "class", "malignancy")
41
42
The F Distribution
43
44
45
Description
46 head (wibc2)
str(wihc2)
47
Density, distribution function, quantile function
and random generation for the F distribution
with dfl and df2 degrees of freedom (and
optional non-centrality parameter ncp)
39:1
(Top Level) :
R Script :
Console
Terminal x
Jobs x
+ }
Loading package gtools
Loading required package: gtools
> wibc<-read.csv("WI_breast_cancer.csv")
# let's see what the data look 1ike
> #
> head (wibc)
Usage
df (x, df1, df2, ncp, log = FALSE)
pf (g, df1, df2, ncp,
gf (p, df1, df2, ncp,
lower.tail = T!
lower.tail = T!
rf (n, df1, df2, ncp)
Id cl.thickness cell.size cell.shape Marg. adhesion Epith.c.size Bare. nuclei B1.cromatin Normal.nucleoli Mitoses
class
Arguments
11 1000025
2 2 1002945
3 3 1015425
benign
benign
benign
benign
benign
1 malignant
10
1.
1
х, ч
vector of quantiles.
4 4 1016277
8.
8
4
1.
vector of probabilities.
5 5 1017023
6 6 1017122
> str (wibc)
'data. frame':
$ X
4
1.
1.
1.
10
10
10
number of observations. If
length (n) > 1, the length
is taken to be the number
699 obs. of 12 variables:
: int
1 2 3 4 5 6 7 8 9 10 ...
1000025 1002915 1015425 1016277 1017023 1017122 1018000 1018561
103307g
1033078
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 4 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- What kind of data can hold a signed integer with 32 bits of precision?arrow_forwardWhat is the multiplication floor method in converting bases?arrow_forwardConvert infix to postfix a. Convert this infix expression to postfix. PPT to do the conversion (you can do manually or by inspection, or by computer programming etc.) 1 – 1 + 1 – 1 + 1 -1 b. After conversion, evaluate the postfix expression. Show the step by step calculation. c. Verify that agrees with the result of using the original infix expression.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education