Hi, huge fan of your videos. I have researched for days with no result, so I am desperately reaching out. In excel, you can write a conditional statement "if (condition) then (true value) , (false value). In excel, those true/false values can reference the value of another column. Example: If c"animal" = zebra, then reference corresponding value in column "zebra stripes", if not then blank. How do you do this in R? It wont seem to let me reference the corresponding value of another column as the "true" or "false" output results of a conditional
Hello! In such cases, ifelse() function could be very useful. Depending on if a new variable will be created or an existing variable will be updated, you can run either of the code lines below. data$new_col
Joachim: What a resource you are! I am so happy to have found your site. I am taking a MOOC Coursera class and have been stymied with this error. Your explanation of the cause has been very eyeopening, but I am still unable to overcome the error. Here is the code I am entering. It seems R is "seeing" brackets even though I am entering parentheses. Please help and thank you in advance. > prefsABCsex.2 = read.csv
>View(prefsABCsex.2) > prefsABCsex.2$Subject = factor(prefsABCsex.2$Subject) Error in prefsABCsex.2$Subject : object of type 'closure' is not subsettable > summary(prefsABCsex.2) Error in object[[i]] : object of type 'closure' is not subsettable > prefsABCsex.2$Subject = factor(prefsABCsex.2$Subject) Error in prefsABCsex.2$Subject : object of type 'closure' is not subsettable
Hey, thanks a lot for the wonderful feedback, glad you like my tutorials! :) Are you sure that the import of your file (i.e. this line of code prefsABCsex.2 = read.csv) worked fine? What happens if you run head(prefsABCsex.2) ?
Hi, I put this shapiro.test(data$IL6[data$Genotype=="WT" & data$Time==0]) and the message was: Error in data$IL6 : object of type 'closure' is not subsettable. Could you help me please.
Hello Juliet, It is strange because I can't see any problem when I check the code and also run it after creating a data set for demonstration. See below. data
Hi! what happens when this appears in RMarkdown, I'm creating a barplot and it does work in a normal script but when I put it on the RMarkdown I have this: "Object of Type Closure is not Subsettable"
Hey Sandra, I have not seen this error in RMarkdown myself yet. However, I found this thread, which seems to discuss this: stackoverflow.com/questions/37943824/how-to-solve-r-markdown-knit-closure-is-not-subsettable I hope this helps! Joachim
Hi, huge fan of your videos. I have researched for days with no result, so I am desperately reaching out. In excel, you can write a conditional statement "if (condition) then (true value) , (false value). In excel, those true/false values can reference the value of another column.
Example: If c"animal" = zebra, then reference corresponding value in column "zebra stripes", if not then blank.
How do you do this in R? It wont seem to let me reference the corresponding value of another column as the "true" or "false" output results of a conditional
Hello!
In such cases, ifelse() function could be very useful. Depending on if a new variable will be created or an existing variable will be updated, you can run either of the code lines below.
data$new_col
Joachim: What a resource you are! I am so happy to have found your site. I am taking a MOOC Coursera class and have been stymied with this error. Your explanation of the cause has been very eyeopening, but I am still unable to overcome the error. Here is the code I am entering. It seems R is "seeing" brackets even though I am entering parentheses. Please help and thank you in advance.
> prefsABCsex.2 = read.csv
>View(prefsABCsex.2)
> prefsABCsex.2$Subject = factor(prefsABCsex.2$Subject)
Error in prefsABCsex.2$Subject :
object of type 'closure' is not subsettable
> summary(prefsABCsex.2)
Error in object[[i]] : object of type 'closure' is not subsettable
> prefsABCsex.2$Subject = factor(prefsABCsex.2$Subject)
Error in prefsABCsex.2$Subject :
object of type 'closure' is not subsettable
Hey, thanks a lot for the wonderful feedback, glad you like my tutorials! :) Are you sure that the import of your file (i.e. this line of code prefsABCsex.2 = read.csv) worked fine? What happens if you run head(prefsABCsex.2) ?
Hi, I put this shapiro.test(data$IL6[data$Genotype=="WT" & data$Time==0]) and the message was: Error in data$IL6 : object of type 'closure' is not subsettable. Could you help me please.
Hello Juliet,
It is strange because I can't see any problem when I check the code and also run it after creating a data set for demonstration. See below.
data
Hi! what happens when this appears in RMarkdown, I'm creating a barplot and it does work in a normal script but when I put it on the RMarkdown I have this: "Object of Type Closure is not Subsettable"
Hey Sandra, I have not seen this error in RMarkdown myself yet. However, I found this thread, which seems to discuss this: stackoverflow.com/questions/37943824/how-to-solve-r-markdown-knit-closure-is-not-subsettable I hope this helps! Joachim
Hello, what if I was using $ sign? but the same error occured?
Hello Enkhzaya,
Could you please share your code?
Regards,
Cansu