Trying to get working time and current state of machine with KQL - azure-data-explorer

Well, let's suppose that I have the following table:
let test = datatable (Timestamp: datetime, Id: string, Value: dynamic)
[
datetime(2022-11-09 11:39:25), "machineA", "True",
datetime(2022-11-09 11:39:30), "machineA", "True",
datetime(2022-11-09 11:39:35), "machineA", "False",
datetime(2022-11-09 11:39:36), "machineA", "False",
datetime(2022-11-09 11:40:03), "machineA", "True",
datetime(2022-11-09 11:40:03), "machineA", "True",
datetime(2022-11-09 11:40:04), "machineA", "True",
datetime(2022-11-09 11:40:05), "machineA", "True",
datetime(2022-11-09 11:40:25), "machineA", "False",
datetime(2022-11-09 11:40:25), "machineA", "False",
datetime(2022-11-09 11:40:26), "machineA", "False",
datetime(2022-11-09 11:40:27), "machineA", "False",
datetime(2022-11-09 11:40:37), "machineA", "True",
datetime(2022-11-09 11:40:47), "machineA", "False",
datetime(2022-11-09 11:40:57), "machineA", "True",
datetime(2022-11-09 11:40:59), "machineA", "True",
datetime(2022-11-09 11:40:25), "machineB", "True",
datetime(2022-11-09 11:40:30), "machineB", "True",
datetime(2022-11-09 11:40:35), "machineB", "False",
datetime(2022-11-09 11:40:36), "machineB", "False",
datetime(2022-11-09 11:41:03), "machineB", "True",
datetime(2022-11-09 11:41:03), "machineB", "True",
datetime(2022-11-09 11:41:04), "machineB", "True",
datetime(2022-11-09 11:41:05), "machineB", "True",
datetime(2022-11-09 11:41:25), "machineB", "False",
datetime(2022-11-09 11:41:25), "machineB", "False",
datetime(2022-11-09 11:41:26), "machineB", "False",
datetime(2022-11-09 11:41:27), "machineB", "False",
datetime(2022-11-09 11:41:37), "machineB", "True",
datetime(2022-11-09 11:41:47), "machineB", "False",
datetime(2022-11-09 11:41:57), "machineB", "True",
datetime(2022-11-09 11:41:59), "machineB", "True",
datetime(2022-11-09 11:42:25), "machineC", "True",
datetime(2022-11-09 11:42:30), "machineC", "True",
datetime(2022-11-09 11:42:35), "machineC", "False",
datetime(2022-11-09 11:42:36), "machineC", "False",
datetime(2022-11-09 11:43:03), "machineC", "True",
datetime(2022-11-09 11:43:03), "machineC", "True",
datetime(2022-11-09 11:43:04), "machineC", "True",
datetime(2022-11-09 11:43:05), "machineC", "True",
datetime(2022-11-09 11:43:25), "machineC", "False",
datetime(2022-11-09 11:43:25), "machineC", "False",
datetime(2022-11-09 11:43:26), "machineC", "False",
datetime(2022-11-09 11:43:27), "machineC", "False",
datetime(2022-11-09 11:43:37), "machineC", "True",
datetime(2022-11-09 11:43:47), "machineC", "False",
datetime(2022-11-09 11:43:57), "machineC", "False",
datetime(2022-11-09 11:43:59), "machineC", "False",
];
Then, let's suppose that on:
Timestamp stores the time when the event was registered.
Id is the machine to register.
Value is the state, True is working False is stopped.
Then, let's suppose that events can be registered without toggling sense at all, there can be records in sequence with several True or False values in a row.
With this in mind then, we want to know the time a machine is working. For this, the logic is that we must check for the time difference between True and False (and not vice-versa, because this is the time the machine is stopped).
Then:
| where Timestamp > ago(1d) and (Value == "True" or Value == "False")
| extend val=tostring(Value)
| order by Timestamp asc
| where val <> prev(val)
| where val == "True" and next(val) == "False"
| extend tiempoCiclo=next(Timestamp)-Timestamp
| where tiempoCiclo >= 30s and tiempoCiclo <= 5m
);
workingTime
| summarize arg_max(Timestamp, val), max(Timestamp), avg(tiempoCiclo) / 1s by Id
| order by maquina desc
The problem here is that we cannot know the current state of the machine because we are filtering by Value first True then False, then the latest value (arg_max value) will be always True.

let test = datatable (Timestamp: datetime, Id: string, Value: bool)
[
datetime(2022-11-09 11:39:25), "machineA", True,
datetime(2022-11-09 11:39:30), "machineA", True,
datetime(2022-11-09 11:39:35), "machineA", False,
datetime(2022-11-09 11:39:36), "machineA", False,
datetime(2022-11-09 11:40:03), "machineA", True,
datetime(2022-11-09 11:40:03), "machineA", True,
datetime(2022-11-09 11:40:04), "machineA", True,
datetime(2022-11-09 11:40:05), "machineA", True,
datetime(2022-11-09 11:40:25), "machineA", False,
datetime(2022-11-09 11:40:25), "machineA", False,
datetime(2022-11-09 11:40:26), "machineA", False,
datetime(2022-11-09 11:40:27), "machineA", False,
datetime(2022-11-09 11:40:37), "machineA", True,
datetime(2022-11-09 11:40:47), "machineA", False,
datetime(2022-11-09 11:40:57), "machineA", True,
datetime(2022-11-09 11:40:59), "machineA", True,
datetime(2022-11-09 11:40:25), "machineB", True,
datetime(2022-11-09 11:40:30), "machineB", True,
datetime(2022-11-09 11:40:35), "machineB", False,
datetime(2022-11-09 11:40:36), "machineB", False,
datetime(2022-11-09 11:41:03), "machineB", True,
datetime(2022-11-09 11:41:03), "machineB", True,
datetime(2022-11-09 11:41:04), "machineB", True,
datetime(2022-11-09 11:41:05), "machineB", True,
datetime(2022-11-09 11:41:25), "machineB", False,
datetime(2022-11-09 11:41:25), "machineB", False,
datetime(2022-11-09 11:41:26), "machineB", False,
datetime(2022-11-09 11:41:27), "machineB", False,
datetime(2022-11-09 11:41:37), "machineB", True,
datetime(2022-11-09 11:41:47), "machineB", False,
datetime(2022-11-09 11:41:57), "machineB", True,
datetime(2022-11-09 11:41:59), "machineB", True,
datetime(2022-11-09 11:42:25), "machineC", True,
datetime(2022-11-09 11:42:30), "machineC", True,
datetime(2022-11-09 11:42:35), "machineC", False,
datetime(2022-11-09 11:42:36), "machineC", False,
datetime(2022-11-09 11:43:03), "machineC", True,
datetime(2022-11-09 11:43:03), "machineC", True,
datetime(2022-11-09 11:43:04), "machineC", True,
datetime(2022-11-09 11:43:05), "machineC", True,
datetime(2022-11-09 11:43:25), "machineC", False,
datetime(2022-11-09 11:43:25), "machineC", False,
datetime(2022-11-09 11:43:26), "machineC", False,
datetime(2022-11-09 11:43:27), "machineC", False,
datetime(2022-11-09 11:43:37), "machineC", True,
datetime(2022-11-09 11:43:47), "machineC", False,
datetime(2022-11-09 11:43:57), "machineC", False,
datetime(2022-11-09 11:43:59), "machineC", False,
];
test
| partition hint.strategy=native by Id
(
order by Timestamp asc
| where Value != prev(Value)
| extend next_Timestamp = next(Timestamp)
| where Value
| extend duration = next_Timestamp - Timestamp
| summarize min(duration), avg(duration), max(duration), sum(duration)
,1st_start = min(Timestamp)
,(max_Timestamp, last_action, last_action_timestamp) = arg_max(Timestamp, isnull(next_Timestamp), coalesce(next_Timestamp, Timestamp))
| project-away max_Timestamp
| extend Id
)
min_duration
avg_duration
max_duration
sum_duration
1st_start
last_action
last_action_timestamp
Id
00:00:10
00:00:14
00:00:22
00:00:42
2022-11-09T11:39:25Z
true
2022-11-09T11:40:57Z
machineA
00:00:10
00:00:14
00:00:22
00:00:42
2022-11-09T11:40:25Z
true
2022-11-09T11:41:57Z
machineB
00:00:10
00:00:14
00:00:22
00:00:42
2022-11-09T11:42:25Z
false
2022-11-09T11:43:47Z
machineC
Fiddle

Related

How can I get the translated only products with translation from WooCommerce Multilingual & Multicurrency with Rest API?

The problem is that I get this excerpt of a product from Woocommerce:
[
{
"id": 73,
"name": "cBox",
"slug": "cbox",
"sku": "",
"price": "169",
"regular_price": "169",
"sale_price": "",
"on_sale": false,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"sold_individually": false,
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0.00",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"stock_status": "instock",
"has_options": true,
"translations": {
"de": "73",
"en": "76"
},
"lang": "de",
}
]
You can see the translations, at least the ID's of the translated products. My question is how can I get directly via rest-api only the translated products?
Because with the property "lang=en" it does not work in the url
What does your request look like?
It should work with the lang parameter, you can read more here: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/

How to generate a graphical matrix from a dataset where each variable has been specified as binary TRUE/FALSE – convert data into required format?

thanks in advance for your help
I am trying to generate a graphical matrix to illustrate the number of scientific papers reporting a certain biodiversity indicator for each type of agroforestry system.
CONTEXT
Using descriptive summary statistics to analyse a large database on silvoarable agroforestry on aspects of agroforestry systems, biodiversity and ecosystem services, as part of a systematic mapping review.
GOAL
To illustrate the number of scientific papers reporting on various biodiversity indicators for each agroforestry system. To do so I would like to generate a graphical matrix (e.g. Adjacency matrix, Balloon plot), that shows the number of papers reporting on each agroforestry system and each type of biodiversity indicator. See also the attached figures.
Exemplary sketch of the desired outcome
Inspirational example from Ditzler et al. (2021)
DATA
The database consists of hundreds of variables including everything from the location of the study to the specific biodiversity and ecosystem services addressed in the study. Here I have made a subset of the database that only includes the unique paper ID (ID.P), AC.TYPE (alley cropping type) and eight biodiversity variables (BD).
tibble::tribble(
~ID.P, ~ID.S, ~AC.TYPE, ~BD.SUB.FLORA, ~BD.SUB.FAUNAMACRO, ~BD.SUB.FLORAMICRO, ~BD.SUB.FUNGI, ~BD.SUB.BACTERIA, ~BD.SUB.SOILFAUNA, ~BD.SUB.SPEC, ~BD,
24, 4, "NUT.ARABLE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
92, 1, "TIMBER.ARABLE", "TRUE", "TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "LANDSCAPE", "TRUE",
99, 9, "SHB", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
98, 5, "SHB", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
7, 2, "TIMBER.ARABLE", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "FALSE",
125, 1, "BIOMASS.ARABLE", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "FALSE",
45, 17, "NUT.ARABLE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
47, 2, "BIOMASS.ARABLE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
69, 2, "TIMBER.ARABLE", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "MICROBIO.BIOMASS", "TRUE",
14, 1, "TIMBER.ARABLE", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "FALSE",
12, 7, "BIOMASS.ARABLE", "TRUE", "FALSE", "TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "TRUE",
51, 1, "BIOMASS.ARABLE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
169, 1, "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "FALSE",
94, 7, "TIMBER.ARABLE", "TRUE", "TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "LANDSCAPE", "TRUE",
49, 1, "TIMBER.ARABLE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
99, 1, "SHB", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
131, 1, "MIXED", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "FALSE",
45, 13, "FRUIT.ARABLE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
152, 1, "BIOMASS.ARABLE", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "FALSE",
37, 29, "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "FALSE"
)
ISSUE
My issue is that I cannot convert my dataframe into the required format to generate the graphical matrix I wish to create. I have tried the xtabs() and the aggregate() function to create a contingency matrix (also called cross table), but without luck (see below). I think it is because my data is based on binary TRUE/FALSE.
CrossTab_AC.TYPE_BD <-
xtabs(~ AC.TYPE + BD.SUB.FLORA + BD.SUB.FAUNAMACRO + BD.SUB.FAUNAMACRO + BD.SUB.FLORAMICRO + BD.SUB.FUNGI + BD.SUB.BACTERIA + BD.SUB.SOILFAUNA + BD.SUB.SPEC + BD,
data = BD_database) %>%
as.data.frame.table()
CrossTab_AC.TYPE_BD %>%
sample_n(20) %>%
head(10)
Then, I try plotting the dataframe using ggballoonplot()
ggballoonplot(CrossTab_AC.TYPE_BD, x = "AC.TYPE", y = "BD.SUB.FAUNAMACRO",
size = "Freq", fill = "Freq") +
scale_fill_gradientn(colors = my_cols_pal_10) +
guides(size = FALSE)
Unfortunately, this is not working..
Instead, I should have a data format like what they use in there ggballoonplot example:
car_data
#> Car Color Value
#> 1 bmw red 86.2
#> 2 renault red 193.5
#> 3 mercedes red 104.2
#> 4 seat red 107.8
#> 5 bmw white 202.9
#> 6 renault white 127.7
#> 7 mercedes white 24.1
#> 8 seat white 58.8
#> 9 bmw silver 73.3
#> 10 renault silver 173.4
#> 11 mercedes silver 121.6
#> 12 seat silver 124.0
#> 13 bmw green 106.6
#> 14 renault green 66.6
#> 15 mercedes green 207.2
#> 16 seat green 129.9
ggballoonplot(car_data, x = "Car", y = "Color",
size = "Value", fill = "Value") +
scale_fill_gradientn(colors = my_cols) +
guides(size = FALSE)
Hence to me, it seems as if the real issue is how to convert the binary TRUE/FALSE dataset into some sort of summarised version that allows me to plot it as a graphical matrix.
I have checked on other posts here on StackOverflow, for instance, this visualizing crosstab tables with a plot in R]6.
Please, any help is highly appreciated!
First of all we don't have your colors so I just used the colors from the example. Next you need to convert your data to longer format using pivot_longer. After that I converted your true/false to 1/0 which isn't necessary because you only need to count the number of rows by both groups using group_by and summarise to get the counts to represent in your plot. When that is done, you can just plot it like this
library(ggplot2)
library(dplyr)
library(tidyr)
library(ggpubr)
my_cols <- c("#0D0887FF", "#6A00A8FF", "#B12A90FF",
"#E16462FF", "#FCA636FF", "#F0F921FF")
BD_database %>%
select(-c(ID.P, ID.S)) %>%
pivot_longer(cols = -AC.TYPE) %>%
mutate(value = case_when(value == "TRUE" ~ 1,
value == "FALSE" ~ 0)) %>%
na.omit() %>%
group_by(AC.TYPE, name) %>%
summarise(n = n()) %>%
ggballoonplot(x = "AC.TYPE", y = "name", size = "n", fill = "n") +
scale_fill_gradientn(colors = my_cols) +
guides(size = FALSE)
#> `summarise()` has grouped output by 'AC.TYPE'. You can override using the
#> `.groups` argument.
#> Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
#> "none")` instead.
Created on 2022-08-01 by the reprex package (v2.0.1)
I found a solution to my issue by refining the answer from Quinten.
Below are my methods for Ecosystem services which essentially is the same as what I wanted for the Biodiversity indicators.
Firstly, I decided to plot the graphical matrix with ggplot instead of ggballoonplot because the output seems easier for me to wrangle and make neat.
Secondly, I added a group_by() piece to the pivot_longer() operation with the arguments to group AC.TYPE and the names (Ecosystem Services indicators, ES).
Thirdly, I summarised the occurrences of AC.TYPE – ES pairs (for TRUE's), since changing the TRUE to 1 only counts the 1's and leaves out zeros.
try <-
ES_database %>%
filter(AC.TYPE != "NA") %>%
select(-c(ES)) %>%
pivot_longer(cols = -AC.TYPE) %>%
mutate(value = case_when(value == "TRUE" ~ 1,
value == "FALSE" ~ 0)) %>%
group_by(AC.TYPE, name) %>%
summarize(count = sum(value))
This gave me this data table:
I could now simply plot it with ggplot() using these lines of code:
ggplot(try, aes(x = AC.TYPE, y = name)) +
geom_point(aes(size = count), shape = 21, colour = "black", fill = "cornsilk") +
scale_size_area(max_size = 20, guide = "none")
Special thanks to #Quinten who has been very helpful!

Changing the video background of this elementor slider

I'm working on this Wordpress website and trying to change the video background of the slider on the homepage. I see it in the code, I see it in the site editor, and it seems to be part of a revolution slider, yet in this slider's properties, I cannot find any instruction relating to it.
Has anyone worked with this situation before? Did I miss something obvious? or did I just research the wrong question?
Here is the JSON definition of the slider in question:
{
"addOns": [],
"carousel": {
"borderRadius": 0,
"borderRadiusUnit": "px",
"ease": "power3.inOut",
"fadeOut": true,
"horizontal": "center",
"infinity": false,
"justify": false,
"justifyMaxWidth": false,
"maxItems": 3,
"maxOpacity": 100,
"maxRotation": 0,
"offsetScale": false,
"paddingBottom": 0,
"paddingTop": 0,
"rotation": false,
"scale": false,
"scaleDown": 50,
"showAllLayers": "false",
"snap": true,
"space": 0,
"speed": 800,
"stretch": false,
"varyFade": false,
"varyRotate": false,
"varyScale": false,
"vertical": "center"
},
"class": "",
"codes": {
"css": "",
"javascript": ""
},
"def": {
"autoResponsive": true,
"background": {
"fit": "cover",
"fitX": 100,
"fitY": 100,
"imageSourceType": "full",
"position": "center center",
"positionX": 0,
"positionY": 0,
"repeat": "no-repeat"
},
"delay": 9000,
"intelligentInherit": true,
"panZoom": {
"blurEnd": 0,
"blurStart": 0,
"duration": 10000,
"ease": "none",
"fitEnd": 100,
"fitStart": 100,
"rotateEnd": 0,
"rotateStart": 0,
"set": false,
"xEnd": 0,
"xStart": 0,
"yEnd": 0,
"yStart": 0
},
"responsiveChilds": true,
"responsiveOffset": true,
"transition": "fade",
"transitionDuration": 300
},
"general": {
"autoPlayVideoOnMobile": true,
"disableFocusListener": false,
"disableOnMobile": false,
"disablePanZoomMobile": false,
"firstSlide": {
"alternativeFirstSlide": 1,
"alternativeFirstSlideSet": false,
"duration": 300,
"set": false,
"slotAmount": 7,
"type": "fade"
},
"layerSelection": false,
"lazyLoad": "none",
"nextSlideOnFocus": false,
"progressbar": {
"color": "rgba(255,255,255,0.5)",
"height": 5,
"position": "bottom",
"set": false
},
"slideshow": {
"initDelay": 0,
"loopSingle": false,
"presetSliderHeight": false,
"shuffle": false,
"slideShow": true,
"stopAfterLoops": 0,
"stopAtSlide": 1,
"stopOnHover": false,
"stopSlider": false,
"viewPort": false,
"viewPortArea": {
"d": {
"e": false,
"u": "",
"v": "200px"
},
"m": {
"e": false,
"u": "",
"v": "200px"
},
"n": {
"e": false,
"u": "",
"v": "200px"
},
"t": {
"e": false,
"u": "",
"v": "200px"
}
},
"viewPortStart": "wait",
"waitForInit": false
},
"useWPML": false
},
"googleFont": [],
"hero": {
"activeSlide": -1
},
"id": "",
"layout": {
"bg": {
"color": "transparent",
"dottedOverlay": "none",
"fit": "cover",
"image": "",
"imageSourceType": "full",
"padding": 0,
"position": "center center",
"repeat": "no-repeat",
"shadow": 0,
"useImage": false
},
"position": {
"addClear": false,
"align": "center",
"fixedOnTop": false,
"marginBottom": 0,
"marginLeft": 0,
"marginRight": 0,
"marginTop": 0
},
"spinner": {
"color": "#ffffff",
"type": "0"
}
},
"layouttype": "fullwidth",
"modal": {
"bodyclass": "",
"cover": true,
"coverColor": "rgba(0,0,0,0.5)",
"horizontal": "center",
"vertical": "middle"
},
"modalshortcode": "[rev_slider usage=\"modal\" alias=\"slider-1\"][/rev_slider]",
"nav": {
"arrows": {
"alwaysOn": true,
"animDelay": "1000ms",
"animSpeed": "1000ms",
"hideDelay": 200,
"hideDelayMobile": 1200,
"hideOver": false,
"hideOverLimit": 0,
"hideUnder": false,
"hideUnderLimit": 778,
"left": {
"align": "slider",
"anim": "fade",
"horizontal": "left",
"offsetX": 30,
"offsetY": 0,
"vertical": "center"
},
"preset": "default",
"presets": [],
"right": {
"align": "slider",
"anim": "fade",
"horizontal": "right",
"offsetX": 30,
"offsetY": 0,
"vertical": "center"
},
"rtl": false,
"set": false,
"style": "1000"
},
"bullets": {
"align": "slider",
"alwaysOn": true,
"anim": "fade",
"animDelay": "1000ms",
"animSpeed": "1000ms",
"direction": "horizontal",
"hideDelay": 200,
"hideDelayMobile": 1200,
"hideOver": false,
"hideOverLimit": 0,
"hideUnder": false,
"hideUnderLimit": 778,
"horizontal": "center",
"offsetX": 0,
"offsetY": 20,
"preset": "default",
"presets": [],
"rtl": false,
"set": false,
"space": 5,
"style": "3000",
"vertical": "bottom"
},
"keyboard": {
"direction": "horizontal",
"set": false
},
"mouse": {
"reverse": "default",
"set": "off"
},
"preview": {
"height": 100,
"width": 50
},
"swipe": {
"blockDragVertical": false,
"direction": "horizontal",
"minTouch": 1,
"set": false,
"setDesktopCarousel": true,
"setMobileCarousel": true,
"setOnDesktop": false,
"velocity": 75
},
"tabs": {
"align": "slider",
"alwaysOn": true,
"amount": 5,
"anim": "fade",
"animDelay": "1000ms",
"animSpeed": "1000ms",
"direction": "horizontal",
"height": 50,
"hideDelay": 200,
"hideDelayMobile": 1200,
"hideOver": false,
"hideOverLimit": 0,
"hideUnder": false,
"hideUnderLimit": 778,
"horizontal": "center",
"innerOuter": "inner",
"offsetX": 0,
"offsetY": 20,
"padding": 5,
"preset": "default",
"presets": [],
"rtl": false,
"set": false,
"space": 5,
"spanWrapper": false,
"style": "4000",
"vertical": "bottom",
"width": 100,
"widthMin": 100,
"wrapperColor": "transparent"
},
"thumbs": {
"align": "slider",
"alwaysOn": true,
"amount": 5,
"anim": "fade",
"animDelay": "1000ms",
"animSpeed": "1000ms",
"direction": "horizontal",
"height": 50,
"hideDelay": 200,
"hideDelayMobile": 1200,
"hideOver": false,
"hideOverLimit": 0,
"hideUnder": false,
"hideUnderLimit": 778,
"horizontal": "center",
"innerOuter": "inner",
"offsetX": 0,
"offsetY": 20,
"padding": 5,
"preset": "default",
"presets": [],
"rtl": false,
"set": false,
"space": 5,
"spanWrapper": false,
"style": "2000",
"vertical": "bottom",
"width": 100,
"widthMin": 100,
"wrapperColor": "transparent"
}
},
"parallax": {
"ddd": {
"BGFreeze": false,
"layerOverflow": false,
"overflow": false,
"shadow": false,
"zCorrection": 65
},
"disableOnMobile": false,
"levels": [
5,
10,
15,
20,
25,
30,
35,
40,
45,
46,
47,
48,
49,
50,
51,
30
],
"mouse": {
"bgSpeed": 0,
"layersSpeed": 0,
"origo": "slidercenter",
"speed": 0,
"type": "scroll"
},
"set": false,
"setDDD": false
},
"scrolleffects": {
"bg": false,
"direction": "both",
"disableOnMobile": false,
"layers": false,
"maxBlur": 10,
"multiplicator": "1.3",
"multiplicatorLayers": "1.3",
"parallaxLayers": false,
"set": false,
"setBlur": false,
"setFade": false,
"setGrayScale": false,
"staticLayers": false,
"staticParallaxLayers": false,
"tilt": 30
},
"scrolltimeline": {
"ease": "none",
"fixed": false,
"fixedEnd": 4000,
"fixedStart": 2000,
"layers": false,
"set": false,
"speed": 500
},
"shortcode": "[rev_slider alias=\"slider-1\"][/rev_slider]",
"size": {
"custom": {
"d": true,
"m": true,
"n": true,
"t": true
},
"disableForceFullWidth": false,
"editorCache": {
"d": 500,
"m": 270,
"n": 600,
"t": 430
},
"forceOverflow": false,
"fullScreenOffset": "",
"fullScreenOffsetContainer": "",
"gridEQModule": false,
"height": {
"d": "500px",
"m": "270px",
"n": "600px",
"t": "430px"
},
"keepBPHeight": false,
"maxHeight": 0,
"maxWidth": 0,
"minHeight": "",
"minHeightFullScreen": "",
"overflow": false,
"overflowHidden": false,
"respectAspectRatio": false,
"useFullScreenHeight": true,
"width": {
"d": 1240,
"m": 480,
"n": 1024,
"t": 778
}
},
"skins": {
"cid": 2,
"colors": [
{
"alias": "Highlight",
"ref": [],
"v": "#ff0000"
},
{
"alias": "Headline Text",
"ref": [],
"v": "#ffffff"
},
{
"alias": "Content Text",
"ref": [],
"v": "#00ffff"
}
],
"colorsAtStart": false
},
"snap": {
"adjust": "none",
"gap": 20,
"helpLines": false,
"snap": false
},
"source": {
"facebook": {
"album": "",
"appId": "",
"appSecret": "",
"count": "",
"pageURL": "",
"transient": 1200,
"typeSource": "album"
},
"flickr": {
"apiKey": "",
"count": "",
"galleryURL": "",
"groupURL": "",
"photoSet": "",
"transient": 1200,
"type": "publicphotos",
"userURL": ""
},
"gallery": [],
"instagram": {
"count": "",
"hashTag": "",
"transient": 1200,
"type": "user",
"userId": ""
},
"post": {
"category": "",
"excerptLimit": 55,
"fetchType": "cat_tag",
"list": "",
"maxPosts": 30,
"sortBy": "ID",
"sortDirection": "DESC",
"subType": "post",
"types": "post"
},
"twitter": {
"accessSecret": "",
"accessToken": "",
"consumerKey": "",
"consumerSecret": "",
"count": "",
"excludeReplies": false,
"imageOnly": false,
"includeRetweets": false,
"transient": 1200,
"userId": ""
},
"vimeo": {
"albumId": "",
"channelName": "",
"count": "",
"groupName": "",
"transient": 1200,
"typeSource": "user",
"userName": ""
},
"woo": {
"category": "",
"excerptLimit": 55,
"featuredOnly": false,
"inStockOnly": false,
"maxProducts": 30,
"regPriceFrom": "",
"regPriceTo": "",
"salePriceFrom": "",
"salePriceTo": "",
"sortBy": "ID",
"sortDirection": "DESC",
"types": "product"
},
"youtube": {
"api": "",
"channelId": "",
"count": "",
"playList": "",
"transient": 1200,
"typeSource": "channel"
}
},
"sourcetype": "gallery",
"troubleshooting": {
"alternateImageType": "off",
"alternateURL": "",
"ignoreHeightChanges": false,
"ignoreHeightChangesUnderLimit": 0,
"jsInBody": false,
"jsNoConflict": false,
"outPutFilter": "none",
"simplify_ie8_ios4": false
},
"type": "standard",
"version": "6.2.2",
"visibility": {
"hideAllLayersUnderLimit": 0,
"hideSelectedLayersUnderLimit": 0,
"hideSliderUnderLimit": 0
},
"wrapperclass": ""
}
I can see that is is revolution slider. This is the source I saw for the video
<source src="//askdrdougnow.com/wp-content/uploads/2020/05/videoplayback.webm" type="video/mp4" data-stylerecorder="true" style="text-align: left; line-height: 20px; letter-spacing: 0px; font-weight: 400; border-color: rgb(0, 0, 0); border-style: none; margin: 0px; border-radius: 0px; padding: 0px;">
I know Revolution Slider has a place for editing all sliders and you can set the background of a slider as a video so that is were you would need to find and remove it.

Why does my for loop delete the column instead of edditing it, using R?

I have the following loop:
info$atod <- 0
i=1
info$atod <- for (i in nrow(info)) {
if(info[i,1] %in% agents$id) {
1
}
}
The goal of the loop is to replace the value of info$atod with 1, if the first column of the row contains a value which can be found in agents$id.
In my output the info$atod column is simply nonexistent and I've no idea why.
Is there an easier way to change the value?
Here is the info file:
structure(list(id = c(10, 100, 1000, 1000157, 1000183, 1000184,
1000252, 1000264, 1000440, 1000533, 1000534, 1000567, 1000568,
100059, 100060, 100061, 1000670, 1000691, 100072, 100073, 1000803,
1000887, 1000928, 100098, 100099, 1000999, 1001, 1001004, 1001005,
1001016, 100102, 100103, 100104, 1001046, 1001090, 1001174, 1001186,
1001232, 1001239, 100125, 100126, 100127, 100128, 1001313, 1001349,
1001388, 1001456, 100149, 100150, 1001541), age = c(30L, 3L,
48L, 52L, 32L, 32L, 52L, 28L, 40L, 36L, 38L, 26L, 31L, 25L, 55L,
52L, 26L, 70L, 71L, 69L, 23L, 59L, 36L, 31L, 32L, 46L, 46L, 41L,
55L, 64L, 33L, 42L, 5L, 27L, 50L, 50L, 25L, 25L, 48L, 11L, 40L,
13L, 42L, 48L, 35L, 27L, 50L, 63L, 65L, 40L), bikeAvailability = c("FOR_SOME",
"FOR_SOME", "FOR_SOME", "FOR_ALL", "FOR_ALL", "FOR_ALL", "FOR_SOME",
"FOR_ALL", "FOR_SOME", "FOR_NONE", "FOR_NONE", "FOR_ALL", "FOR_ALL",
"FOR_ALL", "FOR_ALL", "FOR_ALL", "FOR_NONE", "FOR_ALL", "FOR_SOME",
"FOR_SOME", "FOR_SOME", "FOR_ALL", "FOR_SOME", "FOR_NONE", "FOR_NONE",
"FOR_ALL", "FOR_SOME", "FOR_ALL", "FOR_NONE", "FOR_ALL", "FOR_ALL",
"FOR_ALL", "FOR_ALL", "FOR_ALL", "FOR_ALL", "FOR_ALL", "FOR_NONE",
"FOR_ALL", "FOR_ALL", "FOR_ALL", "FOR_ALL", "FOR_ALL", "FOR_ALL",
"FOR_SOME", "FOR_ALL", "FOR_SOME", "FOR_NONE", "FOR_ALL", "FOR_ALL",
"FOR_SOME"), carAvail = c("never", "never", "never", "always",
"always", "never", "always", "always", "always", "always", "sometimes",
"always", "always", "sometimes", "always", "always", "always",
"always", "sometimes", "always", "always", "always", "always",
"always", "always", "always", "always", "always", "always", "always",
"always", "always", "never", "always", "always", "always", "always",
"always", "always", "never", "always", "never", "always", "always",
"sometimes", "always", "always", "sometimes", "always", "always"
), employed = c("true", "false", "true", "true", "true", "true",
"true", "true", "true", "true", "true", "true", "true", "true",
"true", "true", "true", "true", "false", "false", "true", "false",
"true", "true", "true", "true", "true", "true", "true", "true",
"true", "true", "false", "true", "true", "true", "true", "true",
"true", "false", "true", "false", "true", "true", "true", "true",
"true", "true", "false", "true"), hasLicense = c("no", "no",
"yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes",
"yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes",
"yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes",
"yes", "yes", "yes", "no", "yes", "yes", "yes", "yes", "yes",
"yes", "no", "yes", "no", "yes", "yes", "yes", "yes", "yes",
"yes", "yes", "yes"), home_x = c(2679482, NA, 2678966, 2695732,
2696352, 2696352, 2694328, 2697294, 2699069, 2700164, 2700164,
2697871, 2697871, 2690503, 2690503, 2690503, 2699873, NA, 2689797,
2689797, 2699259, 2700573, 2693973, 2690685, 2690685, 2698825,
2678966, 2697642, 2694565, 2699619, 2689409, 2689409, NA, 2699448,
2696182, 2699603, 2699819, 2693418, 2699191, 2689141, 2689141,
2689141, 2689141, 2695657, 2695975, 2696420, 2696468, 2690515,
2690515, 2698872), home_y = c(1237545, NA, 1235785, 1259962,
1261689, 1261689, 1262417, 1261300, 1262338, 1259968, 1259968,
1260827, 1260827, 1254816, 1254816, 1254816, 1259875, NA, 1254916,
1254916, 1262206, 1260359, 1262927, 1254061, 1254061, 1260550,
1235785, 1260602, 1262912, 1260718, 1255542, 1255542, NA, 1260779,
1262244, 1259995, 1259831, 1262683, 1260397, 1255220, 1255220,
1255220, 1255220, 1260799, 1261639, 1260531, 1262128, 1254872,
1254872, 1264962), isCarPassenger = c("false", "true", "false",
"false", "false", "true", "false", "false", "false", "false",
"false", "false", "true", "true", "false", "false", "false",
"true", "false", "false", "true", "false", "false", "false",
"false", "false", "false", "false", "false", "false", "true",
"false", "true", "false", "false", "false", "false", "false",
"false", "false", "false", "false", "false", "false", "false",
"false", "false", "false", "false", "false"), isOutside = c("true",
"false", "true", "true", "true", "true", "true", "true", "true",
"true", "true", "true", "true", "true", "false", "true", "true",
"true", "true", "false", "true", "true", "true", "false", "true",
"true", "true", "true", "true", "true", "false", "true", "false",
"true", "true", "true", "true", "true", "true", "false", "true",
"true", "false", "true", "true", "true", "true", "false", "true",
"true"), mzHeadId = c(374775L, 324961L, 137604L, 275258L, 410086L,
410086L, 256054L, 444050L, 163782L, 453296L, 453296L, 293687L,
293687L, 484677L, 484677L, 484677L, 301114L, 210862L, 160519L,
160519L, 164816L, 402005L, 217146L, 483141L, 483141L, 135331L,
137604L, 112362L, 482631L, 345109L, 242258L, 242258L, 242258L,
343217L, 387462L, 249340L, 187016L, 202700L, 455039L, 184033L,
184033L, 184033L, 184033L, 333797L, 191333L, 282717L, 398417L,
274594L, 274594L, 176820L), mzPersonId = c(281604L, -1L, 496052L,
212563L, 130607L, 328565L, 324303L, 212965L, 379135L, 289459L,
148489L, 304301L, 275262L, 132505L, 143962L, 472786L, 118753L,
312249L, 427391L, 398024L, 370642L, 157572L, 335200L, 272413L,
160109L, 348386L, 109718L, 365474L, 115833L, 145063L, 157599L,
104249L, -1L, 116521L, 481965L, 215263L, 244975L, 356536L, 415926L,
365484L, 448602L, 107348L, 203282L, 215440L, 179202L, 349503L,
161305L, 296758L, 115768L, 430587L), ptHasGA = c("true", "true",
"false", "false", "false", "true", "false", "false", "false",
"false", "true", "false", "false", "true", "false", "false",
"false", "false", "true", "true", "false", "false", "false",
"false", "false", "false", "true", "false", "false", "false",
"false", "false", "true", "false", "false", "false", "true",
"false", "false", "false", "false", "false", "false", "false",
"false", "false", "false", "true", "false", "false"), ptHasHalbtax = c("false",
"true", "false", "false", "true", "false", "false", "true", "true",
"true", "false", "false", "false", "false", "true", "true", "true",
"false", "false", "false", "false", "true", "false", "true",
"true", "true", "false", "false", "false", "true", "true", "false",
"true", "false", "true", "false", "false", "true", "true", "false",
"true", "false", "false", "true", "true", "false", "true", "false",
"false", "false"), ptHasStrecke = c("false", "true", "false",
"false", "false", "false", "false", "false", "true", "false",
"false", "false", "false", "false", "false", "false", "false",
"false", "false", "false", "false", "false", "false", "false",
"false", "false", "false", "false", "false", "false", "false",
"false", "true", "false", "false", "false", "false", "false",
"true", "false", "false", "false", "false", "false", "false",
"false", "false", "false", "false", "false"), ptHasVerbund = c("false",
"true", "false", "true", "false", "false", "false", "false",
"false", "false", "false", "false", "false", "false", "false",
"false", "false", "true", "false", "false", "true", "false",
"false", "false", "false", "false", "false", "false", "false",
"false", "false", "false", "true", "false", "false", "false",
"false", "false", "false", "false", "false", "false", "false",
"false", "true", "false", "false", "false", "false", "false"),
sex = c("f", "f", "f", "f", "f", "m", "f", "f", "m", "m",
"f", "f", "m", "m", "m", "f", "f", "f", "m", "f", "f", "f",
"m", "f", "m", "m", "m", "f", "m", "f", "m", "f", "m", "f",
"f", "f", "m", "f", "m", "f", "f", "m", "m", "m", "f", "f",
"m", "f", "m", "f"), spRegion = c(1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L),
statpopHouseholdId = c(201200010000137, 201200010000049,
201200010000745, 201202300043212, 201202300041144, 201202300041144,
201202300027378, 201202300003914, 201202300008638, 201202300016150,
201202300016150, 201202300038775, 201202300038775, 201200520004578,
201200520004578, 201200520004578, 201202300016894, 201202300041579,
201200520003321, 201200520003321, 201202300039265, 201202300017598,
201202300041352, 201200520000028, 201200520000028, 201202300035149,
201200010000745, 201202300032984, 201202300028065, 201202300014660,
201200520002069, 201200520002069, 201200520002069, 201202300015154,
201202300006093, 201202300016476, 201202300016912, 201202300038520,
201202300046704, 201200520002574, 201200520002574, 201200520002574,
201200520002574, 201202300020483, 201202300005449, 201202300003039,
201202300006442, 201200520000135, 201200520000135, 201202300039406
), statpopPersonId = c(201240012081086, 201240013385042,
201240009138483, 201240010759877, 201240010762942, 201240014545573,
201240013629176, 201240015955140, 201240012957576, 201240010786907,
201240014232938, 201240010789848, 201240013347870, 201240011051909,
201240014657629, 201240016022367, 201240010796520, 201240010798370,
201240011073924, 201240014311763, 201240014177159, 201240013952288,
201240010968314, 201240011092250, 201240015776466, 201240014590786,
201240010131160, 201240010818041, 201240010818079, 201240010819153,
201240011096282, 201240011356900, 201240013062288, 201240011091717,
201240014421721, 201240010827760, 201240010828440, 201240010833899,
201240014519697, 201240011105988, 201240012332003, 201240014135425,
201240014816773, 201240010837196, 201240010841553, 201240013723781,
201240011444715, 201240011125001, 201240011217121, 201240012635057
), isFreight = c("", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", ""), subpopulation = c("",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", ""), type = c("", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "")), row.names = c(NA,
50L), class = "data.frame")
and here the agents file:
structure(list(id = c(10, 100061, 100098, 100102, 100126, 100128,
100149, 100220, 100253, 100271, 100464, 100607, 100648, 100757,
100761, 100818, 100960, 101, 101111, 101252, 101267, 101274,
101311, 101387, 101412, 101432, 101433, 101572, 101624, 101627,
101798, 101799, 101800, 101812, 101847, 101849, 101864, 101915,
101930, 101993, 102009, 102038, 102039, 102051, 102142, 102143,
102171, 102172, 102179, 102180, 102190, 102315, 102405, 102415,
102427, 102529, 102537, 102549, 102624, 102634, 102638, 102661,
102735, 102783, 102799, 102800, 102801, 102812, 102837, 102850,
102878, 102879, 102898, 102960, 102969, 102970, 103, 103011,
103012, 103071, 1040494, 1040529, 1040622, 1040652, 1040668,
1040681, 1040682, 1040683, 1040733, 1040777, 1040778, 1040779,
1040781, 1040804, 1040805, 1040806, 1040812, 1040813, 1040814,
1040815), atod = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1)), row.names = c(NA, 100L), class = "data.frame")
Thank you very much for your help!
You can find the row indexes where the first column matches any value in agents$id. This will create a vector with a length that is equal to the number of rows in your original data frame.
change_these <- info[ ,1] %in% agents$id
You can then use this information to set the values in data frame that match your rows and columns
info$atod[change_these] <- 1

RMSE Error with Random Forest Model

I am trying to train a random forest model, but I'm getting the following error. Is there a different setting I need to use for a classification model to resolve the RMSE issue? I tried converting "good" to a factor but that threw a new error.
Error:
Error in train.default(x, y, weights = w, ...) :
Metric RMSE not applicable for classification models
5 stop(paste("Metric", metric, "not applicable for classification models"))
4 train.default(x, y, weights = w, ...)
3 train(x, y, weights = w, ...)
2 train.formula(good ~ ., data = train, method = "rf", trControl = trainControl(method = "cv",
5), ntree = 251)
1 train(like ~ ., data = train, method = "rf", trControl = trainControl(method = "cv",
5), ntree = 251)
The code I'm using to train the model is below. I'm trying to classify the records in the dataset as "good" based on the values in variables 1-3.
Code:
set.seed(13518) # For reproducibile purpose
inTrain <- createDataPartition(SampleTestData$good, p=0.70, list=F)
train <- SampleTestData[inTrain, ]
test_train <- SampleTestData[-inTrain, ]
if(!exists("model1"))
{
model1 <- train(good ~ ., data=train, method="rf", trControl=trainControl(method="cv", 5), ntree=251)
}
I've included some sample data below. I used dput to output the data as the text below.
Data:
structure(list(good = c("True", "True", "True", "False", "False",
"True", "True", "True", "True", "False", "True", "True", "True",
"True", "False", "False", "False", "True", "False", "False",
"True", "False", "True", "False", "True", "False", "True", "True",
"False", "False", "True", "True", "False", "True", "True", "True",
"True", "False", "False", "False", "False", "True", "False",
"True", "True", "True", "False", "True", "False", "True", "False",
"True", "True", "True", "False", "False", "True", "False", "True"
), variable1 = c("TRUE", "TRUE", "TRUE", "TRUE",
"FALSE", "TRUE", "FALSE", "TRUE", "TRUE", "FALSE", "FALSE", "TRUE",
"TRUE", "TRUE", "TRUE", "TRUE", "FALSE", "TRUE", "FALSE", "TRUE",
"TRUE", "FALSE", "TRUE", "TRUE", "TRUE", "FALSE", "FALSE", "FALSE",
"TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE",
"TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "FALSE", "FALSE",
"TRUE", "TRUE", "TRUE", "FALSE", "TRUE", "TRUE", "FALSE", "TRUE",
"TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "FALSE", "TRUE"), variable2 = c("TRUE",
"TRUE", "TRUE", "TRUE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE",
"FALSE", "TRUE", "TRUE", "TRUE", "FALSE", "TRUE", "TRUE", "FALSE",
"TRUE", "FALSE", "TRUE", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE",
"FALSE", "FALSE", "FALSE", "TRUE", "TRUE", "FALSE", "TRUE", "TRUE",
"TRUE", "TRUE", "FALSE", "FALSE", "TRUE", "TRUE", "FALSE", "FALSE",
"TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "TRUE", "FALSE",
"TRUE", "TRUE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE",
"FALSE", "FALSE", "TRUE"), variable3 = c("FALSE", "FALSE",
"FALSE", "FALSE", "FALSE", "FALSE", "TRUE", "FALSE", "FALSE",
"FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
"FALSE", "TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
"FALSE", "TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
"FALSE", "TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
"FALSE", "FALSE", "FALSE", "FALSE", "TRUE", "FALSE", "FALSE",
"FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "TRUE", "FALSE",
"TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE",
"TRUE")), .Names = c("good", "variable1", "variable2",
"variable3"), class = "data.frame", row.names = c(5078L,
5087L, 5366L, 5568L, 7017L, 8123L, 8145L, 8525L, 11777L, 12355L,
12586L, 12675L, 14912L, 15503L, 15530L, 15533L, 15598L, 15634L,
15749L, 15842L, 16216L, 16718L, 16744L, 16792L, 17928L, 20351L,
20417L, 21083L, 22382L, 23698L, 23807L, 23879L, 23900L, 30431L,
30897L, 31084L, 31803L, 32007L, 32806L, 37487L, 37656L, 38284L,
38291L, 38471L, 38786L, 40303L, 40724L, 41222L, 41248L, 41837L,
42994L, 44423L, 45216L, 46233L, 47012L, 50446L, 52429L, 53197L,
54590L))
Converting good to a factor actually seems to solve the problem. All of the variables in the data set have values of TRUE or FALSE and are character type. So why does random forest default to regression instead of classifier for this case?
Code that solved the issue:
SampleTestData$good = as.factor(SampleTestData$good)

Resources