NAs when attempting to get standard error

Mirscar

R is doing a very strange thing where it is not giving me an error message and instead just not computing what I've told it to compute. I'm attempting to find the standard error of a variable and the command is producing NAs instead and I cannot figure out why. Here's my code for getting the mean and standard error:

ReHo_mean_Esc_1 <- ReHo_Group_Esc_1 %>% group_by(Group) %>% summarise(Value=mean(Value), se=sd(Value)/sqrt(n()))

My variable of interest is called Value. Here's my dataframe:

ID  Clu Group Value Esc Nal 
422 1   LgA 3.26090 94  7.50
501 1   LgA 3.32376 139 15.25
503 1   LgA 2.76855 24  31.50
521 1   LgA 1.81475 -28 6.75
522 1   LgA 1.80966 58  13.00
523 1   LgA 3.97502 76  10.25
603 1   LgA 1.78573 76  18.00
604 1   LgA 3.70577 54  10.00
605 1   LgA 2.93304 51  18.00
613 1   LgA 3.68118 116 17.00
429 1   ShA 2.61634 -33 5.75
430 1   ShA 3.39848 13  12.75
431 1   ShA 3.40785 -33 9.75
432 1   ShA 4.38024 50  4.75
513 1   ShA 4.14605 8   10.50
514 1   ShA 3.86332 0   10.75
518 1   ShA 2.96312 0   13.00
519 1   ShA 2.82937 -33 7.50
610 1   ShA 5.07850 13  26.00
612 1   ShA 4.14895 56  4.00
614 1   ShA 3.83926 42  8.25

My summarize command has no issues producing the mean for each group but it gives me NAs for the standard error and I have no idea why. Any ideas?

Thanks!

Edward

Don't name your new variable Value. dplyr is different to base R in that it allows newly created variables to be immediately available within the same function.

ReHo_Group_Esc_1 %>% 
  group_by(Group) %>% 
  summarise(mValue=mean(Value), se=sd(Value)/sqrt(n()))
# A tibble: 2 x 3
  Group mValue    se
  <chr>  <dbl> <dbl>
1 LgA     2.91 0.266
2 ShA     3.70 0.223

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Attribute error when attempting to get a value for field

Method not allowed error when attempting to get session data with Flask

When attempting to apply range properties to a range or cells i get an error

When attempting to compile a boost project I get the following error

Error when attempting distance() with raster

Error when attempting to use the heap

Error when trying to serialize multiple followers:Got AttributeError when attempting to get a value for field `email` on serializer `UserSerializer`

"Attempting to Reference a deleted function" error when attempting to initialize static RenderWindor

'Trying to get property of non-object' error when attempting ->num_rows on inner join statement

Golang - SignatureDoesNotMatch error from S3 when attempting GET request

When attempting to upgrade to latest Hapi.js (9.x) we get: Error: Unknown handler: directory

Why do I get the error "no `block_on` in `executor`" when attempting to block on an async function?

Why do I get the error: "cannot communicate with the debug host process" when attempting to execute an SSIS package?

When attempting to deploy a business network I get an error 'Failed parsing HTTP/2' in grpc

Python - Error when attempting to control inputs

error (Reducer: ) when attempting to do distinct reduce

Encountering error 08001 when attempting to connect to database

PHP error when attempting to install Loganalyzer 4.1.5

403 Forbidden Error when attempting to authenticate

Postgresql Syntax Error when attempting to create a type

configmaps is forbidden error when attempting helm ls

Error when attempting to combine limit with paginate

Confusing error when attempting to start the Jupyter notebook

Error when attempting cross validation in python

Error when attempting to copy inherited permissions

Error when attempting to submit form with Rvest

Mutating error when attempting to append an array of a struct

mySQL: Error when attempting to create a Foreign Key

Error when attempting to write cProfile information to file