Hi
maybe
which(abs(data)>0.3, arr.ind=T)
row col
Loss_EV_Amygdala_SF_left_hemisphere 15 2
Loss_EV_Amygdala_SF_left_hemisphere 15 3
Loss_PE_Amygdala_SF_right_hemisphere 5 7
Loss_PE_Amygdala_SF_left_hemisphere 13 9
Gives you what you want.
> sel<-which(abs(data)>0.3, arr.ind=T)
> data[sel]
[1] 0.3268234 0.3451718 0.3116239 0.3316836
Regards.
Petr
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Patzelt, Edward
> Sent: Thursday, October 02, 2014 10:18 PM
> To: R-help at r-project.org
> Subject: [R] Identifying Values in Dataframe
>
> R Help -
>
> I'd like to identify each correlation value in the dataframe below
> above/below .3/-.3 in order to graph the original data points. I've
> started
> with the call below to identify each value by it's row and column.
I'd
> like
> to form a data object that identifies each set of variables that meet
> the
> criteria and then use that to graph the original data.
>
> *do.call(cbind, lapply(list(row = row(data, T), col = col(data, T),
> value > data), as.character))*
> structure(c(-0.0228976615669603, 0.0228976615669603,
> 0.0345568787488209,
> -0.0345568787488209, 0.0704941162950863, 0.0501672252097525,
> 0.119766411337358, 0.0697823742392512, 0.0223273454311378,
> -0.0223273454311378,
> 0.125952482472234, -0.125952482472234, -0.0748856339421511,
> -0.0353553864437216,
> 0.199331873910442, -0.068756564596986, 0.0188033303819659,
> -0.0188033303819659,
> 0.124483870344689, -0.124483870344689, 0.158304442010968,
> -0.158304442010968,
> -0.00291892981576431, 0.00291892981576431, 0.289784855159971,
> 0.197017018634618, 0.0725645607308865, 0.0960039687045857,
> 0.145044311433109,
> -0.145044311433109, 0.228975321916426, -0.228975321916426,
> 0.26388395000877,
> 0.175954114053622, 0.326823414986536, 0.0464304517962428,
> 0.171060413427109,
> -0.171060413427109, 0.125608489395663, -0.125608489395663,
> 0.170699125959079,
> -0.170699125959079, -0.0537588992684595, 0.0537588992684595,
> 0.237938136557008, 0.130101348701669, 0.0420659299644508,
> 0.140016889896702,
> 0.175781963301805, -0.175781963301805, 0.277913325677977,
> -0.277913325677977,
> 0.250436246834054, 0.149310941080417, 0.345171759606147,
> 0.0499822279379925,
> 0.180291553611261, -0.180291553611261, 0.0983047617452837,
> -0.0983047617452837,
> 0.0908629320478729, -0.0908629320478729, 0.0162624158794471,
> -0.0162624158794471, 0.219099271324641, 0.143898328556892,
> 0.0808498509449568,
> 0.0534039458771934, 0.103639895676339, -0.103639895676339,
> 0.224298317217259,
> -0.224298317217259, 0.13939241528796, 0.0923125296440915,
> 0.2952647762031,
> -0.0573156158960486, 0.126972946909388, -0.126972946909388,
> 0.145176640269481,
> -0.145176640269481, 0.176722440639515, -0.176722440639515,
> -0.110517827771672,
> 0.110517827771672, 0.265161677824653, 0.0349452421080511,
> -0.00586032680446085,
> 0.17140674405117, -0.0141919172668973, 0.0141919172668973,
> 0.0416754535115447,
> -0.0416754535115447, 0.110687511145091, 0.163199987771469,
> 0.174846924599677,
> 0.116657756754811, 0.184924363876472, -0.184924363876472,
> 0.0740138506321435,
> -0.0740138506321435, 0.0653341995281647, -0.0653341995281647,
> 0.101098966521841, -0.101098966521841, -0.0263969055123976,
> -0.129660641707532,
> 0.16313101271814, -0.0000382052406584783, 0.118309823316179,
> -0.118309823316179, 0.0408519777835592, -0.0408519777835592,
> -0.15406959482671, -0.274340973979869, 0.1465995621482,
> -0.0608360452726588,
> -0.00570057335076342, 0.00570057335076342, 0.0988132735291764,
> -0.0988132735291764, 0.159498629897594, -0.159498629897594,
> -0.0258437210789338,
> 0.0258437210789338, 0.311623918577701, 0.0959243386674064,
> 0.0373444291324758,
> 0.131601179184854, 0.0032064022008327, -0.0032064022008327,
> 0.0126042917937794,
> -0.0126042917937794, 0.0288999352531186, 0.0343919995425096,
> 0.0375647873892517, 0.0734866249695526, 0.125835994106989,
> -0.125835994106989,
> 0.0557071876372764, -0.0557071876372764, 0.0190687287223345,
> -0.0190687287223345, 0.0301326072710063, -0.0301326072710063,
> 0.0881640884608706, 0.0600194980037123, 0.0948090975231923,
> 0.0259282757599189,
> 0.120417132810781, -0.120417132810781, 0.196695581235906,
> -0.196695581235906,
> 0.166210300278382, 0.0252645245285897, 0.239953962041662,
> -0.013933692494363,
> 0.0174600644363753, -0.0174600644363753, 0.169008089964054,
> -0.169008089964054,
> 0.0503612778194372, -0.0503612778194372, 0.175816302924921,
> -0.175816302924921,
> 0.141434785651191, 0.0824019401386654, 0.173429908437586,
> -0.136795834367563,
> 0.219543981806626, -0.219543981806626, 0.290697487363267,
> -0.290697487363267,
> 0.331683649439792, -0.0035319780591347, 0.237371764540467,
> -0.172828690804139,
> 0.00922163769628213, -0.00922163769628213, 0.275507919516733,
> -0.275507919516733, 0.128267529853407, -0.128267529853407,
> -0.16619622911667,
> 0.16619622911667, 0.102467428865746, -0.115779804556684,
> 0.000997318666924614,
> 0.297139396802529, 0.040957786791642, -0.040957786791642,
> -0.0160650315621922,
> 0.0160650315621922, -0.043765426943726, -0.0637020898937285,
> 0.142863591010818, 0.214059283535989, 0.13975223034564, -
> 0.13975223034564,
> -0.0286586386843802, 0.0286586386843802, 0.13735028629468,
> -0.13735028629468,
> -0.147016933653806, 0.147016933653806, 0.174438743129307,
> -0.0116564727226121,
> -0.0413775943824046, 0.136551598575573, 0.0614942508131549,
> -0.0614942508131549,
> 0.0687487372508148, -0.0687487372508148, -0.0352587211103196,
> -0.0872464182568976, 0.162247767446472, 0.0282617081917608,
> 0.175608445537029,
> -0.175608445537029, -0.0339260764991994, 0.0339260764991994,
> 0.130002432167221, -0.130002432167221, -0.141752408742242,
> 0.141752408742242,
> 0.126603115520512, -0.0784556105378803, -0.0736773348350251,
> 0.154815164010555, -0.102200077602115, 0.102200077602115,
> -0.137144378194025,
> 0.137144378194025, 0.0132012835622079, 0.113105077279414,
> -0.0412435172396771,
> 0.182836991911806, 0.109656132908221, -0.109656132908221,
> -0.0341578533716874,
> 0.0341578533716874, -0.0155952702450936, 0.0155952702450936,
> 0.0962494517693934, -0.0962494517693934, 0.0745517006304259,
> 0.145954619132309, 0.0997683764233029, -0.0562240100001912,
> 0.13254524166143,
> -0.13254524166143, 0.236418162977751, -0.236418162977751,
> 0.0878486801199713,
> -0.00445794916320147, 0.227619583487885, -0.14911359391431,
> 0.0214260010937822,
> -0.0214260010937822, 0.120246543167583, -0.120246543167583), .Dim >
c(20L,
> 13L), .Dimnames =
list(c("Loss_Gain_PE_Amygdala_SF_right_hemisphere",
> "Gain_Loss_PE_Amygdala_SF_right_hemisphere",
> "Loss_Gain_EV_Amygdala_SF_right_hemisphere",
> "Gain_Loss_EV_Amygdala_SF_right_hemisphere",
> "Loss_PE_Amygdala_SF_right_hemisphere",
> "Gain_PE_Amygdala_SF_right_hemisphere",
> "Loss_EV_Amygdala_SF_right_hemisphere",
> "Gain_EV_Amygdala_SF_right_hemisphere",
> "Loss_Gain_PE_Amygdala_SF_left_hemisphere",
> "Gain_Loss_PE_Amygdala_SF_left_hemisphere",
> "Loss_Gain_EV_Amygdala_SF_left_hemisphere",
> "Gain_Loss_EV_Amygdala_SF_left_hemisphere",
> "Loss_PE_Amygdala_SF_left_hemisphere",
> "Gain_PE_Amygdala_SF_left_hemisphere",
> "Loss_EV_Amygdala_SF_left_hemisphere",
> "Gain_EV_Amygdala_SF_left_hemisphere",
> "Loss_Gain_PE_Amygdala_LB_right_hemisphere",
> "Gain_Loss_PE_Amygdala_LB_right_hemisphere",
> "Loss_Gain_EV_Amygdala_LB_right_hemisphere",
> "Gain_Loss_EV_Amygdala_LB_right_hemisphere"),
c("hare2f1", "hare2f2",
> "hare4", "hare", "ext_t",
"total_barrat_11_imputed", "mcq_k",
> "ppitots", "ppi_1_corrected",
"ppi_2_corrected", "total_buss_perry",
> "hareResidNetExt", "extResidNetHare")))
>
> --
>
> *Edward H Patzelt | Clinical Science PhD StudentPsychology | Harvard
> University SNPLab http://scholar.harvard.edu/buckholtz
> <http://scholar.harvard.edu/buckholtz>*
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.
________________________________
Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a jsou ur?eny
pouze jeho adres?t?m.
Jestli?e jste obdr?el(a) tento e-mail omylem, informujte laskav? neprodlen? jeho
odes?latele. Obsah tohoto emailu i s p??lohami a jeho kopie vyma?te ze sv?ho
syst?mu.
Nejste-li zam??len?m adres?tem tohoto emailu, nejste opr?vn?ni tento email
jakkoliv u??vat, roz?i?ovat, kop?rovat ?i zve?ej?ovat.
Odes?latel e-mailu neodpov?d? za eventu?ln? ?kodu zp?sobenou modifikacemi ?i
zpo?d?n?m p?enosu e-mailu.
V p??pad?, ?e je tento e-mail sou??st? obchodn?ho jedn?n?:
- vyhrazuje si odes?latel pr?vo ukon?it kdykoliv jedn?n? o uzav?en? smlouvy, a
to z jak?hokoliv d?vodu i bez uveden? d?vodu.
- a obsahuje-li nab?dku, je adres?t opr?vn?n nab?dku bezodkladn? p?ijmout;
Odes?latel tohoto e-mailu (nab?dky) vylu?uje p?ijet? nab?dky ze strany p??jemce
s dodatkem ?i odchylkou.
- trv? odes?latel na tom, ?e p??slu?n? smlouva je uzav?ena teprve v?slovn?m
dosa?en?m shody na v?ech jej?ch n?le?itostech.
- odes?latel tohoto emailu informuje, ?e nen? opr?vn?n uzav?rat za spole?nost
??dn? smlouvy s v?jimkou p??pad?, kdy k tomu byl p?semn? zmocn?n nebo p?semn?
pov??en a takov? pov??en? nebo pln? moc byly adres?tovi tohoto emailu p??padn?
osob?, kterou adres?t zastupuje, p?edlo?eny nebo jejich existence je adres?tovi
?i osob? j?m zastoupen? zn?m?.
This e-mail and any documents attached to it may be confidential and are
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender.
Delete the contents of this e-mail with all attachments and its copies from your
system.
If you are not the intended recipient of this e-mail, you are not authorized to
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by
modifications of the e-mail or by delay with transfer of the email.
In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately
accept such offer; The sender of this e-mail (offer) excludes any acceptance of
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into
any contracts on behalf of the company except for cases in which he/she is
expressly authorized to do so in writing, and such authorization or power of
attorney is submitted to the recipient or the person represented by the
recipient, or the existence of such authorization is known to the recipient of
the person represented by the recipient.