ernesto villarino
2013-Sep-11 08:23 UTC
[R] include variable of a dataframe in other dataframe
Hello Ian.
I explained wrong myself.
summary (data.all.evp)
Year Month Long Lat z
Min. :1959 Jan :124200 Min. :-74.0 Min. :36.0 Min.
:-5615.00
1st Qu.:1970 Feb :124200 1st Qu.:-52.0 1st Qu.:43.0 1st
Qu.:-3451.25
Median :1982 Mar :124200 Median :-29.5 Median :50.5 Median
:-1393.00
Mean :1982 Apr :124200 Mean :-29.5 Mean :50.5 Mean
:-1706.32
3rd Qu.:1993 May :124200 3rd Qu.: -7.0 3rd Qu.:58.0 3rd Qu.:
3.25
Max. :2004 Jun :124200 Max. : 15.0 Max. :65.0 Max. :
2997.00
(Other):745200
> summary (data.fut.evp)
Lat Long Month Year SST
SSS
Min. :36.0 Min. :-74.0 Jan : 267300 Min. :2001 Min.
:-1.9 Min. : 0.0
1st Qu.:43.0 1st Qu.:-52.0 Feb : 267300 1st Qu.:2025 1st Qu.:
8.7 1st Qu.:33.8
Median :50.5 Median :-29.5 Mar : 267300 Median :2050 Median
:12.0 Median :34.7
Mean :50.5 Mean :-29.5 Apr : 267300 Mean :2050 Mean
:12.5 Mean :34.2
3rd Qu.:58.0 3rd Qu.: -7.0 May : 267300 3rd Qu.:2075 3rd
Qu.:16.3 3rd Qu.:35.3
Max. :65.0 Max. : 15.0 Jun : 267300 Max. :2099 Max.
:31.7 Max. :39.7
(Other):1603800 NA's
:803088 NA's :805464
> 90*30*12*46 (lat*long*month*year, data.all.evp)
[1] 1490400> 90*30*12*100 (lat*long*month*year,data.fut.evp)
[1] 3240000
If you look to z (it is unique for the 30*90=2700 lat and long combinations
every month, but then it is the same for every years or months.
You got me ?
I am going to try your code, and let you know,
Cheers,
Ernes
On Wed, Sep 11, 2013 at 6:41 AM, I.Renner [via R] <
ml-node+s789695n4675835h22@n4.nabble.com> wrote:
> Hi Ernesto,
>
> I should first convey that I am by no means an expert, so I'm sure
someone
> will have a more elegant solution.
>
> One thing that seems strange is that there appear to be fewer depth values
> (1557192) than rows in the data frame for which you would like to include
> them (3207600).
>
> z.new = rep(NA, dim(data.fut.evp)[1])
> z.index = match(paste(data.fut.evp$Lat, data.fut.evp$Long),
> paste(data.all.evp$Lat, data.all.evp$Long))
> z.new = data.all.evp$z[z.index]
> data.fut.evp$z = z.new
>
> Hope this helps,
>
> Ian
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
>
http://r.789695.n4.nabble.com/include-variable-of-a-dataframe-in-other-dataframe-tp4675730p4675835.html
> To start a new topic under R help, email
> ml-node+s789695n789696h13@n4.nabble.com
> To unsubscribe from include variable of a dataframe in other dataframe,
click
>
here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4675730&code=dmlsbGFyaW5vLmVybmVzdG9AZ21haWwuY29tfDQ2NzU3MzB8MTkyMDIyNTY3Mw==>
> .
>
NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context:
http://r.789695.n4.nabble.com/include-variable-of-a-dataframe-in-other-dataframe-tp4675730p4675845.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]