Icon

R Extract data from baseballr package with R community nodes - KNIME Forum (77634)

URL: R Extract data from baseballr package with R community nodes - KNIME Forum (77634) https://forum.knime.com/t/using-baseballr-in-knime/77634/5?u=mlauber71
URL: KNIME and R — installation across operating systems — some remarks https://medium.com/p/6494a2a498cc
URL: KNIME R Scripting extension (Community) https://hub.knime.com/mpicbg-tds/extensions/de.mpicbg.tds.knime.scripting.r.feature/latest/
URL: KNIME scripting extension (community) https://github.com/knime-mpicbg/knime-scripting/wiki

R Extract data from baseballr package with R community nodes - KNIME Forum (77634)

https://forum.knime.com/t/using-baseballr-in-knime/77634/4?u=mlauber71

KNIME and R — installation across operating systems — some remarks

https://medium.com/p/6494a2a498cc


KNIME scripting extension (community)

https://github.com/knime-mpicbg/knime-scripting/wiki

In order for the community R nodes to work you will have to run Rserve in the background in an R session


# You must start RServe outside of KNIME (in RStudio) - this is necessary for the Community nodes of R

# https://forum.knime.com/t/r-source-community-node-connection-error/13087/2?u=mlauber71


library(Rserve)

library(RSclient)

Rserve(port = 6311, debug = FALSE, args = "--vanilla")


# start the RServe(er)

rsc <- RSconnect(port = 6311)


# shutdown the server after you used it. Execute this once you are done!!

RSshutdown(rsc)


library(baseballr)

# Example: Fetching player statistics for a specific player

# Use playerid_lookup to get player's ID based on name

player_stats <- playerid_lookup("Trout", "Mike")

# Ensure the output is explicitly a data frame

player_stats_df <- as.data.frame(player_stats)

# Output the data frame

rOut <- player_stats_df

R Source (Table)
fails sometimes ...
R Snippet
R Source (Table)
Convert to Table
an examplehow to transfer data
R Snippet
R Source
R Snippet
Convert to Table
the baseballrexample .. fails ...
R Snippet
results.table
Table Writer

Nodes

Extensions

Links