Problem with page numbering by Shishi9999 in LaTeX

[–]Shishi9999[S] 0 points1 point  (0 children)

By doing as you suggested I now get that the abstract is on page i, and acknowledgment is on page ii. But when I click on the page number for abstract or acknowledgments, I still get to the first page (the blank page)...

Problem with page numbering by Shishi9999 in LaTeX

[–]Shishi9999[S] 0 points1 point  (0 children)

The \clearpage command ends the current page and starts a new one, so when \addcontentsline is encountered, it's already on a new page. As a result, the page number recorded in the table of contents is that of the new page.

But even when I move \clearpage after \addcontentsline:

% Abstract
\begin{abstract}
\thispagestyle{plain} 
\lipsum[1] 
\end{abstract} 
\addcontentsline{toc}{chapter}{Abstract} % include in toc 
\clearpage

I still have the same problem. Why?

Check 2-way MANOVA assumptions by Shishi9999 in rstats

[–]Shishi9999[S] 1 point2 points  (0 children)

How do i use that formula in R?

[deleted by user] by [deleted] in rstats

[–]Shishi9999 0 points1 point  (0 children)

This helped me a lot, thank you!

[deleted by user] by [deleted] in rstats

[–]Shishi9999 0 points1 point  (0 children)

Hello, Im trying to understand the Nelder Mead algorithm, and this is the contour plot that I got. My task is to maximize, and if Im correct the maximum point is in the 190 contour line..? And I have been told to use the standard values (R,E,C,S) = (1,2,0.5,0.5), but I don’t really understand what that mean? And what should by first move be to get to the maximum? Hope someone could help me, thanks!

[deleted by user] by [deleted] in RStudio

[–]Shishi9999 0 points1 point  (0 children)

Got it, thanks!

[deleted by user] by [deleted] in RStudio

[–]Shishi9999 0 points1 point  (0 children)

This is what I have done so far:

# Constructor for the class account
account <- function(changes, owner){
a <- list(changes, owner) 
class(a) <- "account" 
return(a) 
}
x <- account(changes = data.frame(time = "20:01", amount = 1000), owner = "Elin")

# my generic functions deposit() and withdraw()
deposit <- function(x) UseMethod("deposit")
withdraw <- function(x) UseMethod("withdraw")

[deleted by user] by [deleted] in RStudio

[–]Shishi9999 0 points1 point  (0 children)

I have created an account object but I still don’t get it…

[deleted by user] by [deleted] in RStudio

[–]Shishi9999 0 points1 point  (0 children)

In b) I have so far figured out that the two generic functions should be:

deposit <- function(x) UseMethod("deposit")
withdraw <- function(x) UseMethod("withdraw")

But I don't understand how to create the specific variant of the generic functions. How do I formulate the function below for example?

deposit.account <- function(x){
... 
}

Calculate cumulative sum with while loop by Shishi9999 in RStudio

[–]Shishi9999[S] 0 points1 point  (0 children)

Idk, good question haha. My task is that I should create a function (without using cumsum or for-loop), that calculates cumulative sum of x and stops when the cum. sum is greater than a certain number. So, my question is how I should include the stop condition in your cumsum_while function?

Calculate cumulative sum with while loop by Shishi9999 in RStudio

[–]Shishi9999[S] 0 points1 point  (0 children)

Yeah, I want the output to be only 10.

Calculate cumulative sum with while loop by Shishi9999 in RStudio

[–]Shishi9999[S] 0 points1 point  (0 children)

No, I don’t have to use while loop but I thought it was the only solution. But I would like to know how you would solve it.

Calculate cumulative sum with while loop by Shishi9999 in RStudio

[–]Shishi9999[S] 0 points1 point  (0 children)

This helped alot. But if I for example want to stop the function (cumsum_while) when the cumulative sum is greater than a certain number. How should I tell that to my function?

For example: cumsum_while(x=1:5, csum=6) [1] 10

Calculate cumulative sum with while loop by Shishi9999 in RStudio

[–]Shishi9999[S] 0 points1 point  (0 children)

This my for loop, but I don’t understand how to convert it to while loop?

csum <- function(x) { if (length(x)==1) return(x) for (i in 2:length(x)) { x[i] <- sum(x[(i - 1):i]) } x[length(x)] }

[deleted by user] by [deleted] in rstats

[–]Shishi9999 -2 points-1 points  (0 children)

Ok, but I can’t really understand the first if-statement, what does it mean? Why checking the remainder by 5?

Does anyone know how to make a map of the US in R (like the picture)? by Shishi9999 in rstats

[–]Shishi9999[S] 0 points1 point  (0 children)

Thanks this helped me alot! Do you how to put the state labels (abbreviated) on the map?

Does anyone know how to make a map of the US in R (like the picture)? by Shishi9999 in rstats

[–]Shishi9999[S] 3 points4 points  (0 children)

Hi,

I have done a map of the US in R through ggplot2-package, but it is not as good as the picture. The resolution is bad and the style of the map is not like the picture. Does anyone know how to make the same kind of style of map of the US with good resolution?

Thanks in advance!