Information about state.x77 dataset in R - r

I am a beginner in R. I tried to apply aggregate function to state.x77 dataset.
aggregate(state.x77,list(Region=state.region),mean)
aggregate(state.x77,list(Region=state.region,Cold=state.x77[,"Frost"]>130),mean)
I fail to see what the function does to the dataset since I don't know much information about the dataset. I have applied str() and summary() functions but to no avail. Please do someone shed light on it.

To get information about state.x77 tpye ?state.x77 into your console.

Related

How to describe cases included in analyses in R?

I'm very new to R and pretty basic with analyses generally. I successfully ran a regression in R, but a lot of my data are missing. I'm fine with that because R just ignores the missing observations in the analyses and shows me the dfs in the summary. My problems is that I'd like to look more into the observations that are included in the analyses, but I'm not sure how to do that.
I tried to do na.omit, but R created a dataset with far fewer observations than it used in the regressions, so I think that takes it too far.
Basically, I'm trying to get the ages for the respondents that were included in the final analyses, not just the ages of the entire sample, many of whom were not included in the analyses.
Any advice you can give me would be very appreciated!! Please let me know if you need more information.
Thank you!
Edited to include Screenshot of data.

Running an ICC analysis

Cannot run an ICC analysis in R
I have loaded my data from excel spreadsheet and have tried the following:
ICC(CMI)
I have removed my row names. I am not sure if I need to convert my columns or use a difference approach. I have loaded the Psych package.
This is my code: ICC(Test)
This is what comes back:
Error in stack.data.frame(x) : no vector columns were selected
Not sure of what this means or how to fix this? Thanks in advance for any help. I really appreciate it.
I had the same problem with a dataset. I suggest you try:
ICC(as.matrix(Test))
. This worked for me. Otherwise, type help(ICC) and check the example and compare the procedure used there compared to your data.
Good luck!

Replacement of NAs for in the variable?

Good evening,
I have dataset where there is one variable which is Gender with missing data. Could anyone please help me how could i replace these NAs using R Packages. I have tried the "Mice" package however it does not replace the NAs and its still exist in data under gender column. I have provide the sample data below with my codes. Thanks in advance for the support.
Dataset sample
R- codes used:
Used R-codes
Regards,
Kumar
That's too much code. You can try imputing the missing data with either of method="rf" or method="cart" although in my experience the cart method seems to be more accurate.
You could also use the preprocess function and either of medianImpute or knnImpute as it gives pretty good results for this kind of imputation.
Example with mice:
test_imp<-mice(df,m=5,method="cart",printFlag=F)
test_imputed<-complete(test_imp,3)#Selects third imputation
Example with preprocess
test_1<-preprocess(testdf,"medianImpute")
test_imputed<-predict(test_imputed,test_1)

Uploading a dataset in winbugs from R

I would like to know how to upload a data set from R packages to winbugs.
In particular, "LearnBayes" package in R has too many data sets. I would like to use one of them in Winbugs.
Can anyone help me with this?
I came across this link because I have no idea what WinBugs data is suppose to look like but I don't know if it works. It's an R Function that supposedly changes the typical dataset into this list thing and I got the function working but still not able to get the dataset working but I'm really stupid so you might have better luck.

SparkR - Convert dataframe into Vector/list

Can anyone tell me, whether we can convert data frame to list in SparkR. I am aware that collect() function helps you do that. However, it is not advisable when we use large amount of data. In python/Scala, there is a function called local Iterator() which will convert the data frame to list. Am struggling with that in SparkR. Can anybody help!
Unfortunatelly collect() is the best method to do this. You can also try: saveAsTextFile but in that case you probably will not obtain whole data.

Resources