similar to: Bilateral matrix

Displaying 20 results from an estimated 2000 matches similar to: "Bilateral matrix"

2018 May 08
3
Bilateral matrix
or in base R : ?xtabs ?? as in: xtabs(~previous_location + current_location,data=x) (You can convert the 0s to NA's if you like) Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, May 8, 2018 at 9:21 AM, Huzefa
2018 May 16
0
Bilateral matrix
Dear Bert and Huzefa, Apologies for the late reply, my account got hacked and I have just managed to recover it. Thank you very much for your replies and the solutions. Both work well. I was wondering if there was any way to ensure (force) that all possible combinations show up in the output. The full dataset has 25 cities but of course people have not moved from Boston to all the other 24
2018 May 08
0
Bilateral matrix
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", "New York"), class =
2018 May 16
2
Bilateral matrix
xtabs does this automatically if your cross classifying variables are factors with levels all the cities (sorted, if you like): > x <- sample(letters[1:5],8, rep=TRUE) > y <- sample(letters[1:5],8,rep=TRUE) > xtabs(~ x + y) y x c d e a 1 0 0 b 0 0 1 c 1 0 0 d 1 1 1 e 1 1 0 > lvls <- sort(union(x,y)) > x <- factor(x, levels = lvls) > y <-
2018 May 17
0
Bilateral matrix
Dear William and Ben, Thank you for your replies and elegant solutions. I am having trouble with the fact that two of the previous locations do not appear in current locations (that is no one moved to OKC and Dallas from other cities), so these two cities are not being included in the output. I have provided a better sample of the data and the ideal output (wide form - a 10x10 bilateral matrix)
2018 Apr 29
1
Overlay line on a bar plot - multiple axis
Dear all, I am trying to make a similar plot - https://peltiertech.com/images/2013-09/BarLineSampleChart4.png. I have data for two variables; count and z by city and week. I would like to have a horizontal bar plot of *count* by city and a line plot of weekly average of the variable *z*. I have tried the following: ggplot() + geom_bar(data=dat, aes(x=city, y=count),
2012 Oct 14
3
Pivot Table "like" structure
HI Team, I am currently working on problem and stumped on "for" loop. Data: structure(list(Coutry = structure(c(3L, 3L, 3L, 3L, 2L, 2L, 1L, 1L), .Label = c("J", "M", "U"), class = "factor"), State = structure(c(1L, 1L, 4L, 2L, 5L, 5L, 3L, 6L), .Label = c("A", "C", "K", "O", "S",
2018 Mar 25
3
Take average of previous weeks
Dear all, I have weekly data by city (variable citycode). I would like to take the average of the previous two, three, four weeks (without the current week) of the variable called value. This is what I have tried to compute the average of the two previous weeks; df = df %>% mutate(value.lag1 = lag(value, n = 1)) %>% mutate(value .2.previous = rollapply(data = value.lag1,
2018 Mar 26
1
Take average of previous weeks
Dear Bert, Thank you very much.This works. I was wondering if the fact that I want to create new variables (sorry for not stating that fact) makes any difference? Thank you again. Sincerely, Milu On Sun, Mar 25, 2018 at 10:05 PM, Bert Gunter <bgunter.4567 at gmail.com> wrote: > I am sure that this sort of thing has been asked and answered before, > so in case my suggestions
2018 Mar 25
0
Take average of previous weeks
I am sure that this sort of thing has been asked and answered before, so in case my suggestions don't work for you, just search the archives a bit more. I am also sure that it can be handled directly by numerous functions in numerous packages, e.g. via time series methods or by calculating running means of suitably shifted series. However, as it seems to be a straightforward task, I'll
2016 Apr 10
2
Adding Two-Headed Arrow in map legend
Dear David, The device was the issue. The quartz() device works fine but pdf() does not. Now I just need to figure out the limits for map for Europe. Thanks for all your help and patience. Sincerely, Milu On Sun, Apr 10, 2016 at 7:10 PM, David Winsemius <dwinsemius at comcast.net> wrote: > > > On Apr 10, 2016, at 4:12 AM, Miluji Sb <milujisb at gmail.com> wrote: > >
2016 Apr 10
2
Adding Two-Headed Arrow in map legend
Hello David, This is exactly what I want but I still can't get the arrows. R and R studio is updated. Thanks again! Sincerely, Milu On Sat, Apr 9, 2016 at 10:29 PM, David Winsemius <dwinsemius at comcast.net> wrote: > > > On Apr 9, 2016, at 1:27 PM, David Winsemius <dwinsemius at comcast.net> > wrote: > > > > > >> On Apr 9, 2016, at 11:18 AM,
2016 Apr 09
2
Adding Two-Headed Arrow in map legend
Forgot to copy the list Dear Jim, Thank you for your reply. I must be doing something wrong, If this is my command to plot a map of Europe: eps_europe <- mapCountryData(n, nameColumnToPlot="eps_score", mapTitle="EPS Score - Europe",colourPalette=colourPalette, catMethod="fixedWidth", missingCountryCol = "white",
2016 Apr 09
2
Adding Two-Headed Arrow in map legend
Dear David, Thank you for your answer. Sorry for the embarrassing mistake. However, even with when I generate a map for the whole world using: eps <- mapCountryData(n, nameColumnToPlot="eps_score", mapTitle="EPS Score",colourPalette=colourPalette, catMethod="fixedWidth", missingCountryCol = "white", addLegend=FALSE) And then use:
2016 Apr 08
2
Adding Two-Headed Arrow in map legend
I am trying to draw maps for the world using: library(rworldmap) library(maptools) library(RColorBrewer) tmp2<- dput(head(pece,10)) structure(list(iso3 = c("AUS", "AUT", "BEL", "CAN", "CHE", "CHL", "CZE", "DEU", "DNK", "ESP"), eps_score = c(0.877343773841858, 2.68984365463257,
2016 Apr 09
2
Adding Two-Headed Arrow in map legend
> On Apr 9, 2016, at 11:18 AM, David Winsemius <dwinsemius at comcast.net> wrote: > > >> On Apr 9, 2016, at 10:46 AM, Miluji Sb <milujisb at gmail.com> wrote: >> >> Dear David, >> >> Thank you for your answer. Sorry for the embarrassing mistake. However, even with when I generate a map for the whole world using: >> >> eps <-
2011 Jun 09
2
Problem with a if statement inside a function
I have a really long functions, and at the end of the function, I am using a if statement to tag certain keywords based on whether they have certain values contained in them. However, the if statement doesn't seem to work. When I had split up the commands into various functions, it worked fine, but I'm not sure what going on now that it's combined into a single function. myfunc
2016 Apr 10
0
Adding Two-Headed Arrow in map legend
> On Apr 10, 2016, at 1:45 PM, Miluji Sb <milujisb at gmail.com> wrote: > > Dear David, > > The device was the issue. The quartz() device works fine but pdf() does not. Now I just need to figure out the limits for map for Europe. Thanks for all your help and patience. After plotting a map of Europe with base graphics the coordinates of the lower-left and upper-right
2016 Apr 10
0
Adding Two-Headed Arrow in map legend
> On Apr 10, 2016, at 4:12 AM, Miluji Sb <milujisb at gmail.com> wrote: > > Hello David, > > This is exactly what I want but I still can't get the arrows. R and R studio is updated. Thanks again! I didn't try it in Rstudio until just now (and I don't remember that you ever mentioned RStudio as a possible issue.) The plotting I see in the default graphics Rstudio
2016 Apr 09
0
Adding Two-Headed Arrow in map legend
> On Apr 9, 2016, at 10:46 AM, Miluji Sb <milujisb at gmail.com> wrote: > > Dear David, > > Thank you for your answer. Sorry for the embarrassing mistake. However, even with when I generate a map for the whole world using: > > eps <- mapCountryData(n, nameColumnToPlot="eps_score", mapTitle="EPS Score",colourPalette=colourPalette, >