Question

In: Computer Science

This is R language Create a vector that contains the message part of each log entry...

This is R language

  • Create a vector that contains the message part of each log entry in logsin uppercase letters. In your solution, you might want to use the function toupper(). Simply print this vector to the console.

# Return vector with uppercase version of message elements in log entries


# Apply extract_caps function on logs

Solutions

Expert Solution

code

solution

//output

//copyable code

vapply(logs, `[[`, c('details','message'),FUN.VALUE=character(1))

toupper(vapply(logs, `[[`, c('details','message'),FUN.VALUE=character(1)))

# Apply extract_caps function on logs

extract_caps<-function(x){

toupper(x$details$message)

}

vapply(logs,extract_caps,FUN.VALUE=character(1))


Related Solutions

R programming language A) Create a function that accepts two arguments, an integer and a vector...
R programming language A) Create a function that accepts two arguments, an integer and a vector of integers. It returns the count of the number of occurrences of the integer in the input vector. 1]Input: num_count <-function ??? 2]Input: num_count(2,c(1,1,2,2,3,3)) 2] Output: 2 3] Input: num_count(1,c(1,1,2,2,3,1,4,5,5,2,2,1,3)) 3] Output : 4 B) Create a function that accepts 3 integer values and returns their sum. However, if an integer value is evenly divisible by 3, then it does not count towards the...
R-Studio (R Programming Language) 1. How would you create a vector `V` containing the values 0,...
R-Studio (R Programming Language) 1. How would you create a vector `V` containing the values 0, 0.25, 0.5, 0.75, and 1?    ```{r} #insert your code ``` 2. Name the elements of `V`: first, second, middle, fourth, last. Describe two ways of naming elements in `V` ```{r} #insert your code ``` 3. Suppose you keep track of your mileage each time you fill up. At your last 6 fill-ups the mileage was 65311 65624 65908 66219 66499 66821 67145 67447....
I need to create a linked list that contains a fixed arraylist. Each new entry is...
I need to create a linked list that contains a fixed arraylist. Each new entry is added to array list. If the arraylist is full, create a new arraylist and add to the linklist. In java please.
Use R code Create a vector V with 8 elements (7,2,1,0,3,-1,-3,4): Transform that vector into a...
Use R code Create a vector V with 8 elements (7,2,1,0,3,-1,-3,4): Transform that vector into a rectangular matrix A of dimensions 4X2 (4- rows, 2-columns); Create a matrix transpose to the above matrix A. Call that matrix AT; Calculate matrix products: A*AT and AT*A. Present the results. What are the dimensions of those two product matrices; Square matrixes sometimes have an inverse matrix. Try calculating inverse matrices (or matrixes, if you prefer) of above matrices (matrixes) A*AT and AT*A; Extend...
Using R language: Given a vector or list of numbers, call this variable x , write...
Using R language: Given a vector or list of numbers, call this variable x , write down the code that will create a new vector, y , where all the odd number entries are set to 0. In other words, the first, third, fifth, etc entries should all be 0.
R Programming: create a vector for 1 to 31 and count the number of even and...
R Programming: create a vector for 1 to 31 and count the number of even and odds using ifelse()
Create a function that takes a vector of vectors as an argument. Each inner vector has...
Create a function that takes a vector of vectors as an argument. Each inner vector has 2 elements. The first element is the numerator and the second element is the denominator. Return the sum of the fractions rounded to the nearest whole number. Examples: sum_fractions({{18, 13}, {4, 5}}) ➞ 2 sum_fractions({{36, 4}, {22, 60}}) ➞ 9 sum_fractions({{11, 2}, {3, 4}, {5, 4}, {21, 11}, {12, 6}}) ➞ 11 Notes Your result should be a number not string. Code in C++...
Write a sequence of assembly language instructions to subtract each entry of an array A of...
Write a sequence of assembly language instructions to subtract each entry of an array A of five two’s complement 16-bit binary integers from the corresponding entry of an array B of five two’s complement 16-bit binary integers and construct a third array C of two’s complement 16-bit binary integers. i.e. C[i] = A[i] - B[i]. Use the following data for the arrays A and B. A: 10, -15, 20, 4, -5 B: 25, -5, -30, 6, 10 please answer in...
Use R code to do the following!!!! 1. Create a vector v1 that will contain integers...
Use R code to do the following!!!! 1. Create a vector v1 that will contain integers from -30 to 60. 2. Copy v1 into a vector v2 and add names 'odd' or 'even' based on the value. 3. Copy v1 into a vector v3 and if the number can be divided by 3, replace it by 'NA'. 4. Assign the mean of v3 to v4 ignoring the 'NA'.
In R-Syntax, create a vector of 100 employees ("Employee 1", "Employee 2", ... "Employee 100") [Hint:...
In R-Syntax, create a vector of 100 employees ("Employee 1", "Employee 2", ... "Employee 100") [Hint: use the `paste()` function and vector recycling to add a number to the word "Employee"] then create a vector of 100 random salaries for the year 2017 [Use the `runif()` function to pick random numbers between 40000 and 50000] and finally create a vector of 100 salary adjustments between -5000 and 10000 [use runif() to pick 100 random #'s in that range]
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT