-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deletion of columns deletes more columns than expected #24
Comments
Hmm, I don't see the problem in your screenshot when you just show The command example_df <- example_df[,2] indeed won't work with RTutor. Using the same variable on the left and right in an assignment is often problematic in RTutor. More precisely, problems arise if calling the command twice would yield different results than calling it only once. This restriction is hard to fix in RTutor. So in particular deleting columns or rows won't work. If you want to do this you have to set a new variable name on the LHS. |
Yes you are right. Maybe something I will have a look at down the line. Right now I was able to circumvent the problem as per your suggestion. And you are right that just showing example_df[,-2] did indeed deliver the desired output. I confused myself there. |
Just as a remark. Unrelated to the limitations of RTutor I also try to write my personal R code (at least the one outside packages) such that I can run a line twice without changing the result. E.g. if I want to remove a column, I like most to use a function like: remove.cols = function(dat, cols) {
dat[,setdiff(colnames(dat), cols)]
} which returns the same data frame even when called errorneously twice. (I don't like e.g. that |
Hello, its me again. I found pretty strange behavior regarding the deletion of columns of a data frame (and possibly a matrix, not tested). Please find a MWE attached.
MinDelExample_sol.zip
![DeletionBehavior](https://user-images.githubusercontent.com/5664368/84273246-bc0c7600-ab2e-11ea-9118-b40fea99b7a3.png)
The text was updated successfully, but these errors were encountered: