How to solve invalid symbol coordinate error - r

I am trying to run a line of code from a manual but each time I get this error Error in symbols(x = coords[, 1], y = coords[, 2], bg = vertex.color, : invalid symbol coordinates
Now, this is my code
LGHomDf_P1 <- bridgeHomologues(pseudohom_stack = P1_homologues_5,
linkage_df = SN_DN_P1,
LOD_threshold = 5,
automatic_clustering = TRUE,
LG_number = 7,
parentname = "P1",
log = "Logfile_tetra.Rmd")
I have been reading some post on the forum but I could not find any information.
Moreover, I do not think I have to use igraph because it is not mentioned at all in the manual.
Moreover the package that I am using is called PolyMappeR.

Related

Error message on when charting efficient frontier in r studios

When I run this line of code, I get the error message:
chart.RiskReward(maxret, risk.col = "StdDev", return.col = "mean",
chart.assets = "False")
chart.EfficientFrontier(maxret, match.col="StdDev", n.portfolios=100, type="l", tangent.line=FALSE)
Error in seq.default(from = minret, to = maxret, length.out = n.portfolios) :
'from' must be a finite number

How do I contour a smoothScatter plot with missing values in r studio?

This is the code I am using
smoothScatter(longesttimeon$nhmc,longesttimeon$pt2,nrpoints=0)
smoothScatter(longesttimeon$nhmc,longesttimeon$pt2,nrpoints=0,colramp=colorRampPalette(c("white","dodgerblue2","gold","firebrick")))
library(readxl)
kern <- kde2d(longesttimeon$nhmc, longesttimeon$pt2)
contour(kern, drawlabels = FALSE, nlevels = 6,
col = rev(heat.colors(6)), add = TRUE, lwd = 3)
I get this error sign
Error in kde2d(longesttimeon$nhmc, longesttimeon$pt2) :
missing or infinite values in the data are not allowed
I am trying to make it look like this

Is there an R function to solve this ggmap error so I get my map?

I want to visualize something on a map with ggmap, this is a part of my code:
sf <- c(lon = 5.291266, lat = 52.1326332)
register_google(key = "static-maps-backend.googleapis.com")
map <- get_map(location = sf, zoom = 14, scale = 2, maptype = c("terrain"))
But I keep getting this error :
Error in aperm.default(map, c(2, 1, 3)) :
invalid first argument, must be an array
So I looked it up and ran the code below
devtools::install_github("dkahle/ggmap")
After this I still got the same error as above. What can I do so this error is resolved?

The "Object not found" is not visible

So I've been trying for a while now to successfully plot a custom 2D Latitude x Longitude map from a GAM I created (with package mgcv). However, I am encountering a problem. After I enter the following command:
myvis.gam(llgam, view = c("lat","long"), n.grid = 100,
plot.type = "contour", color = "jet", contour.col = "",
too.far = .05)
I receive the following error:
Error in myvis.gam(llgam, view = c("lat", "long"), n.grid = 100, plot.type = "contour", :
object 'v' not found
The reason for my confusion from this error is that there is no "v" object present in the script. I've never seen this before. Usually, if it states that object "x" is not found, object "x" is used in the script entered prior.
Any ideas? (What does it mean when it gives an error for an object that is not shown in the entered script?)
NOTE: The "myvis.gam" function is custom-made. It is essentially an edited version of the "vis.gam" script (package mgcv) and follows the same "usage" base:
vis.gam(x,view = NULL, cond = list(), n.grid = 30, too.far = 0, col = NA,
color = "heat", contour.col = NULL, se = -1, type = "link",
plot.type = "persp", zlim = NULL, nCol = 50, ...)
It also uses the same arguments.
If anyone wants the full code for this function, I am happy to give it. It's just lengthy.
Any help is greatly appreciated! :)

Weird behaviour than animating lines with rgl and rglwidget

I am trying to follow help and Internet examples to create a very simple animation of a 3d-line in R. This is just a test and my final goal is to use this functionality to visually verify results of some geometrical transformations on 3d-movement data that I am analysing. So basically I need nothing more than a ‘3d-player’ interface that allows for usual interaction (rotation, zoom, play, stop, slide).
I figured out that rgl package does the job and I am able to use it for the sphere/points animation. But now I need to use it on lines and I get very strange results. In the example below there are 4 points and two lines (cyan and red) that connect the same points but the red line is for some reason in the ‘wrong’ place. The animation doesn’t make sense neither. Now, I am thinking may be it is impossible to do >> to animate more than one vertex with more than one attribute? But I don’t see this in documentation and obviously it is possible because line is animated! I spent quite a long time trying to figure out what is going on and will appreciate any help/advise/directions. many thanks
Ps: Tthe code below is a chunk in the markdown file and I am using Rstudio.
require(rgl)
require(rglwidget)
p11=c(0,0,0)
p21=c(50,50,0)
p12=c(50,0,0)
p22=c(10,50,50)
saveopts <- options(rgl.useNULL = TRUE)
did=list()
did[[1]]=plot3d(rbind(p11,p21,p12,p22), type="s", alpha = 1, lwd = 5, col = c('brown','darkgreen','orange','green'))
did[[2]]=spheres3d(c(100,100,100), alpha = 1, lwd = 5, col = "blue",radius=2)
did[[3]]=lines3d(rbind(p11,p21),lwd=8, col='cyan',alpha=.9)
did[[4]]=planes3d(0, 0, 1, 0, alpha=.4, col='green')
did[[5]]=lines3d(rbind(p11,p21),lwd=2, col='red')
aspect3d(1, 1, 1)
did[[6]]=grid3d(c("x-", "z-"),at = NULL,col = "gray",lwd = .5,lty = 1,n = 5)
sceneT = rglwidget(elementId = "plot3dT",width=500, height=300) #%>%
rgl.ids()
rgl.attrib(id=did[[3]],attrib = c(1:length(did[[3]])))
playwidget(sceneT,list(
vertexControl(values = rbind(c(0,0,0,0,0,0),c(50,50,50,50,50,50)),
vertices = 1:6, attributes = "z", objid = did[[4]], param = 1:2,interp =T),
vertexControl(values = r1,
vertices = 1:2, attributes = c('x',"y","z",'x',"y","z"), objid = did[[5]], param = 1:2,interp =T)),
start = 1, stop = 2, step = .1, precision = 3)
options(saveopts)

Resources