Write 0 1 for Un N0 1n Elements of 0 1 are called words and

Write {0, 1}* for U_n N{0, 1}^n. Elements of {0, 1}* are called words and subsets of {0, 1}* are called formal languages (over the two-element alphabet {0, 1}). Write e for the empty word (of length 0). Consider the function f: P({0, 1}*) rightarrow P({0, 1}*) defined as follows: f(X) = X {w01: w X} {} Find the least fixed point of f on P({0, 1}*) ordered by inclusion. Justify your answer.

Solution

Ans-

The subset( ) function is the easiest way to select variables and observations. In the following example, we select all rows that have a value of age greater than or equal to 20 or age less then 10. We keep the ID and Weight columns.

# using subset function
newdata <- subset(mydata, age >= 20 | age < 10,
select=c(ID, Weight))

In the next example, we select all men over the age of 25 and we keep variables weight through income (weight, income and all columns between them).

# using subset function (part 2)
newdata <- subset(mydata, sex==\"m\" & age > 25,
select=weight:income)

Random Samples

Use the sample( ) function to take a random sample of size n from a dataset.

# take a random sample of size 50 from a dataset mydata
# sample without replacement
mysample <- mydata[sample(1:nrow(mydata), 50,
   replace=FALSE),]

 Write {0, 1}* for U_n N{0, 1}^n. Elements of {0, 1}* are called words and subsets of {0, 1}* are called formal languages (over the two-element alphabet {0, 1})

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site