Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
In R studio I have imported one .csv file which has two columns X and Y.
But when I try to use plot(X,Y), I get the error message:
"Object X not found"
I believe Alex's answer above is correct. The plot() function is complaining that X is not a variable, and you've already said it was a column instead. The "data" parameter tells plot not to try and interpret X and Y as variables, but as columns of a dataframe.
It would also work to use
plot(<name_of_dataframe>$X ~ <name_of_dataframe>$Y)
Where you replace <name_of_dataframe> with the actual name of the object that you imported the .csv into.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I defined several dummy variables and I can see them in my dataset. However, when I try to run a regression model, R says that Error: object "my_variable" not found. I also used exists(my_variable) and got the same error message. I checked for the spelling and it was not a problem.
I'd appreciate it if someone can help.
First, when you use exists(), you should put the variable in quotations (i.e., exists("my_variable")).
Second, be sure that you set up your regression model properly. For example:
lm(response ~ predictor1 + predictor2 + predictor3 + ...,
data=my_variable)
Ultimately, you need to include some of your data via dput(head(my_variable)), and the regression code.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
When I try to import dataset in R, it tells me this: "Error in View : object "GenomeTOT" not found" (where GenomeTOT is the name of the file). I can not understand why since I am importing the file directly from the environment so I choose it. How to solve this problem? The txt file has 3 columns and 55302 rows, so I do not know if it maybe a problem due to the size.
Why you do not try to upload in coding way?
data <- read.delim("filename.txt")
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I am trying to convert factors from a data-frame to numeric using the commands
data[] <- lapply (data, function(x) as.numeric(as.character(x))
But it keeps asking me for more coding. What am I doing wrong?
The data-frame is named data and it consists of 50 rows and 2 columns. Will this command change every variable in numeric right? Or shall I do something else?
screenshot after using 'dput' at http://imgur.com/Sde9QSk.png
Shouldn't you add ) at the end of your code?
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am trying to use c50 here what I did
train$default<-as.factor(train$default)
result<-C5.0(train[-17],train$default)
finalresult <- predict(result, test)
I am trying to run the following command table(test, Predicted=finalresult)in the R soft
but it is giving the following error
Error in sort.list(y): 'x' must be atomic for sort list
any suggestions?
You did not state how test looks. Since it is used for a prediction it presumably contains features and the value you want to predict. Assuming test$answer is what you want to predict. Try
table(test$answer, Predicted=finalresult)
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I read a few questions that you have already answered however, it doesn't seem to make sense in my situation. you stated in someone else question that they were writing their line as if they were using a function as a dataframe. I get the following error message for the line below:
"Error in data[train, ] : object of type 'closure' is not subsettable"
booastmodel<- ada(default ~ .,data=data[train,],iter=50,bag.frac=0.5,control=rpart.control(maxdepth=30,
+ cp=0.01,minsplit=20,xval=10))
what am I doing wrong?
The error message means that data is a function. And indeed that’s how data is predefined in R. You probably misspelled your variable name (i.e. your variable isn’t called data).