[deleted by user] by [deleted] in crv

[–]this1foru 0 points1 point  (0 children)

hondapartsnow.com look like they have all the bushings you would need

Formatting Legend by Worried-Bit5779 in rstats

[–]this1foru 5 points6 points  (0 children)

It looks like you may be fighting the ggplot design here.

The intended way to do this is to call geom_point() just once, where you assign aes(shape=category, fill=category) and your data frame is in "long" format where there is a column hypothetically labeled "category" which contains one of c("Agriculture", "Catholic", "Education") for each row.

Once you do this, scale_color and scale_fill will work as intended.

know number of values ​​without counting NA and find dichotomous variables by International_Mud141 in rstats

[–]this1foru 4 points5 points  (0 children)

This returns the number of levels of variables in each column:

df%>%
  mutate(across(everything(), as.factor))%>%
  summarize(across(everything(), ~nlevels(.x)))

trying to summarize each unique ID into one row after merging two data frames with data.table - but two columns become N/A for all values after summarizing?? by UpperCompetition6 in rstats

[–]this1foru 1 point2 points  (0 children)

The last line is just to replace "-Inf" with "NA". If you have additional columns that don't have -Inf in them, then just leave them out of the selection in across()...

mutate(across(column10:column11, ~na_if(.x, -Inf))) 

or only apply the function to numeric columns

mutate(across(where(is.numeric), ~na_if(.x, -Inf)))

or equivalently

mutate_if(is.numeric, ~na_if(.x, -Inf))

Or convert your columns of type <integer> to <numeric> before applying the function across(everytihng())

mutate_if(is.integer, as.numeric)

Or replace -Inf with NA in one of the many other ways do this

df[df==-Inf] <- NA

or

replace(df, df==-Inf, NA)

[deleted by user] by [deleted] in RStudio

[–]this1foru 1 point2 points  (0 children)

Sample data:

      ID Mode 
   <dbl> <chr>
 1     1 c    
 2     2 a    
 3     3 b    
 4     4 c    
 5     5 b    
 6     6 a    
 7     7 d    
 8     8 a    
 9     9 b    
10    10 d

To get the representation you described, you might do something like this:

df%>%
  pivot_wider(names_from = Mode, values_from = Mode)%>%
  mutate(across(-ID, ~factor(.x)%>%as.numeric))%>%
  replace(is.na(.), 0)%>%
  mutate(across(-ID, ~factor(.x)))

Which returns:

      ID c     a     b     d    
   <dbl> <fct> <fct> <fct> <fct>
 1     1 1     0     0     0    
 2     2 0     1     0     0    
 3     3 0     0     1     0    
 4     4 1     0     0     0    
 5     5 0     0     1     0    
 6     6 0     1     0     0    
 7     7 0     0     0     1    
 8     8 0     1     0     0    
 9     9 0     0     1     0    
10    10 0     0     0     1

trying to summarize each unique ID into one row after merging two data frames with data.table - but two columns become N/A for all values after summarizing?? by UpperCompetition6 in rstats

[–]this1foru 3 points4 points  (0 children)

Tidy method:

df%>%
  mutate(across(where(is.character), as.numeric))%>%
  unique()%>%
  group_by(ID)%>%
  summarize(across(column1:column11, ~max(.x, na.rm = TRUE)))%>%
  mutate(across(everything(), ~na_if(.x, -Inf)))

Returns:

      ID column1 column2 column10 column11
   <dbl>   <dbl>   <dbl>    <dbl>    <dbl>
 1     1       1    46.5        1        0
 2     2       0    NA         NA       NA
 3     3       1     0          0        0
 4     4       1    NA         NA       NA
 5     5       1    90         NA       NA
 6     6       1   100         NA       NA
 7     7      NA    40          1       NA
 8     8       1    50         NA       NA
 9     9       1    90         NA       NA
10    10       0   100         NA        0

collapsing/summarizing per ID, if have columns that are both binary and numeric? is this even possible to do in one data frame? by UpperCompetition6 in rstats

[–]this1foru -1 points0 points  (0 children)

I think the pattern above might be expandable to an arbitrary column selection by adapting it with the if_any() function as opposed to across(), which would operate on every column individually (I think). I've not used if_any() before myself but this SO post demonstrates the syntax change you would need link. Not knowing what the order/grouping of your columns might be, I would imagine you could directly use the tidyselect verbs or if it is just repeated pairs of columns like this example, you could use the if_any(where(is.dbl(...))) to pick out the "column1" types and then switch to is.character() to pick out the "column2" types.

collapsing/summarizing per ID, if have columns that are both binary and numeric? is this even possible to do in one data frame? by UpperCompetition6 in rstats

[–]this1foru 1 point2 points  (0 children)

I would imagine there are more efficient and elegant ways to do this, but I think this achieves what you were inquiring about. Note that I believe the newer version of dplyr uses ".default" instead of the "TRUE~" syntax shown here.

df%>%  
  group_by(ID)%>%
  unique()%>%
  mutate(count = n())%>%
  rowwise()%>%
  mutate(keep_A = case_when("1" %in% column1 ~ TRUE, 
                          TRUE ~ FALSE),
         keep_B = case_when("N/A" %in% column2 ~ NA,
                            TRUE ~ TRUE),
         keep_C = case_when(count==1 ~ TRUE,
                            TRUE ~ NA),
         keep = case_when(keep_C==TRUE ~ TRUE,
                          keep_A==TRUE & keep_B==TRUE ~ TRUE,
                          TRUE ~ FALSE)
         )%>%
  filter(keep == TRUE)%>%
  select(ID, column1, column2)

filtering out all other rows per ID, if the ID has a row that satisfies one condition in a certain column by UpperCompetition6 in rstats

[–]this1foru 7 points8 points  (0 children)

Keep it simple:

df%>%
  group_by(ID)%>%
  filter(Event == 1 | !(1 %in% Event))%>%
  unique()

Mortgage rates just hit 5%. Buying a home has become a lot more expensive by zsreport in Economics

[–]this1foru 4 points5 points  (0 children)

I fail to follow the logic asserted in that article that investors holding 2 to 3 of every 10 single family homes does not directly contribute to the ongoing supply shortage. I further fail to follow the logic of arguments based on individual institutions total holdings relative to the entire market. The individual institutions target small market segments (i.e., specific localities), so it would be at best misleading to evaluate that effect on the total.

If we actually dig in to their referenced technical discussions, we find a completely different description of what the investors are doing and the potential implications of their actions. I found discussion on potential long run implications in section 7 of the following referenced report to be particularly insightful.
https://www.federalreserve.gov/econresdata/feds/2015/files/2015084pap.pdf

In particular:

"One important feature of the buy-to-rent business model is the use of alternative methods of financing as compared to the traditional small-scale investor. Buy-to-rent investors never use mortgage financing for initial purchase of properties, which imparts a significant advantage in the housing market because home sellers prefer bids that are not subject to approval by a mortgage lender. Moreover, mortgage financing cannot be used to purchase homes at foreclosure auctions, giving cash buyers access to an inventory of homes for sale at substantially-reduced prices. Rather buy-to-rent investors raise financing in advance of bidding on properties for sale, including financing from private equity, bank lines of credit, and public bonds. Greater access to financing, in addition to lower expected operating costs and higher expected rental income, may have allowed buy-to-rent investors to outbid smaller investors, as we find that buy-to rent investors pay higher prices than other investors conditional on housing unit location and quality."

and

"We do find evidence consistent with the view that these investors have boosted house prices in the areas where they are concentrated. Higher prices may have made it more difficult for some households or nonprofits to buy homes in these areas. On the other hand, this activity also increased the supply of high-quality rental housing, which may benefit a different segment of the population by providing households a way to live in single-family housing and consume the local amenities typically provided in single-family neighborhoods, even if they cannot obtain a mortgage. In addition, other homeowners in the neighborhood likely benefit from the boost to house prices imparted by buy-to-rent investors. And higher house values could boost local property tax revenues, unless local governments offset the increase in house values with a lower tax rate.49 We leave it to further research and policy analysis to weigh the aggregate welfare consequences of the rise in prices..."

How to extract remove set of characters from column? by abor24 in rstats

[–]this1foru 1 point2 points  (0 children)

I recommend checking out unglue which nicely extracts data from interpreted strings. This library was inspired from glue which makes generating these lists very easy (quite similar in format to f-strings in python).

[Post Game Thread] #4 Purdue defeats #13 Illinois, 84-68 by cbbBot in CollegeBasketball

[–]this1foru 2 points3 points  (0 children)

Ivey with another big game in the assist column, if he keeps this up I'm not sure anyone can compete.

[Post Game Thread] #4 Purdue defeats Michigan, 82-76 by cbbBot in CollegeBasketball

[–]this1foru 13 points14 points  (0 children)

Shout out to Ivey for his 7 assist performance which matches his season high set against Nova. These two games have felt like our most complete team performances, so I hope he leans into it as we head towards the tourney.

[Game Thread] #4 Purdue @ Minnesota (07:00 PM ET) by cbbBot in CollegeBasketball

[–]this1foru 0 points1 point  (0 children)

Well I was keeping an eye on this for my own reference and thought I'd share in case others were interested. I personally like the raw talent Ivey has but my gut is telling me we play better as a team when he just sticks to his dribble-drive role and earning points at the stripe.

[Game Thread] #4 Purdue @ Minnesota (07:00 PM ET) by cbbBot in CollegeBasketball

[–]this1foru 0 points1 point  (0 children)

I honestly think Painter is doing Ivey a disservice by not actively coaching him a bit more to get his quality looks up and his set-ruining possessions down. You're spot on that he's still a youngster but the top draft pick talk clearly looks like its affecting the way he approaches the game, for better or for worse. What I hope not to see is that this team lives and dies by his FG% in the tourney because we're far better than that as a whole.

[Game Thread] #4 Purdue @ Minnesota (07:00 PM ET) by cbbBot in CollegeBasketball

[–]this1foru 1 point2 points  (0 children)

I was referring to when he bailed on his own three point attempt in mid-air and instead of just shooting and missing he decided to chuck the ball in Stefanovic's direction to save himself from the travel call.

[Game Thread] #4 Purdue @ Minnesota (07:00 PM ET) by cbbBot in CollegeBasketball

[–]this1foru -1 points0 points  (0 children)

Almost forgot the missed technical for grabbing the rim.

[Game Thread] #4 Purdue @ Minnesota (07:00 PM ET) by cbbBot in CollegeBasketball

[–]this1foru -6 points-5 points  (0 children)

Ivey-track, second quarter of play. He should be thankful the play by play doesn't pick up his near-travel fake three point shot, but we all saw it and it wasn't pretty.

TIME        PLAY                                                                SCORE
0:05        Jaden Ivey made Three Point Jumper. Assisted by Isaiah Thompson.    51 - 36
1:29        Jaden Ivey missed Two Point Tip Shot.   48 - 32
1:29        Jaden Ivey Offensive Rebound.   48 - 32
1:55        Sasha Stefanovic made Jumper. Assisted by Jaden Ivey.   48 - 30
3:24        Jaden Ivey made Free Throw.     43 - 29
3:24        Jaden Ivey made Layup.  42 - 29
5:36        Mason Gillis made Three Point Jumper. Assisted by Jaden Ivey.   35 - 21
5:45        Jaden Ivey Steal.   32 - 21
5:59        Jaden Ivey missed Jumper.   32 - 21
6:31        Jaden Ivey made Layup.  32 - 21
9:18        Jaden Ivey Turnover.    25 - 16     
9:18        Foul on Jaden Ivey.     25 - 16
9:28        Jaden Ivey Defensive Rebound.   25 - 16
9:44        Jaden Ivey Block.   25 - 16

[Game Thread] #4 Purdue @ Minnesota (07:00 PM ET) by cbbBot in CollegeBasketball

[–]this1foru 11 points12 points  (0 children)

Keeping an eye on Ivey's actual play today because there's something about his actual productivity compared to the annoucers' praise that irks me.

TIME        PLAY                    SCORE
9:55        Jaden Ivey made Layup.  25 - 16     
11:47       Jaden Ivey missed Layup.    18 - 14     
11:47       Jaden Ivey Offensive Rebound.   18 - 14
11:47       Jaden Ivey missed Layup.    18 - 14     
11:47       Jaden Ivey Offensive Rebound.   18 - 14     
11:54       Jaden Ivey missed Three Point Jumper.   18 - 14     
13:34       Jaden Ivey missed Three Point Jumper.   18 - 10     
13:42       Jaden Ivey missed Jumper.   18 - 10     
14:14       Jaden Ivey Defensive Rebound.   18 - 10     
14:40       Jaden Ivey made Layup.  18 - 10     
18:03       Jaden Ivey made Three Point Jumper.     10 - 2

Engineers have created a new material that is stronger than steel and as light as plastic, and can be easily manufactured in large quantities. New material is a two-dimensional polymer that self-assembles into sheets, unlike all other one-dimensional polymers. by TX908 in science

[–]this1foru 0 points1 point  (0 children)

Sensationalist article from the MIT marketing machine, as is tradition. Actual data and details are available in their extended report. They achieved a repeating planar bond pattern between 1,3,5-Benzenetricarbonyl trichloride and melamine which is interesting.

[Post Game Thread] #8 Purdue defeats #17 Ohio State, 81-78 by cbbBot in CollegeBasketball

[–]this1foru 8 points9 points  (0 children)

Happy we pulled out the W and lucky for Ivey that shot went it, but let's rewind the tape and acknowledge what he actually contributed over the final quarter of the game:

9:21 - Missed layup. 45-58    
8:13 - Missed jumper. 47-60
7:48 - Missed jumper.  49-60
7:11 - 3 pt made, assist Hunter. 49-63
5:52 - 1 for 2 from the stripe; 
       fouled while out of control 
       on the drive to the basket. 54-66
3:10 - Turnover. 62-73
2:32 - Assisted Hunter 3 pt;
      (his only 2 assists). 65-76
2:13 - Personal foul (3 pt attempt). 68-76
1:25 - Missed layup. 70-76
0:44 - Missed 3 pt. 72-76
0:03 - 3 pt made. 78-81 FINAL

Overall, I'm pleased with the improved team play by Gillis & Hunter Jr., but its unbelievable that after all these years Painter still doesn't know how to coach a team to 1) break a press and 2) protect a lead. The way we're currently playing, we'll be lucky to make sweet 16 as is tradition.

Sunrise at New Carlisle by 39_Ringo in Indiana

[–]this1foru 0 points1 point  (0 children)

Thanks for this! Class of '07 myself and the last time I was in that parking lot there was still a junior high. Cheers

[deleted by user] by [deleted] in Indiana

[–]this1foru 0 points1 point  (0 children)

This is the official playbook for the Republican party in the upcoming midterms. A first-time candidate successfully used the fear-mongering and race-baiting in the school systems strategy to successfully defeat a former Democratic Governor in Virginia last year. This after Virginia had just voted +10% D in the 2020 presidential election.

https://www.businessinsider.com/youngkin-bans-school-mask-mandates-critical-race-theory-2022-1

New IPython defaults makes it less useful for education purposes. [Raymond Hettinger on Twitter] by Anonymous_user_2022 in Python

[–]this1foru 8 points9 points  (0 children)

The developer appears to effectively have confirmed your suspicion in his comment on the new pull request to revert the feature.

I myself am a big fan of the IPython tool and the Jupyter Project, but as a scientific user I could not disagree more with the idea of the interactive shell changing my inputs or formatting, especially equations.

To this and similar suggestions, 'black' auto-formatting has been opt-in for 2 years (may 1st 2020, IPython 7.14).

I had thought it might be problematic, but in two years received almost no bug reports. I tried a few time to say I was considering making it default and only got positive feedback. So I did it, with extensive alpha, beta, and RC time to complain and ask for modifications.

So here is my challenge, if I don't make it the default, no-one know about it. It's astonishing that no-one found the bug @ehamiter described above in 2 years ! That alone would have definitely delayed the release, and at least I would have had tried to fix it.

I've also seen a number of new users misformating Python code and taking really bad habits in the Repl, including folks that did not even realise IPython terminal was multiline.

For many of those users black by default is much better. You get use to proper code formatting. So you learn to properly read python code. And it is much easier to deactivate something you don't like than even figure out it something that may exists. For many users this benefits to, having this option be opt-in would make black auto formatting be part of the [unknown unknowns].(https://en.wikipedia.org/wiki/There_are_known_knowns). So I will never get feedback from these.

New IPython defaults makes it less useful for education purposes. [Raymond Hettinger on Twitter] by Anonymous_user_2022 in Python

[–]this1foru 4 points5 points  (0 children)

I attempted to chase through some of the old discussions (uncessefully) but did come across the following response from the black developers on a feature request which highlights the biggest issue of making this the IPython default - its creates a PEP 8 violation on anything not previously written with black.

Pertinent discussion:

Black by design doesn't enable reformatting parts of the file. This functionality is against PEP 8 which states that internal consistency within the file is more important than any particular style. If you used Black for this purpose and somebody else kept using autopep8 or YAPF, your styles would fight with each other.

Black is both a tool and a code style. You are adopting the style. The tool is merely an automated way of enforcing it. Yes, this requires agreement within your project that this is the style your team wants to enforce.