LogFAQs > #908642318

LurkerFAQs, Active DB, DB1, DB2, DB3, Database 4 ( 07.23.2018-12.31.2018 ), DB5, DB6, DB7, DB8, DB9, DB10, DB11, DB12, Clear
Topic List
Page List: 1
TopicHas anyone here ever worked with R?
Magus 10
09/13/18 12:21:55 AM
#13:


Looks like R supports for loops just fine:

https://www.datacamp.com./user.php?user=tutorials/tutorial-on-loops-in-r

# Create a vector filled with random normal values
u1 <- rnorm(30)
print("This loop calculates the square of the first 10 elements of vector u1")

# Initialize `usq`
usq <- 0

for(i in 1:10) {
# i-th element of `u1` squared into `i`-th position of `usq`
usq[i] <- u1[i]*u1[i]
print(usq[i])
}

print(i)


It should be simple enough to modify that example to what you need.
---
Internet = Tube0 + Tube1X + Tube2X^2/2! + Tube3X^3/3! + Tube4X^4/4! + ...
... Copied to Clipboard!
Topic List
Page List: 1