(Just learning R)
I have this vector:
v <- c(1:10)
Now, I want to multiply each element of that vector with a scalar value
multiplied with its index:
vm <- v * scalar * indexOfCurrentElementOf_v
Is that possible without using a loop?
In a loop I would do this:
for (i in 1:length(a)) a[i] <-
it works even if length(a) == 0.
>
> Hope this helps,
>
> Rui Barradas
>
> Em 04-06-2012 21:25, Erdal Karaca escreveu:
>
>> (Just learning R)
>>
>> I have this vector:
>>
>> v<- c(1:10)
>>
>> Now, I want to multiply each element of
german "Null" == english "zero" :-)
2012/7/10 Rolf Turner
>
>
> In addition to taking cognisance of Richard Heiberger's reply you
> should also learn to distinguish between the concept of "null" and
> "zero". They are not at all the same thing.
>
> cheers,
>
> Rolf Turner
>
>
> On 1
k Connolly
> On Tue, 10-Jul-2012 at 11:19PM +0200, Erdal Karaca wrote:
>
> |> german "Null" == english "zero" :-)
>
> German "Gift" == English "poison" :-(
>
>
>
>
>
>
>
> |>
> |> 2012/7/10 Rolf Turner
Just tried XLConnect which seems to work without any problems...
When defining this:
wb <- loadWorkbook("c:\\path-to-xls-file")
readCell <- function(sheet, row, col) {
readWorksheet(wb, sheet, startRow=row, endRow=row, startCol=col,
endCol=col, header=FALSE)[[1]]
}
then, calling the function l
Anyone knows how to convert a deldir$delsgs to a X3D IndexedTriangleSet?
Are there already any functions/packages?
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do r
t the result back to a
IndexedTriangelSet to visualize in a X3D browser.
[1] http://en.wikipedia.org/wiki/X3D
[2]
http://www.web3d.org/files/specifications/19775-1/V3.2/Part01/components/rendering.html#IndexedTriangleSet
2012/7/19 Rolf Turner
> On 19/07/12 01:13, Erdal Karaca wrote:
>
>>
:36, Erdal Karaca wrote:
>
> Oh, sorry: X3D is an interchange format for 3D scenes (s [1])...
> X3D's IndexedTriangleSet is a visual component to describe a complex
> figure to be visualized by triangles (s. [2])
>
> I would like to triangulate a pointset (2.5D DEM consisting
My data:
> head(cbind(x,y,z))
x y z
[1,] -78.1444 -60.4424 -10.09
[2,] -78.1444 -58.4424 -10.26
[3,] -78.1444 -56.4424 -10.45
[4,] -78.1444 -54.4424 -10.64
[5,] -76.1444 -60.4424 -10.19
[6,] -76.1444 -58.4424 -10.34
> tris <- deldir(x, y)
> triangs <- triang.list(tris)
> head(tris$delsgs)
x1 y1
I am trying to triangulate a point set as follows:
> head(cbind(x,y))
x y
[1,] -78.1444 -60.4424
[2,] -78.1444 -58.4424
[3,] -78.1444 -56.4424
[4,] -78.1444 -54.4424
[5,] -76.1444 -60.4424
[6,] -76.1444 -58.4424
> length(x)
[1] 5000
> tri <- tri.mesh(x, y)
Fehler in tri.mesh(x, y) : error in trm
Sorry, I just found this to be a common "problem" of tri.mesh:
I had to "jitter" one of my first three coords in the point set:
x[2] <- x[2] + 0.01
Though, that does not seem to sound clean. Is there a better way?
2012/7/19 Erdal Karaca
> I am trying to triangul
e("
",
file=outputFile, append=TRUE)
##
2012/7/20 Rolf Turner
> On 19/07/12 20:40, Erdal Karaca wrote:
>
>> Oh, I dont want anyone to do anything for me. I am just asking for
>> hints/infos to be able to do it myself...
>> I was hoping that someo
I am trying to get contents of a REST response:
getURL("http://localhost/myweb-app/rest-ws";)
This is a web application (myweb-app) which is providing a REST web service
(rest-ws)...
Unfortunately, the HTTP status sent back is 404.
If I request the url using Chrome/IE, I get a HTTP status 200 OK
You can try this one...
#
library(RCurl)
library(rjson)
ids <- c("tt0110074", "tt0096184", "tt0081568", "tt0448134", "tt0079367")
titles <- data.frame()
for ( i in 1:length(ids)) {
req <- paste("http://www.imdbapi.com/?i=";, ids[i] , "&tomatoes=TRUE",
sep="")
u <- getURL(req)
j <- fromJSON(u
I have this object:
> obj <- list(test=1.0)
> obj
$test
[1] 1
> toJSON(obj)
[1] "{\"test\":1}"
How do force the serialization of obj$test to be "1.0" instead of "1"?
I.e. the output should be:
> toJSON(obj)
[1] "{\"test\":1.0}"
[[alternative HTML version deleted]]
my computer and will be away from it for 2 or 3
> days, so I can't install package XLConnect and see what's going on.
>
> Heve you tried the functions to get sheets first? (by number, maybe.)
>
> Rui Barradas
>
> Em 16-07-2012 22:30, Erdal Karaca escreveu:
>
&
If this is an option for you: An xml database can handle (very) huge xml
files and let you query nodes very efficiently.
Then, you could query the xml databse from R (using REST) to do your
statistics.
There are some open source xquery/xml databases available.
2012/8/11 Frederic Fournier
> Hell
17 matches
Mail list logo