Function that converts feet and inches to centimeters [duplicate]
This question already has an answer here:Convert character vector of height in inches to cm? 5 answersI have a function that works on a df to convert observations with multiple different prefixes &...
View ArticleHow to efficiently replace arguments in a function?
I'm working on a function that has an argument that can take any combination of value in 0:2This argument is based on the "margin" system of prop.table function, but extends it so it can take several...
View ArticleDataset from the book : Statistics and Data with R: An applied approach...
I am beginning to develop Yosef Cohen and Jeremiah Cohen's book, entitled: "Statistics and Data with R: An applied approach through examples", but I can't get the datasets. Someone would know where I...
View Article3dscatter plot for trading data
I'm experimenting for quit some time with the tables of the trade.sqlite3 database. I came up with a combined table of the import and export table. A csv-file of the table can be downloaded here :Added...
View ArticleHow to visualize the percentage of each study contributed to the overall...
I am practicing meta-analysis using the built-in "dat.bcg" dataset of "metafor" package. There I have performed all the primary analysis except the 'percentage of study contribution'. I have not found...
View ArticleWhy are the NAs being ignored while I'm using the ifelse/mutate functions?
So I have a data frame with several occurences of different species and a "new_name" empty column that I want to fill with mutate/ifelse. Basically I want the new_name to be filled according to these...
View ArticleHow do I approach and solve this snail adventure programming problem in R
I'm very new to programming and I'm trying to solve this problem in R. A snail lives in the centre of an 11 x 11 matrix at co-ordinates [6,6] and he wants to travel N number of spaces away from his...
View ArticleSet adaptive col.names in knitr::kable()
Please consider the following. I started writing reproducible documents in with R markdown and want some output for a report. As I am working with more than one data.frame and their column names are...
View ArticleSubtracting value in a column and change another one
I have a data frame which looks like this:"22:36:59", "22:37:00", "22:37:01", "22:37:02", "22:37:03", "23:47:39", "23:47:40", "23:47:41", "23:47:42", "23:47:43", "23:47:44", "23:47:45", "23:47:46",...
View ArticleHow do I simulate any of the ARIMA Models with Small Sample Size of 10, 15...
How can I use a small number in arima.sim function. In the bellow R codes I simulates two ARIMA models, one having n=10 the other having n=50. After the simulations I used the auto.arima() function...
View ArticleHow am I to interpret these R kmean results?
friends. I am currently being introduced to kmean clustering and am having trouble understanding what the results mean. I have 4 clusters, and I have attained a summary of those...
View ArticleR how to get no. of cities search vs count of distinct visitorid
I have a dataset that looks like this:fullVisitorId VisitId visitNumber City 1010122109733 1513354 1 Bangkok 1010164109733 1513366 8 Kuala Lumpur 1010122165452 1513354 5 Tokyo 1010198798713 1517773 10...
View ArticleFind maxima of each row of different data with same extension in R
Here is my data; ht<-structure(list(`1-2006` = structure(c(1.6, 1.6, 1.6, 1.6, 0.208, 0.405, 0.527, 0.818, 2.2, 3, 2.2, 3, 3, 3, 3, 3.2, 4.6, 5.2), .Names = c("nmaxm5", "nmaxm10", "nmaxm15",...
View ArticleFor loop and add a new column to dataframe in R
I have a dataset called tweet_new, and tweet content is in "text" column in this dataset.I will perform a sentiment analysis on each tweet content using get_avg_sentiment function...
View ArticleR: Replace rare values by "others"
I have the following problem: I have a data frame df with many variables. One variable is df$size (non-numeric). Now I want to replace all sizes with less than 20 observations by the term...
View ArticleR: how to assign seasons to months (factor)
in my dataset I have the following vector of months:bank$month <-factor(bank$month, levels = c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec")) I would like to...
View ArticleLabeling axis vertically in R [duplicate]
This question already has an answer here:rotating axis labels in R 5 answersI have the following code that is plotting a barplot in Rbarplot(prop.table(table(topPerforming$Category))) #before theTable...
View ArticleCreate border and title for each column in `facet_wrap`
I want to put black borders with labels and titles around each facet in facet_wrap. Something similar to this: Sample data: library(tidyverse) mtcars %>% mutate(gear = factor(gear, levels = c(4, 3,...
View Articlehow to extract specific value in R
I'd like to extract the specific value from dataframe that I need to do data arranging in R. I can't come up with any method to use in R, so any help will be appreciated.As an example in my dataframe...
View ArticleHow To Apply Multiple Conditions on Case-Otherwise Statement Using Spark...
I am trying to add a new column to an existing data frame using the withColumn statement in Spark Dataframe API. The below code works but I was wondering if there's a way that I can select more than...
View Article