Re: [R] Help needed with eval parse

2019-09-18 Thread Huzefa Khalil
That worked! Thanks for the explanation. On Wed, Sep 18, 2019 at 10:06 AM Duncan Murdoch wrote: > > On 18/09/2019 8:43 a.m., Huzefa Khalil wrote: > > Hello R-users, > > > > I have been running a script which produces objects based on the > > column names of

[R] Help needed with eval parse

2019-09-18 Thread Huzefa Khalil
Hello R-users, I have been running a script which produces objects based on the column names of a data.frame. The column names are of the form CB_1-1, CB_1-2, etc. Now this calculation was rather long and memory intensive, so I would rather not have to do it again after fixing the column names

Re: [R] RStudio 1.1.453 - Windows 10 - How to subset named vector by names that are NOT "foo"

2018-07-31 Thread Huzefa Khalil
try: vect[which(names(vect) != "foo")] On Tue, Jul 31, 2018 at 1:41 PM, إبراهيم خطاب Ibrauheem Khat'taub wrote: > H > i All, > > If I have this vector: > >> vect <- c(foo = 11, bar = 2, norf = 45) > > I can have a subset that has only "bar and "norf" this way: >> vect[c("bar","norf")] > > Now

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Huzefa Khalil
Hi Bogdan, Does the following do what you expect? x$intersectA[[i]] <- c(x$intersectA[[i]], x$labA[j]) Note the difference between `[[` and `[` On Wed, Jul 25, 2018 at 9:26 AM, Bogdan Tanasa wrote: > Dear Thierry and Juan, thank you for your help. Thank you very much. > > Now, if I would

Re: [R] Forecasting tutorial "Basic Forecasting"

2018-05-15 Thread Huzefa Khalil
Instead of Tsp = c(2016, 2018, 12) try Tsp = c(2016, 2018.25, 12) Hence, you can specify the object as structure(c(5973156.76, 5159011.2, 6695766.64, 6365359, 6495218.53, 7226302.39, 6835272.7, 7383501.57, 6962748.19, 7623278.72, 7274994.33, 7919421.8, 7360740.81, 7436693.35, 8545765.55,

Re: [R] Bilateral matrix

2018-05-08 Thread Huzefa Khalil
Dear Miluji, If I understand correctly, this should get you what you need. temp1 <- structure(list(id = 101:115, current_location = structure(c(2L, 8L, 8L, 3L, 6L, 5L, 1L, 2L, 7L, 4L, 2L, 8L, 8L, 3L, 6L), .Label = c("Austin", "Boston", "Cambridge", "Durham", "Houston", "Lynn", "New Orleans",

Re: [R] Converting a list to a data frame

2018-05-02 Thread Huzefa Khalil
Hi Kevin, There is probably a better way, but it can be done in two steps like this temp <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8)) temp <- lapply(names(temp), function(n, temp) { temp[[n]]$type <- n return(temp[[n]]) }, temp = temp) do.call(rbind, temp) On Wed, May

Re: [R] Help creating the IBM Randu function

2017-08-14 Thread Huzefa Khalil
RIBE and more, see > 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. -- Huzefa Khalil PhD Candidate, Department of Political Science, Univ

Re: [R] is.null(mylist[1]) and is.null(mylist$a) returns different values

2017-06-15 Thread Huzefa Khalil
t; __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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, r

Re: [R] ggplot2

2016-04-12 Thread Huzefa Khalil
Hi James, If you want to specify the y-values, you need to use stat="identity" as below: ggplot(probability, aes(x=Fertilizer, y=prob)) + geom_bar(stat="identity", aes(fill=Treatment)) best, huzefa On Tue, Apr 12, 2016 at 1:02 PM, James Henson wrote: > Dear R Community,

Re: [R] Get object name inside lapply

2016-02-25 Thread Huzefa Khalil
If you want the object names, you should use lapply over the names: lapply(names(c), function(x) {c[[x]]}) On Thu, Feb 25, 2016 at 5:25 PM, Uwe Ligges wrote: > > > On 25.02.2016 22:27, Mohammad Tanvir Ahamed via R-help wrote: > >> Hello, >> >> I want to get

Re: [R] filtering a data frame from a column of type integer

2016-02-15 Thread Huzefa Khalil
This is because of the presence of NA's in your "station_RT" column. If you use which(), it will give you the correct result: station_list <- df[which(df$station_RT==142), ] best, huzefa On Mon, Feb 15, 2016 at 11:39 AM, Stefano Sofia < stefano.so...@regione.marche.it> wrote: > Dear R list

Re: [R] xts/zoo index problem?

2016-01-18 Thread Huzefa Khalil
["2016-01-18 15:31:54.0"] > value > 2016-01-18 15:31:54 2 > >> a["2016-01-18 15:31:54.07"] > value > >> a["2016-01-18 15:31:54.079"] > value > 2016-01-18 15:31:54 2 > > > why it doesn't

Re: [R] xts/zoo index problem?

2016-01-18 Thread Huzefa Khalil
Try a["2016-01-18 15:31:54.079"] The question though is why R displays the milliseconds as "078", when it is clearly "079"... -h On Mon, Jan 18, 2016 at 8:55 PM, ce wrote: > Dear all, > > I have this code : > > library(xts) > a <- structure(c(1,2), class = c("xts",