0

I'm very new to R and am trying to do something simple-- select data from my file and run a statistical test against two groups. My code to select one group of data is:

R_works[44, "Dec 22 07": "Nov. 26 2011"]

because I am wanting the data from row 44, going from the columns titled Dec.. - Nov.. R also gave me the warnings:

In addition: Warning messages:
1: In check_names_df(j, x) : NAs introduced by coercion
2: In check_names_df(j, x) : NAs introduced by coercion

Any help is much appreciated! I know there are other questions/answers similar to this but it seems like the answers are tailored to the specific code? Thanks!!

r2evans
  • 141,215
  • 6
  • 77
  • 149
Emily
  • 1
  • 1
  • 1
  • 2
    We can provide little help if we don't know what the data looks like. Please copy the output of `dput(head(R_works))` into your question (in a [code block](https://stackoverflow.com/editing-help#syntax-highlighting)). – r2evans Jun 21 '19 at 19:16
  • I'm assuming you are using `tibble` and/or `dplyr`, are there other non-base packages in use here? It helps us to know things like this. (It might help to take a look at how to ask questions *well*, in a way that will greatly help us understand and provide usable fixes/answers back to you. See https://stackoverflow.com/questions/5963269, https://stackoverflow.com/help/mcve, and https://stackoverflow.com/tags/r/info.) – r2evans Jun 21 '19 at 19:18

2 Answers2

0

TRY

R_works[44, c("Dec 22 07": "Nov. 26 2011")]

the c stands for "concatenate"... ie, it makes all the variables you're wanting as a list

svanalsten
  • 11
  • 1
0

try with this one:

R_works[44, c("Dec 22 07": "Nov. 26 2011")]

indexing starting from 44th row columns name as mentioned, c is used to concatenate.

zafar
  • 44
  • 4