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 using a function recursively and the function has to update the matrix. I passed the function as an argument, but it seems matrix can only be passed as the pass by value, because the moment program comes out of the scope of function matrix doesn't hold updated values. Since, I have to do multiple updates in the matrix recursively, I have to pass it as a parameter.
Any help is appreciated.
Thanks in Advance
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 3 years ago.
Improve this question
I am trying to calculate the standard deviation from scratch in R (I do know R has a build-in function for that), but I'm not getting the correct results, so I don't know what I'm doing wrong.
My.SD<-function(X) {
M<-(sum(X)/length(X))
my.var<-sum((X-M)^2)
StanDev<-sqrt(my.var/length(X))
print(StanDev)
}
I guess you might need to use (length(X)-1) rather than length(x), i.e.,
My.SD<-function(X) {
M<-(sum(X)/length(X))
my.var<-sum((X-M)^2)
StanDev<-sqrt(my.var/(length(X)-1))
print(StanDev)
}
since here it should be sample standard deviation.
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
I have a task a bit complicated for my knowledge in R. I need to reproduce this graphic of the figure in R, I performed several searches and could not find anything. The main thing is to be able to reproduce the graphic (it doesn't have to be identical), subtitles are not so important. Any ideas on how to do it or just using another program? Thanks!!
Check also the facet_share() function of the ggpol package, very handy for population pyramids/comparisons
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 have a tree structure lists in R (lists of lists of arbitrary depth). This was formed by taking a multidimensional array in R and using the function array_tree from the purrr package. I would like to apply a function to tips of the tree (e.g., a recursive map) without having to flatten the structure.
How can I do this?
I realize that actually the at_depth and vec_depth functions are exactly what I am looking for.
at_depth(a, vec_depth(a))
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)