stockPortfolio - subscript out of bounds - r
I am trying to get the return data for few stocks using getReturns function in stockPortfolio package. When I used the following code:
library(stockPortfolio)
stocks <- c("GODFRYPHL.NS", "ITC.NS", "VSTIND.NS", "BANARISUG.NS", "ASSAMCO.NS", "TATAGLOBA.NS", "CMC.NS", "SHREERAMA.NS", "MAX.NS", "BATAINDIA.NS", "RUBYMILLS.NS", "GRASIM.NS", "NATIONALU.NS", "MAHSEAMLE.NS", "JSWSTEEL.NS", "TATASTEEL.NS", "JINDALSTE.NS", "FOSECOIND.NS", "GUJFLUORO.NS", "ASIANPAIN.NS", "PILIND.NS", "MAHLIFE.NS", "UNITECH.NS", "BSELINFRA.NS", "LT.NS", "NOIDATOLL.NS", "RIIL.NS", "KEC.NS", "OPTOCIRCU.NS", "DIVISLAB.NS", "DRREDDY.NS", "GLAXO.NS", "ZEEL.NS", "OFSS.NS", "FINANTECH.NS", "INFY.NS", "TCS.NS", "BHARTIART.NS", "MOTHERSUM.NS", "BOSCHLTD.NS","MAHSCOOTE.NS", "MRF.NS", "ACC.NS", "RAMCOCEM.NS", "JPASSOCIA.NS", "ASAHIINDI.NS","VESUVIUS.NS", "HOTELEELA.NS", "TAJGVK.NS", "IGL.NS", "EDUCOMP.NS", "CONCOR.NS", "GDL.NS", "SHOPERSTO.NS", "DREDGECOR.NS", "GESHIP.NS", "KOTHARIPR.NS", "FAGBEARIN.NS", "HONAUT.NS", "BEL.NS", "AIAENG.NS", "THERMAX.NS", "AIL.NS", "ENGINERSI.NS", "TNTELE.NS", "ABB.NS", "BHEL.NS","SIEMENS.NS")
returns <- getReturns(stocks, freq="month", start='2006-04-01', end='2013-12-31',"overlapOnly")
I got the following error:
Error in R[thisRow - nRemoved, j] : subscript out of bounds
Any suggestions?
P.S: But it worked fine when the frequency of data was changed to freq="week".
Related
Is there a way to use is.finite in sparklyr?
I need to mutate a column so that non finite values are turned into zeroes. I am using this code to do it: df %>% mutate(column = replace(column, !is.finite(column), 0) This usually works in base R, and I've seen that the replace function also does in Sparklyr. However, is.finite isn't implemented in Sparklyr and I get the following error: Error: org.apache.spark.sql.AnalysisException: Undefined function: is.finite; line 14 pos 45 at org.apache.spark.sql.errors.QueryCompilationErrors$.noSuchFunctionError(QueryCompilationErrors.scala:1802) at org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$23.applyOrElse(Analyzer.scala:2049) at org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$23.applyOrElse(Analyzer.scala:2036) at org.apache.spark.sql.catalyst.trees.TreeNode.$anonfun$transformDownWithPruning$1(TreeNode.scala:615) at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:177) at org.apache.spark.sql.catalyst.trees.TreeNode.transformDownWithPruning(TreeNode.scala:615) at org.apache.spark.sql.catalyst.trees.TreeNode.$anonfun$transformDownWithPruning$3(TreeNode.scala:620) at org.apache.spark.sql.catalyst.trees.UnaryLike.mapChildren(TreeNode.scala:1249) at org.apache.spark.sql.catalyst.trees.UnaryLike.mapChildren$(TreeNode.scala:1248) at org.apache.spark.sql.catalyst.expressions.UnaryExpression.mapChildren(Expression.scala:519) at org.apache.spark.sql.catalyst.trees.TreeNode.transformDownWithPruning(TreeNode.scala:620) at org.apache.spark.sql.catalyst.trees.TreeNode.$anonfun$transformDownWithPruning$3(TreeNode.scala:620) at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:286) at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62) at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49) at scala.collection.TraversableLike.map(TraversableLike.scala:286) at scala.collection.TraversableLike.map$(TraversableLike.scala:279) at scala.collection.AbstractTraversable.map(Traversable.scala:108) at org.apache.spark.sql.catalyst.trees.TreeNode.mapChildren(TreeNode.scala:729) at org.apache.spark.sql.catalyst.trees.TreeNode.transformDownWithPruning(TreeNode.scala:620) at org.apache.spark.sql.catalyst.trees.TreeNode.$anonfun$transformDownWithPruning$3(TreeNode.scala:620) at org.apache.spark.sql.catalyst.trees.UnaryLike.mapChildren(TreeNode.scala:1249) at org.apache.spark.sql.catalyst.trees.UnaryLike.mapChildren$(TreeNode.scala:1248) at org.apache.spark.sql.catalyst.expressions.UnaryExpression.mapChildren(Expression.scala:519) at org.apache.spark.sql.catalyst.trees.TreeNode.transformDownWithPruning(TreeNode.scala:620) at org.apache.spark.sql.catalyst.plans.QueryPlan.$anonfun$transformExpressionsDownWithPruning$1(QueryPlan.scala:159) at org.apache.spark.sql.catalyst.plans.QueryPlan.$anonfun$mapExpressions$1(QueryPlan.scala:200) at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:177) at org.apache.spark.sql.catalyst.plans.QueryPlan.transformExpression$1(QueryPlan.scala:200) at org.apache.spark.sql.catalyst.plans.QueryPlan.recursiveTransform$1(QueryPlan.scala:211) at org.apache.spark.sql.catalyst.plans.QueryPlan.$anonfun$mapExpressions$3(QueryPlan.scala:216) at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:286) at scala.collection.immutable.List.foreach(List.scala:431) at scala.collection.TraversableLike.map(TraversableLike.scala:286) at scala.collection.TraversableLike.map$(TraversableLike.scala:279) at scala.collection.immutable.List.map(List.scala:305) at org.apache.spark.sql.catalyst.plans.QueryPlan.recursiveTransform$1(QueryPlan.scala:216) at org.apache.spark.sql.catalyst.plans.QueryPlan.$anonfun$mapExpressions$4(QueryPlan.scala:221) at org.apache.spark.sql.catalyst.trees.TreeNode.mapProductIterator(TreeNode.scala:459) at org.apache.spark.sql.catalyst.plans.QueryPlan.mapExpressions(QueryPlan.scala:221) at org.apache.spark.sql.catalyst.plans.QueryPlan.transformExpressionsDownWithPruning(QueryPlan.scala:159) at org.apache.spark.sql.catalyst.plans.QueryPlan.transformExpressionsWithPruning(QueryPlan.scala:130) at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper$$anonfun$resolveExpressionsWithPruning$1.applyOrElse(AnalysisHelper.scala:245) at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper$$anonfun$resolveExpressionsWithPruning$1.applyOrElse(AnalysisHelper.scala:244) at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.$anonfun$resolveOperatorsDownWithPruning$2(AnalysisHelper.scala:170) at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:177) at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.$anonfun$resolveOperatorsDownWithPruning$1(AnalysisHelper.scala:170) at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper$.allowInvokingTransformsInAnalyzer(AnalysisHelper.scala:323) at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.resolveOperatorsDownWithPruning(AnalysisHelper.scala:168) at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.resolveOperatorsDownWithPruning$(AnalysisHelper.scala:164) at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.resolveOperatorsDownWithPruning(LogicalPlan.scala:30) at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.resolveOperatorsWithPruning(AnalysisHelper.scala:99) at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.resolveOperatorsWithPruning$(AnalysisHelper.scala:96) at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.resolveOperatorsWithPruning(LogicalPlan.scala:30) at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.resolveExpressionsWithPruning(AnalysisHelper.scala:244) at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.resolveExpressionsWithPruning$(AnalysisHelper.scala:242) at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.resolveExpressionsWithPruning(LogicalPlan.scala:30) at org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$.apply(Analyzer.scala:2036) at org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$.apply(Analyzer.scala:2032) at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$1(RuleExecutor.scala:215) at scala.collection.IndexedSeqOptimized.foldLeft(IndexedSeqOptimized.scala:60) at scala.collection.IndexedSeqOptimized.foldLeft$(IndexedSeqOptimized.scala:68) at scala.collection.mutable.WrappedArray.foldLeft(WrappedArray.scala:38) at org.apache.spark.sql.catalyst.rules.RuleExecutor.executeBatch$1(RuleExecutor.scala:212) at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$6(RuleExecutor.scala:284) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at org.apache.spark.sql.catalyst.rules.RuleExecutor$RuleExecutionContext$.withContext(RuleExecutor.scala:327) at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$5(RuleExecutor.scala:284) at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$5$adapted(RuleExecutor.scala:274) at scala.collection.immutable.List.foreach(List.scala:431) at org.apache.spark.sql.catalyst.rules.RuleExecutor.execute(RuleExecutor.scala:274) at org.apache.spark.sql.catalyst.rules.RuleExecutor.execute(RuleExecutor.scala:188) at org.apache.spark.sql.catalyst.analysis.Analyzer.org$apache$spark$sql$catalyst$analysis$Analyzer$$executeSameContext(Analyzer.scala:227) at org.apache.spark.sql.catalyst.analysis.Analyzer.$anonfun$execute$1(Analyzer.scala:223) at org.apache.spark.sql.catalyst.analysis.AnalysisContext$.withNewAnalysisContext(Analyzer.scala:172) at org.apache.spark.sql.catalyst.analysis.Analyzer.execute(Analyzer.scala:223) at org.apache.spark.sql.catalyst.analysis.Analyzer.execute(Analyzer.scala:187) at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$executeAndTrack$1(RuleExecutor.scala:179) at org.apache.spark.sql.catalyst.QueryPlanningTracker$.withTracker(QueryPlanningTracker.scala:107) at org.apache.spark.sql.catalyst.rules.RuleExecutor.executeAndTrack(RuleExecutor.scala:179) at org.apache.spark.sql.catalyst.analysis.Analyzer.$anonfun$executeAndCheck$1(Analyzer.scala:208) at org.apache.spark.sql.catalyst.plans.logic
How to solve Warning in log(z) : NaNs produced in R?
I try to run K-S test simulation with different data and with GEV distribution but I get 50 warnings of Warning in log(z): NaNs produced This is my data t1 = 2.1466558 2.9447386 2.1410642 1.8847492 2.0233282 2.1907725 3.1755095 2.1142972 2.1889601 2.8422979 1.8555857 1.0429501 2.1383811 3.9976282 14.0612719 6.0016379 4.0426939 3.9845386 5.1821300 3.8703266 2.9009807 3.8450287 6.1019829 4.1811626 8.0737452 2.8416879 3.1656657 2.1342049 1.9984793 2.8037649 6.9629563 2.8223349 10.9695854 1.8985456 0.9444765 6.0065642 2.0394709 9.1677515 5.0589429 4.1036932 4.9599679 3.0425898 1.9477278 3.0447457 8.1563085 4.9423730 3.1336760 1.8389239 3.1262185 1.1628846 3.8445247 2.1454052 1.9209593 0.9197765 2.8171347 8.0249643 13.1267940 6.8506226 2.0811591 2.8517716 2.8864796 1.8227987 8.1442224 2.8798242 5.1112049 2.8529055 6.8265215 1.0436781 3.8380311 2.9659720 3.0153516 2.8497134 24.0545609 3.1952943 3.9564030 7.1348925 3.0067497 2.8581224 13.0294469 1.8576194 2.8081190 6.0940443 1.9729950 4.1334539 9.9874363 2.0489537 1.9479052 2.8050009 3.1097060 8.9115900 23.8376271 3.9219177 2.9991323 3.8501608 4.1910852 4.9508869 11.9260378 5.1473547 6.1864583 2.8165587 3.8589393 5.1742220 2.8812650 4.1469513 2.9816058 6.9291070 4.0086371 2.8950365 3.1368533 2.9716707 4.0936148 4.0987735 8.8792285 2.9914305 15.9832293 11.1705646 4.1691180 2.0268396 9.1313510 2.8457873 5.8162405 5.1019303 2.9493099 3.1892744 6.1027555 5.9852653 6.0070368 5.0606722 3.8827039 2.8579010 3.1809342 2.8639117 4.0446142 8.1086074 6.9708477 3.9406243 3.9113551 2.8471808 3.9408469 1.8318536 4.8696027 6.1638158 10.0075047 4.0620721 2.1995222 2.9713600 0.9827086 11.8048057 3.1639570 4.1820899 2.8913417 5.1807095 1.8735194 3.8650210 2.9308563 6.9203276 7.0470336 2.1721080 1.9304191 2.9782089 4.9717892 1.8260324 4.0094237 6.0354774 4.1934337 3.8605304 6.9868062 9.0001938 19.9510362 10.0213967 1.9980948 1.9564188 10.0595901 5.9441410 5.9212171 1.9805753 2.8141160 9.8859371 2.1912938 5.0260191 7.0394183 3.1071499 4.8651357 4.8464983 3.1653826 4.0813080 0.9293124 2.0533324 3.1302422 5.0649879 1.9045972 3.0304574 6.1638933 1.8765108 2.1042605 5.0677281 7.9328270 5.0485400 11.8101217 2.8496955 3.9641349 2.0423748 3.9535697 10.1833001 1.9963743 3.9404075 1.0794579 5.1952880 2.1310139 3.1615550 4.1934939 2.1528778 1.8080386 7.8411243 9.8299614 6.0534968 4.0174467 2.0321006 6.8884815 3.1990381 3.9448174 4.1087308 2.8989261 3.1667614 3.0734750 4.9591400 4.0537864 5.1886589 2.0860818 3.9166460 3.8028030 2.8333645 2.0257119 3.9347423 2.1057551 2.9608942 5.8546608 3.1449161 1.8630542 5.0733393 1.8331204 3.1629142 4.0929211 6.9565034 3.8253997 2.8041233 5.1246350 3.8994802 2.0389505 5.0663955 3.8854816 1.8575128 1.9655496 3.0056002 4.9812668 4.8201262 I fit the GEV to the data: fit5 = fevd(t1, type="GEV") using the function fevd in extRemes package. I wanna do K-S test simulation but get 50 warnings at this part: stats <- replicate(n.sims, { r <- rgevd(n = length(t1),location=fit5$results$par["location"], shape= fit5$results$par["shape"], scale = fit5$results$par["scale"]) estfit.gev <- fevd(r, type = "GEV") # added to account for the estimated parameters as.numeric(ks.test(r, "pgevd",location=estfit.gev$results$par["location"], shape= estfit.gev$results$par["shape"], scale = estfit.gev$results$par["scale"])$statistic) how do I solve this Warning in log(z): NaNs produced? I tried to use absolute r value but I still get the same warnings
object not found - plot.xy
I'm trying to run codes that are below. And R gives an Error object 'fireworks' not found. Did anyone came cross such Error. How could I fix it? plot.xy(attend/10000~temp|skies+day_night, data=dodgers, groups=fireworks, pch=group.symbols, aspect=1,cex=1.5, col=group.colors, fill=group.fill, layout=c(2,2), type=c("p","g"), xlab="Temperature(Degrees Fahrenheit)", ylab="Attendance(thousands)", key=list(space="top", text=list(rev(group.labels), col=rev(group.labels)), fill=rev(group.fill))) Eror: in plot.xy(attend/10000 ~ temp | skies + day_night, data = dodgers, : object 'fireworks' not found
'Con not a connection' Error in R program
I am trying to use readLines in R but I am getting below error orders1<-readLines(orders,2) # Error in readLines(orders, 2) : 'con' is not a connection Code : orders<-read.csv("~/orders.csv") orders orders1<-readLines(orders,2) orders1 Data: id,item,quantity_ordered,item_cost 1,playboy roll,1,12 1,rockstar roll,1,10 1,spider roll,1,8 1,keystone roll,1,25 1,salmon sashimi,6,3 1,tuna sashimi,6,2.5 1,edamame,1,6 2,salmon skin roll,1,8 2,playboy roll,1,12 2,unobtanium roll,1,35 2,tuna sashimi,4,2.5 2,yellowtail hand roll,1,7 4,california roll,1,4 4,cucumber roll,1,3.5 5,unagi roll,1,6.5 5,firecracker roll,1,9 5,unobtanium roll,1,35 ,chicken teriaki hibachi,1,7.95 ,diet coke,1,1.95
I'm guessing you want this: orders1 <- readLines( file("~/orders.csv") ) It's not clear why you want to do your own parsing or substitution, but that should give readLines a valid connection object.
unable to draw contour in R for temperature data
I have my data in a csv file in the given format. csv file data Latitude,Longitude,Temperature 20,84.01,15.93913043 28.48,77.13,16.62857143 28.68,77.2,17.81333333 31.32,78.16,2.472222222 31.531,77.112,5.228 28.11,77,21.85 31.5,77.09,7.910526316 31.43,76.57,11.444 28.7,77.15,17.708 30.55,77.35,15.30526316 26.95,78.96,16.46818182 27.44,79.39,15.74090909 26.58,81.59,15.90952381 25.33,80.43,18.465 29.45,77.34,14.15238095 20.42,86.47,19.83181818 29.52,75.5,14.135 24.17,72.43,20.065 25.1,76.19,18.59444444 30.975,76.517,14.88421053 28.8,76.13,16.05 29.54,75.04,15.295 24.32,72.3,18.84782609 23.86,72.13,20.49444444 30.19,74.95,13.996 22.36,73.16,22.365 30.78,75.84,13.75652174 21.86,73.52,24.725 21.5,70.44,22.812 21.36,69.75,22.33125 30.32,78.05,15.35 20.92,72.89,21.3 17.69,74.02,23.45 28.3278,77.2467,17.87857143 20.17,79.98,21.11428571 24,76.73,23.67857143 22.76,74.59,19.97619048 22.03,74.97,20.85 29.57,80.23,12.70869565 29.95,79.9,13.425 25.92,83.56,16.67 27.6,81.58,15.128 24.68,78.4,19.1 18.11,76.02,22.84285714 20.39,78.11,24.98571429 24.57,80.82,23.35714286 21.283,76.198,22.98235294 21.81,80.18,20.16666667 24.5,81.3,16.22857143 22.09,82.17,18.93636364 30.35,76.87,14.77 19.7,81.7,19.98823529 18.9,81.35,19.16956522 28.9917,77.701,15.43636364 28.39,77.83,15.745 27.58,77.98,16.52631579 27.03,79.92,17.40526316 26.57,80.48,12.67 25.17,80.91,24.75 26.55,79.55,17.12727273 22.443,77.03,18.825 30.19,78.18,15.72857143 29.87,77.88,14.75454545 26.54,81.83,15.75416667 29.93,77.97,12.96666667 26.127,81.94,17.54666667 26.43,82.57,16.63684211 29.34,80.09,11.82631579 27.14,83.53,15.82 21.1,86.5,19.82 20.25,85.82,21.31 21.13,86.57,19.352 20.23,86.18,19.52173913 20.46,85.9,20.74 27.17,78.03,17.292 20.83,84.33,19.224 21.89,84.03,19.47142857 20.01,83.01,20.295 19,83.01,21.24285714 18.53,73.83,22.47142857 18.81,82.71,19.04545455 18.01,82.01,20.73076923 25,84.01,16.952 25.03,85.6,18.48125 19.92,83.16,19.975 26.21,84.35,16.15454545 26.58,84.38,16.1952381 25.73,85.23,15.9375 26.38,85.73,16.39 25.98,85.66,16.176 30.48,78.05,8.985 18.35,81.88,21.736 26.54,85.72,16.53043478 26,85.01,16.104 26.9,75.8,18.97272727 25.92,86.8,16.01904762 26.42,74.62,21.04545455 24.87,85.53,14.9 24.8,85.04,16.236 25.91,86.55,16.17 25.3,83,20.13333333 25.52,87.57,17.13181818 25.37,86.48,17.56190476 25.01,86,16.42727273 26.9,76.35,18.836 25.23,87.03,15.3875 26.07,76.37,17.324 25.41,75.65,18.03684211 25.12,75.93,17.93333333 19.65,78.52,21.51052632 24.58,76.13,19.8 26.16,75.78,19.24285714 24.9,74.61,18.74583333 18.56,77.88,23.68571429 18.83,78.93,22.75238095 17.01,78.97,21.63684211 18.43,79.08,22.78181818 17.21,77.58,22.36363636 26.51,85.28,15.988 18.01,79.6,24.295 16.5,78.23,22.368 28.62,77.27,17.135 15.45,78.46,24.09444444 16.85,79.47,23.58571429 16.35,80.43,23.988 17.62,74.07,22.97777778 16.36,80.84,22.976 14.68,77.67,23.62 17.87,82.34,19.12 17.7,83,21.62083333 14.11,78.15,23.52352941 14.43,78.8,23.92857143 17.24,81.1,22.6 23.55,74.44,26.72 23.51,74.38,19.105 28.28,75.12,18.33333333 12.38,78.21,23.22857143 28.35,75.58,16.25714286 11.33,76.8,15.97391304 13.15,80.23,23.65263158 13.63,79.73,22.688 12.71,77.81,21.03809524 11.62,79.53,24.01818182 13.61,79.34,22.35454545 11.01,76.94,24.765 11.37,76.63,14.824 13.25,80.31,26.384 11.13,79.07,25.87 11.22,78.87,24.86 26.25,82,16.25217391 10.77,76.7,26.32 11.15,78.15,26.03888889 10.53,76.28,27.46666667 24.57,73.7,9.8 9.62,76.42,28.135 12.95,78.25,22.26111111 23.86,73.86,20.24 12.97,77.18,23.35652174 9.55,77.934,26.18636364 10.117,77.583,24.93157895 13.663,76.916,22.21363636 9.2,77.88,26.98 8.43,76.99,26.33809524 8.73,77.7,27.02380952 11.26,75.77,28.36470588 8.43,77.3,26.47619048 11.0617,76.21,21.59 12.15,76.8,22.73809524 13.34,75.8,20.49047619 11.91,76.93,23.37619048 25.79,73.3,18.55652174 13.72,75.72,22.75263158 12.42,75.73,19.85 26.8,75.8,18.80416667 25.75,71.4,24.05 25.38,72.5,22.38 27.9,78.07,17.15789474 26.12,91.82,18.00555556 14.611,74.846,21.89 12.65,74.96,25.74736842 16.18,77.32,24.73888889 15.48,74.98,22.80909091 27.58,75.13,17.195 27.15,73.78,21.04166667 17.35,76.8,23.78888889 27.93,74.98,17.32105263 26.351,92.633,17.57142857 25.87,93.43,15.88 14.78,75.33,23.655 15.9,75.55,23.05454545 16.98,75.75,23.73333333 27.53,76.6,17.01052632 26.44,89.94,15.684 26.35,90.65,18.98 26.48,90.9,15.688 29.49,73.5,13.752 14.03,77.27,23.605 29.93,73.88,14.30588235 26.65,91.33,16.59565217 16.15,75.6,19.57692308 13.96,75.56,22.95714286 26.71,93.13,15.95714286 26.72,77.89,19.03846154 25.11,76.47,19.04444444 26.16,90.63,16.86818182 26.51,93.96,16.56956522 26.467,90.283,16.615 27.2,77.46,15.84545455 26.72,94.18,16.61 26.55,77,18.58695652 27.467,95.02,16.452 10.08,77.05,16.04 25.36,74.63,19.18571429 14.283,74.45,25.65238095 24.6,92.55,18.965 25.56,91.86,11.03478261 24.85,92.3,23.05 25.454,92.2069,12.044 9.834,76.95,22.456 28.333,79.417,15.99090909 27.71,81.91,14.88571429 25.87,84.13,12.81666667 26.78,78.98,20.1 26.33,79.97,17.7125 25.68,91.92,14.98888889 25.2,90.63,19.11578947 25.52,91.27,10.316 26.25,81.37,17.04210526 24.58,72.7,14.35 26.95,94.62,17.43333333 27.48,95.31,16.108 23.53,84.81,16.07619048 26.97,93.87,15.712 25.5,90.58,16.09473684 23.78,85.88,17.42631579 24.83,87.2,17.484 25.23,86.65,22.075 27.47,94.55,17.31052632 24.5,87.81,17.99130435 26.52,90.48,16.925 24.49,86.66,21.56875 17.43,78.47,23.636 24.2,86.3,16.83 24.16,83.8,16.635 22.47,88.09,18.27777778 24.8,92.78,18.168 22.69,86.43,17.15238095 22.27,87.92,19.71666667 29.46,79.65,9.25 22.3,87.3,18.97 22.36,88.43,18.58571429 22.662,88.873,19.12 22.97,88.48,21.24545455 23.4,88.49,17.99166667 23.53,91.46,17.92 32.37,75.55,14.44583333 23.21,87.88,19.11666667 32.65,74.8,13.45454545 23.24,87.04,18.892 23.91,87.52,19.42272727 31.18,77.13,4.424 24.092,88.27,21.4 25.62,88.14,17.50555556 31.33,75.33,13.91428571 23.8,91.27,19.10555556 26.52,88.72,13.65625 24.4,89.39,15.97826087 34.05,74.8,3.419047619 34.14,74.87,2.961904762 25.31,88.76,17.65263158 34.06,74.71,3.036363636 27.07,88.46,13.75652174 27.15,88.4,11.696 24.07,91.61,18.56842105 34.35,74.4,1.118181818 25.18,93.01,18.8 33.888,74.9808,5.125 33.64,74.94,1.635 23.43,85.3,17.4 24.18,91.82,22.1 23.48,93.3,14.836 24.208,92.675,18.988 23.95,92.49,18.305 33.22,75.26,7.57 23.33,92.83,17.485 22.5055,92.895,18.21578947 32.9,75.167,11.42 22.95,92.93,16.78 22.48,92.98,19.40454545 26.72,92.08,16.804 18.22,74.48,23.43333333 17.26,74.42,17.07647059 30.15,75.41,17.36666667 31.63,74.83,14.29444444 31.46,77.22,5.661904762 30.73,76.8,15.395 31.32,75.3,13.80769231 30.91,74.66,13.28947368 20.76,73.69,23.83333333 31.37,74.97,12.724 31.38,76.024,14.865 20.4,72.833,20.672 23.303,70.36,20.628 31.39,75.36,14.52142857 21.144,72.75,24.92222222 23.37,68.54,19.37222222 20.8,70.7,22.295 20.143,74.794,26.94444444 18.97,73.04,24.73157895 18.33,73.79,22.23684211 21.02,75.53,23.15833333 28.47,77.03,21.1 17.67,75.92,24.94545455 19.03,73.17,24.74615385 22.94,79.22,17.4 25.688,78.4419,18.9 22.94,81.08,15.76818182 22.6,82.13,18.308 21.1,81.034,21.95 21.97,81.24,20.3375 22.37,82.733,17.77083333 21.23,81.7,14.96428571 25.35,81.3,16.92 26.79,82.72,18.1125 26.48,83.77,16.86666667 29.36,79.46,9.733333333 25.92,84.13,16.616 28.98,79.4,16.068 25.72,82.68,16.572 25.17,82.6,16.175 29.62,79.62,13.245 30.7,76.9,16.096 30.36,75.53,13.78888889 22.8,73.22,20.07083333 22.58,72.28,20.46 22.73,72.88,23.5875 23.27,72.65,21.43888889 30.36,76.45,13.97 22.88,74.23,21.42 17.69,74.02,20.988 18.53,73.8,21.98095238 28.1,77,14.965 28.08,76.59,17.8 31.1,77.17,6.628571429 28.28,76.15,17.94 30.1,77.28,14.07777778 29.68,77,13.628 29.7,77.03,14.21764706 29.38,77,12.85384615 28.611,76.651,15.08947368 28.8836,76.619,15.695 29.78,76.4,13.67 31.35,76.7525,13.14347826 31.45,76.26,13.85238095 28.66,77.31,17.71578947 29.58,76.51,14.625 29.3,75.45,15.28421053 29.068,75.476,16.05263158 28.63,77.15,16.575 28.8,76.97,15.12 30.90444,76.96,8.48 30.89916,76.96,12.392 31.5858,77.0748,6.884 32.3521,76.0608,7.844 32.1994,76.3249,11.67777778 28.58,76.9,15.6 29.13,75.7,15.608 30.2,75.88,14.72857143 31.09,76.38,15.6 31.13,76.12,14.7 30.6,76.1,13.49090909 30.67,74.74,13.825 21.7,73.01,14.45 21.73,72.55,23.42352941 32.05,75.42,13.04736842 30.62,76.41,13.49090909 31.6,75.98,16.1 20.54,73.16,22.70833333 22.73,71.62,24.21538462 28.63,77,17.245 19.18,72.98,27.00666667 20.9,74.8,23.6 23.83,73,21.71333333 21.16,73.79,23.51578947 28.63,77.36,16.836 28.63,77.37,17.252 28.23,77.18,15.85454545 22.34,70.91,21.075 21.37,74.23,24.24210526 19.09,74.75,21.21818182 19.36,75.95,23.3047619 16,73.7,25.14166667 16.67,74.16,22.89545455 18.4,76.56,23.275 15.48,73.91,26.81764706 19.85,75.87,21 20.94,77.78,23.285 18.72,76.36,23.89375 19.73,77.15,21.85263158 20.13,77.13,25.08125 20.7,77.65,20.05 21.16,79.65,21.32 21.49,80.15,18.30416667 22.3,79.67,23.19090909 26.4772,77.9866,17.328 26.5727,78.81,16.856 22.0683,79.5488,16.036 24.5972,77.75,18.8625 24.42,74.8708,18.93809524 24.06,75.1,18.93333333 22.88,84.56,16.75 23.444,75.044,18.97916667 22.7,75.89,20.97 20.53,76.19,23.49 21.82,75.62,22.50952381 23.83,78.69,26.7875 23.18,77.06,20.295 25.03,79.5,18.79 23.82,79.4,17.095 25.67,76.69,21.26 22.314,74.353,19.064 22.056,78.94,16.83333333 21.86,77.937,19.58333333 23.21,79.96,17.56190476 22.6,80.3,16.14761905 23.28,81.33,16.37142857 24.73,80.21,19.6625 23.525,80.84,17.63888889 24.41,81.86,18.38461538 23.09,83.14,15.60666667 24.07,82.61,16.95555556 23.12,81.7,17.71111111 21.88,83.4,19.548 23.515,77.81,20.57142857 22.58,81.13,19.17368421 21.103,82.083,20.92380952 20.66,81.53,20.27647059 20.25,81.5,20.64444444 30.756,75.163,12.795 18.8,80.8,21.0952381 28.01,79.11,16.25 27.55,78.65,15.1 27.22,79.03,17.38947368 16.98,73.32,24.70526316 30.05,79,8.456 30.74,76.73,16.32727273 25.21,82.27,22.54 19.8,85.83,21.5952381 20.84,86.32,20.155 22.03,84.05,19.05217391 21.33,83.62,19.915 20.12,85.08,19.904 21.61,85.56,18.728 20.83,85.1,19.656 21.36,83.88,18.896 20.52,86.43,19.76190476 19.3,84.8,22.65333333 19.25,82.54,19.03333333 24.95,84,18.05 23.55,83.96,16.288 25.0286,73.89,18.44117647 11.28,76.23,25.91666667 26.26,72.99,18.52 15.42,75.63,23.7 22.9,88.37,16.58095238 27.28,88.23,10.93333333 26.02,94.53,10.45 I tried drawing a contour using contour(), contourplot() etc, I am not sure how to make my data regular to get a contour . I tried akima interp() but getting error given below. not sure what that means and how to correct my data to get a contour. *Error in is.finite(x) : default method not implemented for type 'list'* someone please help me out. Thanks.
This works for me (by the way, dumping this size data file, even though it's only moderate-sized, is kind of a pain for responders: if you can post it somewhere that's easier. I had to save the HTML page source and extract the info that way, as it was too big for me to cut & paste from the clipboard): X <- read.csv("tempcontour.txt") library(akima) ## needed to specify the 'duplicate' argument (see ?interp) interp1 <- with(X,interp(Latitude,Longitude,Temperature, duplicate="mean")) names(interp1) <- colnames(X) ## assumes colnames are in Lat/Long/Temp order png("interp1.png") with(interp1,contour(Longitude,Latitude,Temperature, ylab="Latitude",xlab="Longitude")) dev.off()